Merge lp:~patrickas/ensoft-sextant/command-line-ssh-user into lp:ensoft-sextant

Proposed by Patrick Stevens
Status: Merged
Approved by: ChrisD
Approved revision: 14
Merged at revision: 14
Proposed branch: lp:~patrickas/ensoft-sextant/command-line-ssh-user
Merge into: lp:ensoft-sextant
Diff against target: 39 lines (+9/-1)
2 files modified
doc/wiki/Reference (+2/-0)
src/sextant/__main__.py (+7/-1)
To merge this branch: bzr merge lp:~patrickas/ensoft-sextant/command-line-ssh-user
Reviewer Review Type Date Requested Status
ChrisD Approve
Review via email: mp+232911@code.launchpad.net

Commit message

Add a command line option, --ssh-user, to allow the SSH remote user to be specified.

Description of the change

Add a command line option, --ssh-user, to allow the SSH remote user to be specified.

To post a comment you must log in.
Revision history for this message
Martin Morrison (isoschiz) wrote :

Voting does not meet specified criteria. Required: Approve >= 1, Disapprove == 0. Got: 1 Pending.

Revision history for this message
ChrisD (gingerchris) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/wiki/Reference'
2--- doc/wiki/Reference 2014-08-29 10:47:37 +0000
3+++ doc/wiki/Reference 2014-09-01 16:06:22 +0000
4@@ -53,4 +53,6 @@
5 == SSH ==
6 Sextant allows you to create an SSH tunnel between your client and the Neo4J server. Sextant picks a random high-numbered port which is not in use, sets up an SSH tunnel between {{{ localhost:{that port} }}} and the specified {{{ remote_neo4j }}} in the configuration file (or as the {{{ --remote-neo4j }}} command-line option), and then uses {{{ localhost:{port} }}} for communications. This happens by default; if you do not wish for this to happen, set the config option {{{ use_ssh_tunnel }}} to {{{ False }}} in the configuration file.
7
8+By default, Sextant uses your current logged-in username as the remote SSH username. You can change this behaviour in the config file by supplying {{{ ssh_user }}}, or by using the command line argument {{{ --ssh-user }}}.
9+
10 Warning: if you have {{{ remote_neo4j }}} set to some variant of {{{ localhost }}}, then SSH may fail (because a machine can't easily SSH to itself as currently implemented). We have some error-catching here - if we detect that we are attempting to SSH to ourself, then we skip using SSH at all - but it can probably be broken by a determined user. If you do encounter an error for this reason, the workaround at present is to set {{{ use_ssh_tunnel }}} to {{{ False }}} in the configuration file.
11
12=== modified file 'src/sextant/__main__.py'
13--- src/sextant/__main__.py 2014-09-01 15:05:09 +0000
14+++ src/sextant/__main__.py 2014-09-01 16:06:22 +0000
15@@ -228,6 +228,9 @@
16 help="whether to SSH into the remote server,"
17 "True/False",
18 default=str(config.use_ssh_tunnel))
19+ parsers[key].add_argument('--ssh-user', metavar="NAME", type=str,
20+ help="username to use as remote SSH name",
21+ default=str(config.ssh_user))
22
23 parsers['audit'].set_defaults(func=_audit)
24 parsers['web'].set_defaults(func=_start_web)
25@@ -406,10 +409,13 @@
26 else: # we need to SSH
27 try:
28 _start_tunnel(localport, remotehost, remoteport,
29- ssh_user=config.ssh_user)
30+ ssh_user=args.ssh_user)
31 except OSError as e:
32 logging.error(str(e))
33 return
34+ except KeyboardInterrupt:
35+ logging.info('Halting because of user interrupt.')
36+ return
37
38 try:
39 args.display_neo4j = args.remote_neo4j

Subscribers

People subscribed via source and target branches