Merge lp://staging/~hazmat/pyjuju/deploy-invalid-conf into lp://staging/pyjuju
Proposed by
Kapil Thangavelu
Status: | Merged |
---|---|
Approved by: | Jim Baker |
Approved revision: | 448 |
Merged at revision: | 455 |
Proposed branch: | lp://staging/~hazmat/pyjuju/deploy-invalid-conf |
Merge into: | lp://staging/pyjuju |
Diff against target: |
82 lines (+28/-8) 2 files modified
juju/control/deploy.py (+9/-7) juju/control/tests/test_deploy.py (+19/-1) |
To merge this branch: | bzr merge lp://staging/~hazmat/pyjuju/deploy-invalid-conf |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jim Baker (community) | Approve | ||
Review via email: mp+90321@code.staging.launchpad.net |
Description of the change
Validate config options before deploying.
It was previously possible to deploy a service with an invalid config, which
would result in a service with no units active in the environment. With the
change on invalid config with deploy, no service will be created in the
environment.
To post a comment you must log in.
Reviewers: mp+90321_ code.launchpad. net,
Message:
Please take a look.
Description:
It was previously possible to deploy a service with an invalid config,
which
would result in a service with no units active in the environment. With
the
change on invalid config with deploy, no service will be created in the
environment.
https:/ /code.launchpad .net/~hazmat/ juju/deploy- invalid- conf/+merge/ 90321
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/5572068/
Affected files: deploy. py tests/test_ deploy. py
M juju/control/
M juju/control/
Index: juju/control/ deploy. py deploy. py' deploy. py 2011-12-07 02:26:56 +0000 deploy. py 2012-01-26 19:39:06 +0000
num_ units=options. num_units)
=== <email address hidden> >
<email address hidden>
=== modified file 'juju/control/
--- juju/control/
+++ juju/control/
@@ -65,7 +65,7 @@
-def parse_config_ options( config_ file, service_name): options( config_ file, service_name, charm): exists( config_ file) or \ config_ file, os.R_OK): lueError( lueError(
"Invalid options file passed to --config.\n"
"Expected a YAML dict with service name (%r)." % service_name) service_ name] validate( options[ service_ name])
+def parse_config_
if not os.path.
not os.access(
raise ServiceConfigVa
@@ -77,8 +77,9 @@
raise ServiceConfigVa
- # remove the service name prefix for application to state
- return options[
+
+ # Validate and type service options and return
+ return charm.config.
@inlineCallbacks
charm_ name, repository_path, environment. default_ series)
@@ -93,14 +94,15 @@
repo, charm_url = resolve(
+ charm = yield repo.find( charm_url) url.with_ revision( charm.get_ revision( ))) options = {} options( config_ file, service_name) charm_url) url.with_ revision( charm.get_ revision( ))) options(
+ charm_id = str(charm_
+
# Validate config options prior to deployment attempt
service_
service_name = service_name or charm_url.name
if config_file:
- service_options = parse_config_
-
- charm = yield repo.find(
- charm_id = str(charm_
+ service_options = parse_config_
+ config_file, service_name, charm)
provider = environment. get_machine_ provider( ) _policy = provider. get_placement_ policy( )
placement
Index: juju/control/ tests/test_ deploy. py tests/test_ deploy. py' tests/test_ deploy. py 2011-11-29 20:49:04 +0000 tests/test_ deploy. py 2012-01-26 19:39:06 +0000 t.config import EnvironmentsConfig lueError environment import EnvironmentStat eManager eInUse eInUse, ServiceStateNot Found
=== <email address hidden> >
<email address hidden>
=== modified file 'juju/control/
--- juju/control/
+++ juju/control/
@@ -8,7 +8,7 @@
from juju.environmen
from juju.charm.errors import ServiceConfigVa
from juju.state.
-from juju.state.errors import ServiceStateNam
+from juju.state.errors import ServiceStateNam
from juju.state.service import ServiceStateManager
from juju.state.relation import RelationSta...