-
Notifications
You must be signed in to change notification settings - Fork 922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changes to ssh_config.py to support a global ssh_config for users #660
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,7 +300,10 @@ def openssh_connect( | |
users_ssh_dir = os.path.join(os.environ['USERPROFILE'], '.ssh') | ||
if not os.path.exists(users_ssh_dir): | ||
mkdir_p(users_ssh_dir) | ||
ssh_config_path = os.path.join(users_ssh_dir, 'config') | ||
if config: | ||
ssh_config_path = config | ||
else: | ||
ssh_config_path = os.path.join(users_ssh_dir, 'config') | ||
if not os.path.exists(ssh_config_path): | ||
# Create it (an empty one so ssh doesn't error out) | ||
with open(ssh_config_path, 'w') as f: | ||
|
@@ -724,6 +727,11 @@ def main(): | |
"credentials only (you probably want to use --default_host and " | ||
"--default_port as well).") | ||
) | ||
parser.add_option("--config", | ||
dest="config", | ||
default=None, | ||
help=_("Provide an ssh config file location") | ||
) | ||
(options, args) = parser.parse_args() | ||
if options.logo_path: | ||
options.logo = True | ||
|
@@ -743,6 +751,7 @@ def main(): | |
identities=parsed.get('identities', []), | ||
additional_args=options.additional_args, | ||
socket=options.socket, | ||
config=options.config, | ||
debug=parsed.get('debug', False) | ||
) | ||
elif len(args) == 2: # No port given, assume 22 | ||
|
@@ -751,15 +760,17 @@ def main(): | |
sshfp=options.sshfp, | ||
randomart=options.randomart, | ||
additional_args=options.additional_args, | ||
socket=options.socket | ||
socket=options.socket, | ||
config=options.config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: The indentation doesn't seem to be correct here. Try running |
||
) | ||
elif len(args) == 3: | ||
openssh_connect(args[0], args[1], args[2], | ||
command=options.command, | ||
sshfp=options.sshfp, | ||
randomart=options.randomart, | ||
additional_args=options.additional_args, | ||
socket=options.socket | ||
socket=options.socket, | ||
config=options.config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: The indentation doesn't seem to be correct here. Try running |
||
) | ||
except Exception: | ||
pass # Something ain't right. Try the interactive entry method... | ||
|
@@ -895,6 +906,7 @@ def main(): | |
identities=identities, | ||
additional_args=options.additional_args, | ||
socket=options.socket, | ||
config=options.config, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: The indentation doesn't seem to be correct here. Try running |
||
debug=debug | ||
) | ||
elif protocol == 'telnet': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation doesn't seem to be correct here. Try running
flake8
over this file.