Merge lp:~bac/juju-quickstart/local-error-osx into lp:juju-quickstart
Proposed by
Brad Crittenden
Status: | Merged |
---|---|
Merged at revision: | 75 |
Proposed branch: | lp:~bac/juju-quickstart/local-error-osx |
Merge into: | lp:juju-quickstart |
Diff against target: |
76 lines (+29/-3) 2 files modified
quickstart/manage.py (+7/-1) quickstart/tests/test_manage.py (+22/-2) |
To merge this branch: | bzr merge lp:~bac/juju-quickstart/local-error-osx |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+222562@code.launchpad.net |
Description of the change
Error if local env requested but not supported.
If '-e some-local-
then bootstrap will be called and an obscure 'apt-config' error is thrown.
So, let's not do that. Instead, detect the error early and return an argparse
error that makes sense.
To post a comment you must log in.
Reviewers: mp+222562_ code.launchpad. net,
Message:
Please take a look.
Description:
Error if local env requested but not supported.
If '-e some-local- environment' is used on a host that does not support
LXC,
then bootstrap will be called and an obscure 'apt-config' error is
thrown.
So, let's not do that. Instead, detect the error early and return an
argparse
error that makes sense.
https:/ /code.launchpad .net/~bac/ juju-quickstart /local- error-osx/ +merge/ 222562
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/104940045/
Affected files (+31, -3 lines): manage. py tests/test_ manage. py
A [revision details]
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/ manage. py manage. py' manage. py 2014-06-02 12:56:24 +0000 manage. py 2014-06-09 19:21:43 +0000 env_data( parser, env_type_db, env_db, support. supports_ local(options. platform) admin_secret = env_data. get('admin- secret' ) env_file = env_file env_name = env_data['name'] default_ series = env_data. get('default- series' ) interactive = interactive
=== modified file 'quickstart/
--- quickstart/
+++ quickstart/
@@ -285,11 +285,17 @@
# This is a non-interactive session and we need to validate the
# selected environment before proceeding.
env_data = _retrieve_
env_name)
+ # Check for local support, if requested.
+ options.env_type = env_data['type']
+ no_local_support = not
platform_
+ if options.env_type == 'local' and no_local_support:
+ return parser.error(
+ 'This host platform does not support local environments.'
+ )
# Update the options namespace with the new values.
options.
options.
options.
- options.env_type = env_data['type']
options.
options.
Index: quickstart/ tests/test_ manage. py tests/test_ manage. py' tests/test_ manage. py 2014-06-02 12:56:24 +0000 tests/test_ manage. py 2014-06-09 19:21:43 +0000
self. parser = mock.Mock()
=== modified file 'quickstart/
--- quickstart/
+++ quickstart/
@@ -462,12 +462,14 @@
def setUp(self):
- def make_options(self, env_file, env_name=None, interactive=False): settings. LINUX_APT) :
env_file= env_file,
env_name= env_name,
interactive= interactive,
+ def make_options(self, env_file, env_name=None, interactive=False,
+ platform=
"""Return a mock options object which includes the passed
arguments."""
return mock.Mock(
+ platform=platform,
)
def patch_interacti ve_mode( self, return_value): error.call_ args[0] [0]
self. assertIn( 'unable to find an environment name to use', message)
@@ -516,7 +518,7 @@
message = self.parser.
- def test_local_ provider( self): provider_ linux(self) :
+ def test_local_
# Local environments are correctly handled.
...