Merge lp:~makyo/juju-quickstart/ensure-juju-lxc into lp:juju-quickstart
Proposed by
Madison Scott-Clary
Status: | Merged |
---|---|
Merged at revision: | 19 |
Proposed branch: | lp:~makyo/juju-quickstart/ensure-juju-lxc |
Merge into: | lp:juju-quickstart |
Diff against target: |
126 lines (+94/-0) 3 files modified
quickstart/app.py (+30/-0) quickstart/manage.py (+2/-0) quickstart/tests/test_app.py (+62/-0) |
To merge this branch: | bzr merge lp:~makyo/juju-quickstart/ensure-juju-lxc |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+196011@code.launchpad.net |
Description of the change
Ensure juju and lxc are installed
To test: make check
To QA:
- Create an lxc or vm without juju installed
- Clone this branch
- Run `make sysdeps`
- Run `make run`
It should install juju, lxc, and dependencies, then prompt you to run again after initializing your juju environments.
To post a comment you must log in.
Reviewers: mp+196011_ code.launchpad. net,
Message:
Please take a look.
Description:
Ensure juju and lxc are installed
To test: make check
To QA:
- Create an lxc or vm without juju installed
- Clone this branch
- Run `make sysdeps`
- Run `make run`
It should install juju, lxc, and dependencies, then prompt you to run
again after initializing your juju environments.
https:/ /code.launchpad .net/~makyo/ juju-quickstart /ensure- juju-lxc/ +merge/ 196011
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/29980043/
Affected files (+96, -1 lines): manage. py tests/helpers. py tests/test_ app.py
A [revision details]
M quickstart/app.py
M quickstart/
M quickstart/
M quickstart/
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 self.message)
=== modified file 'quickstart/app.py'
--- quickstart/app.py 2013-11-20 11:35:30 +0000
+++ quickstart/app.py 2013-11-20 20:36:24 +0000
@@ -45,6 +45,35 @@
return 'juju-quickstart: error: {}'.format(
+def ensure_ dependencies( ): 'lxc-ls' )[0] repository' , '-y', 'ppa:juju/stable'],
+ """Ensure that Juju and LXC are installed.
+
+ If juju is not found in the PATH, then add the juju stable PPA and
install
+ both juju and lxc.
+
+ Return when juju is available.
+ Raise a ProgramExit if an error occurs installing.
+ """
+ retcode = utils.call('juju', 'version')[0]
+ retcode += utils.call(
+ if retcode > 0:
+ cmds = [
+ ['apt-add-
+ ['apt-get', 'update'],
+ ['apt-get', 'install', '-y', 'juju-core', 'lxc']
+ ]
+ for cmd in cmds:
+ cmd.insert(0, 'sudo')
+ retcode, _, error = utils.call(*cmd)
+ if retcode:
+ raise ProgramExit(error)
+ # XXX Makyo #1247214:
+ # Here, we should guide the user through cloud credentials and
+ # juju init.
+ raise ProgramExit('Juju is now installed; please run the same
juju '
+ 'quickstart command again to proceed.')
+
+
def bootstrap(env_name, is_local=False, debug=False):
"""Bootstrap the Juju environment with the given name.
Index: quickstart/ manage. py manage. py' manage. py 2013-11-20 11:35:30 +0000 manage. py 2013-11-20 20:30:08 +0000 version) ) dependencies( ) 'bootstrapping the {} environment (type: {})'.format(
options. env_name, options.env_type))
=== modified file 'quickstart/
--- quickstart/
+++ quickstart/
@@ -218,6 +218,8 @@
def run(options):
"""Run the application."""
print('juju quickstart v{}'.format(
+ print('ensuring juju and lxc are installed')
+ app.ensure_
print(
is_local = options.env_type == 'local'
Index: quickstart/ tests/helpers. py tests/helpers. py' tests/helpers. py 2013-11-18 11:42:15 +0000 tests/helpers. py 201...
=== modified file 'quickstart/
--- quickstart/
+++ quickstart/