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
1=== modified file 'deployer/action/diff.py'
2--- deployer/action/diff.py 2013-11-29 21:55:56 +0000
3+++ deployer/action/diff.py 2014-10-22 16:51:05 +0000
4@@ -30,7 +30,7 @@
5 'constraints'] = self.env.get_constraints(svc_name)
6 self.env_state['services'][svc_name][
7 'unit_count'] = len(self.env_status[
8- 'services'][svc_name]['units'])
9+ 'services'][svc_name].get('units',{}))
10 rels.update(self._load_rels(svc_name))
11 self.env_state['relations'] = sorted(rels)
12
13@@ -123,6 +123,10 @@
14 def _diff_service(self, e_s, d_s, charm):
15 mod = {}
16 d_sc = parse_constraints(d_s.get('constraints',''))
17+ # 'tags' is a special case, as it can be multi-valued: convert to list
18+ # if cfg one is a string
19+ if type(d_sc.get('tag')) == str:
20+ d_sc['tags'] = [d_sc['tags']]
21 if d_sc != e_s['constraints']:
22 mod['env-constraints'] = e_s['constraints']
23 mod['cfg-constraints'] = d_sc

Subscribers

People subscribed via source and target branches