Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jjo/18b48de406d298ed5b60 to your computer and use it in GitHub Desktop.
Save jjo/18b48de406d298ed5b60 to your computer and use it in GitHub Desktop.
juju-deployer/diff-fixes-for-services-without-units-and-single-valued-cfg-tags
=== 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 @@
'constraints'] = self.env.get_constraints(svc_name)
self.env_state['services'][svc_name][
'unit_count'] = len(self.env_status[
- 'services'][svc_name]['units'])
+ 'services'][svc_name].get('units',{}))
rels.update(self._load_rels(svc_name))
self.env_state['relations'] = sorted(rels)
@@ -123,6 +123,10 @@
def _diff_service(self, e_s, d_s, charm):
mod = {}
d_sc = parse_constraints(d_s.get('constraints',''))
+ # 'tags' is a special case, as it can be multi-valued: convert to list
+ # if cfg one is a string
+ if type(d_sc.get('tags')) == str:
+ d_sc['tags'] = [d_sc['tags']]
if d_sc != e_s['constraints']:
mod['env-constraints'] = e_s['constraints']
mod['cfg-constraints'] = d_sc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment