Merge lp:~jjo/juju-deployer/diff-fixes-for-services-without-units-and-single-valued-cfg-tags into lp:juju-deployer

Proposed by JuanJo Ciarlante
Status: Merged
Merged at revision: 131
Proposed branch: lp:~jjo/juju-deployer/diff-fixes-for-services-without-units-and-single-valued-cfg-tags
Merge into: lp:juju-deployer
Diff against target: 23 lines (+5/-1)
1 file modified
deployer/action/diff.py (+5/-1)
To merge this branch: bzr merge lp:~jjo/juju-deployer/diff-fixes-for-services-without-units-and-single-valued-cfg-tags
Reviewer Review Type Date Requested Status
juju-deployers Pending
Review via email: mp+239238@code.launchpad.net

Commit message

[jjo] diff fixes: avoid crashing if environment has services without units deployed, convert tags from cfg to list if needed

To post a comment you must log in.
Revision history for this message
JuanJo Ciarlante (jjo) wrote :

$ make test
Ran 99 tests in 64.477s

OK (SKIP=1)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'deployer/action/diff.py'
--- deployer/action/diff.py 2013-11-29 21:55:56 +0000
+++ deployer/action/diff.py 2014-10-22 16:51:05 +0000
@@ -30,7 +30,7 @@
30 'constraints'] = self.env.get_constraints(svc_name)30 'constraints'] = self.env.get_constraints(svc_name)
31 self.env_state['services'][svc_name][31 self.env_state['services'][svc_name][
32 'unit_count'] = len(self.env_status[32 'unit_count'] = len(self.env_status[
33 'services'][svc_name]['units'])33 'services'][svc_name].get('units',{}))
34 rels.update(self._load_rels(svc_name))34 rels.update(self._load_rels(svc_name))
35 self.env_state['relations'] = sorted(rels)35 self.env_state['relations'] = sorted(rels)
3636
@@ -123,6 +123,10 @@
123 def _diff_service(self, e_s, d_s, charm):123 def _diff_service(self, e_s, d_s, charm):
124 mod = {}124 mod = {}
125 d_sc = parse_constraints(d_s.get('constraints',''))125 d_sc = parse_constraints(d_s.get('constraints',''))
126 # 'tags' is a special case, as it can be multi-valued: convert to list
127 # if cfg one is a string
128 if type(d_sc.get('tag')) == str:
129 d_sc['tags'] = [d_sc['tags']]
126 if d_sc != e_s['constraints']:130 if d_sc != e_s['constraints']:
127 mod['env-constraints'] = e_s['constraints']131 mod['env-constraints'] = e_s['constraints']
128 mod['cfg-constraints'] = d_sc132 mod['cfg-constraints'] = d_sc

Subscribers

People subscribed via source and target branches