diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-05-31 09:36:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-31 09:36:30 -0400 |
commit | 15221b6943df7e54ff00db6271ee89eb5cbe0425 (patch) | |
tree | b7b32d862c0b8ed3e037c26271a9f384493e07f8 /roles/lib_openshift/library/oc_route.py | |
parent | 61324060fde1435ff1c819858bb4271352458a68 (diff) | |
parent | a1cfec9bbe43dd005ab16792c90cc949555cce12 (diff) | |
download | openshift-15221b6943df7e54ff00db6271ee89eb5cbe0425.tar.gz openshift-15221b6943df7e54ff00db6271ee89eb5cbe0425.tar.bz2 openshift-15221b6943df7e54ff00db6271ee89eb5cbe0425.tar.xz openshift-15221b6943df7e54ff00db6271ee89eb5cbe0425.zip |
Merge pull request #4091 from richm/oc_service-labels-externalIPs
add support for oc_service for labels, externalIPs
Diffstat (limited to 'roles/lib_openshift/library/oc_route.py')
-rw-r--r-- | roles/lib_openshift/library/oc_route.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/roles/lib_openshift/library/oc_route.py b/roles/lib_openshift/library/oc_route.py index 7831ec8a4..3090b4cad 100644 --- a/roles/lib_openshift/library/oc_route.py +++ b/roles/lib_openshift/library/oc_route.py @@ -1429,7 +1429,6 @@ class Utils(object): # pragma: no cover print('returning true') return True - class OpenShiftCLIConfig(object): '''Generic Config''' def __init__(self, rname, namespace, kubeconfig, options): @@ -1443,18 +1442,28 @@ class OpenShiftCLIConfig(object): ''' return config options ''' return self._options - def to_option_list(self): - '''return all options as a string''' - return self.stringify() - - def stringify(self): - ''' return the options hash as cli params in a string ''' + def to_option_list(self, ascommalist=''): + '''return all options as a string + if ascommalist is set to the name of a key, and + the value of that key is a dict, format the dict + as a list of comma delimited key=value pairs''' + return self.stringify(ascommalist) + + def stringify(self, ascommalist=''): + ''' return the options hash as cli params in a string + if ascommalist is set to the name of a key, and + the value of that key is a dict, format the dict + as a list of comma delimited key=value pairs ''' rval = [] for key in sorted(self.config_options.keys()): data = self.config_options[key] if data['include'] \ and (data['value'] or isinstance(data['value'], int)): - rval.append('--{}={}'.format(key.replace('_', '-'), data['value'])) + if key == ascommalist: + val = ','.join(['{}={}'.format(kk, vv) for kk, vv in sorted(data['value'].items())]) + else: + val = data['value'] + rval.append('--{}={}'.format(key.replace('_', '-'), val)) return rval |