-
Notifications
You must be signed in to change notification settings - Fork 476
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
Update docs and add SSH config file passing #490
Conversation
pxssh changelog for release 4.5 (#484)
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 idea looks fine, but there are a couple of minor changes to be made.
pexpect/pxssh.py
Outdated
@@ -294,8 +294,15 @@ def login (self, server, username, password='', terminal_type='ansi', | |||
session to do so. Setting this option to `False` and not having an active session | |||
will trigger an error. | |||
|
|||
Set ``ssh_key`` to `True` to force passing the current SSH authentication socket to the | |||
Setting ``ssh_key`` to a file path to an SSH private key will use that SSH key |
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.
I'd like the docstring to be consistent about using either "Set ... to ..." or "Setting ... will ...". I don't have a strong preference which (though it's easier to change the bits you've just added), but it should use the same one throughout.
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.
Sure thing.
pexpect/pxssh.py
Outdated
try: | ||
if spawn_local_ssh: | ||
os.path.isfile(ssh_config) | ||
except: |
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.
Catching all exceptions like this is not good practice, because it can obscure other problems. In this case it also won't do what you want, because isfile()
returns False rather that raising an exception.
Maybe you want:
if spawn_local_ssh and not os.path.isfile(ssh_config):
raise ...
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.
Odd because I copied what was already there.
I'll push this into a function as well as I debating either to leave it as it is or functionize it.
tests/test_pxssh.py
Outdated
@@ -85,6 +85,13 @@ def test_remote_ssh_tunnel_string(self): | |||
if confirmation_strings!=len(confirmation_array): | |||
assert False, 'String generated from remote tunneling is incorrect.' | |||
|
|||
def test_ssh_config_passing_string(self): | |||
ssh = pxssh.pxssh(debug_command_string=True) | |||
config_path = '/fakepath/fake/config_file' |
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.
And once the file-exists check is working, you presumably need to create a real named temp file to test with.
It would also be good to have a test with a nonexistent file to check that it errors.
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.
yeap.
I'm not 100% sure what you mean about a docs update, but if you mean rebuilding them, there's good news! Readthedocs rebuilds docs automatically whenever changes are made, so it will update once this is merged. |
I'll fix these on the weekend and its good to hear about the docs at least! |
Sorry for not getting back to this sooner however this should be up to spec now. |
pexpect/pxssh.py
Outdated
to the desired ``hostname``. | ||
|
||
Set ``ssh_config`` to a file path string of an SSH client config file will pass that |
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.
These need another minor tweak to fix the grammar for "Set" rather than "Setting":
- Setting X to Y will do Z
- Set X to Y to do Z
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.
Fair enough.
Fixed as per request. |
As per the title, this is for issues #489 and #429.
@takluyver it might be a good idea to do a docs update from commit 6b741f9 as this will solve a small piece of miscommunication I introduced by doing doc updates for my own additions but not for pre-existing features.