Merge lp://staging/~bac/juju-quickstart/ssh-agent into lp://staging/juju-quickstart
Proposed by
Brad Crittenden
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Brad Crittenden | ||||
Approved revision: | 54 | ||||
Merged at revision: | 53 | ||||
Proposed branch: | lp://staging/~bac/juju-quickstart/ssh-agent | ||||
Merge into: | lp://staging/juju-quickstart | ||||
Diff against target: |
220 lines (+64/-30) 3 files modified
Makefile (+4/-0) quickstart/app.py (+7/-0) quickstart/tests/test_app.py (+53/-30) |
||||
To merge this branch: | bzr merge lp://staging/~bac/juju-quickstart/ssh-agent | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Madison Scott-Clary (community) | Approve | ||
Review via email: mp+204348@code.staging.launchpad.net |
Description of the change
Don't start a new ssh-agent unless needed.
If quickstart creates its own ssh-agent it renders a previously running one
unusable. Keys that were already added must be added again. And, when the
quikstart process dies, the environment variables it had set up as required by
ssh-agent are not available to the parent shell, so that agent effectively
becomes a zombie.
Instead, check for the existence of a running agent before spinning up a new
one. If none exists, then launch a new one and then check again to ensure it
is running.
To post a comment you must log in.
Reviewers: mp+204348_ code.launchpad. net,
Message:
Please take a look.
Description:
Don't start a new ssh-agent unless needed.
If quickstart creates its own ssh-agent it renders a previously running
one
unusable. Keys that were already added must be added again. And, when
the
quikstart process dies, the environment variables it had set up as
required by
ssh-agent are not available to the parent shell, so that agent
effectively
becomes a zombie.
Instead, check for the existence of a running agent before spinning up a
new
one. If none exists, then launch a new one and then check again to
ensure it
is running.
https:/ /code.launchpad .net/~bac/ juju-quickstart /ssh-agent/ +merge/ 204348
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/53740045/
Affected files (+46, -15 lines): tests/test_ app.py
M Makefile
A [revision details]
M quickstart/app.py
M quickstart/
Index: Makefile
=== modified file 'Makefile'
--- Makefile 2014-01-31 18:09:48 +0000
+++ Makefile 2014-01-31 21:00:06 +0000
@@ -54,6 +54,7 @@
@echo ' environment will be used. It is possible to override the default'
@echo ' Juju environment by setting the JUJU_ENV environment variable,'
@echo ' e.g.: "make run JUJU_ENV=ec2".'
+ @echo 'make debug - Same as the "run" target but with the --debug flag.\n'
@echo 'make clean - Get rid of bytecode files, build and dist dirs, venv.'
@echo 'make release - Register and upload a release on PyPI.'
@@ -68,6 +69,9 @@
$(PYTHON) setup.py register sdist upload
run: setup /bin/python ./juju-quickstart --debug
+ $(VENV)/bin/python ./juju-quickstart
+
+debug: setup
$(VENV)
source:
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: quickstart/app.py
utils. start_ssh_ agent() bytes(err) )
=== modified file 'quickstart/app.py'
--- quickstart/app.py 2014-01-31 16:35:01 +0000
+++ quickstart/app.py 2014-01-31 21:00:06 +0000
@@ -96,11 +96,18 @@
Allow the user to let quickstart create SSH keys, or quit by raising a
ProgramExit if they would like to create the key themselves.
"""
+ # Test to see if we have ssh-keys loaded into the ssh-agent, or if we
can
+ # add them to the currently running ssh-agent.
+ if check_ssh_keys():
+ return
+
+ # No responsive agent was found. Start one up.
try:
except OSError as err:
raise ProgramExit(
+ # And now check again.
print( 'Warning: No SSH keys were found in ~/.ssh\n\n'
if not check_ssh_keys():
'To proceed and generate keys, quickstart can\n\n'
Index: quickstart/ tests/test_ app.py tests/test_ app.py' tests/test_ app.py 2014-01-31 16:35:01 +0000 tests/test_ app.py 2014-01-31 21:00:06 +0000
'quickstart: \n\n ssh-keygen -b 4096 -t rsa'
=== modified file 'quickstart/
--- quickstart/
+++ quickstart/
@@ -192,23 +192,41 @@
def patch_check_ ssh_keys( self,.. .