summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-04-11 16:43:05 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-04-20 15:10:51 -0300
commitb0e43e87b132594bc370419085000b6d6c54cdc6 (patch)
tree1f7e1238e4ef544e579d3774a0a8ac6bee41a6db /roles
parent895a55c23fb7ae202ed3d6b4660f5e37410b05f2 (diff)
downloadopenshift-b0e43e87b132594bc370419085000b6d6c54cdc6.tar.gz
openshift-b0e43e87b132594bc370419085000b6d6c54cdc6.tar.bz2
openshift-b0e43e87b132594bc370419085000b6d6c54cdc6.tar.xz
openshift-b0e43e87b132594bc370419085000b6d6c54cdc6.zip
Use a JSON list for docker log options.
Previously we expected you to comma separate, but this wasn't really clear. Insted we will use an explicit JSON list going forward. The comma separated list will be supported for backwards compatability.
Diffstat (limited to 'roles')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index f2d17293a..fe5fdd246 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -56,6 +56,13 @@ def migrate_docker_facts(facts):
if 'node' in facts and 'portal_net' in facts['node']:
facts['docker']['hosted_registry_insecure'] = True
facts['docker']['hosted_registry_network'] = facts['node'].pop('portal_net')
+
+ # log_options was originally meant to be a comma separated string, but
+ # we now prefer an actual list, with backward compatability:
+ if 'log_options' in facts['docker'] and \
+ isinstance(facts['docker']['log_options'], basestring):
+ facts['docker']['log_options'] = facts['docker']['log_options'].split(",")
+
return facts
# TODO: We should add a generic migration function that takes source and destination
@@ -1852,6 +1859,10 @@ class OpenShiftFacts(object):
if isinstance(val, basestring):
val = [x.strip() for x in val.split(',')]
new_local_facts['docker'][key] = list(set(val) - set(['']))
+ # Convert legacy log_options comma sep string to a list if present:
+ if 'log_options' in new_local_facts['docker'] and \
+ isinstance(new_local_facts['docker']['log_options'], basestring):
+ new_local_facts['docker']['log_options'] = new_local_facts['docker']['log_options'].split(',')
new_local_facts = self.remove_empty_facts(new_local_facts)
@@ -1875,7 +1886,7 @@ class OpenShiftFacts(object):
if isinstance(facts[fact], dict):
facts[fact] = self.remove_empty_facts(facts[fact])
else:
- if value == "" or value is None:
+ if value == "" or value == [""] or value is None:
facts_to_remove.append(fact)
for fact in facts_to_remove:
del facts[fact]