diff options
author | Russell Teague <rteague@redhat.com> | 2017-01-24 14:41:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 14:41:17 -0500 |
commit | 0880fba00d52398529ddc4a5f9e218a0a5994c42 (patch) | |
tree | 86dff75950e28a85c5e731503ea129add4308938 /roles | |
parent | 0516c051463951379399135c24093175f4127c94 (diff) | |
parent | 43c80102ecfebf1b5afcb0e7cf2bf25c4289d7f9 (diff) | |
download | openshift-0880fba00d52398529ddc4a5f9e218a0a5994c42.tar.gz openshift-0880fba00d52398529ddc4a5f9e218a0a5994c42.tar.bz2 openshift-0880fba00d52398529ddc4a5f9e218a0a5994c42.tar.xz openshift-0880fba00d52398529ddc4a5f9e218a0a5994c42.zip |
Merge pull request #3166 from abutcher/pylint
[openshift_facts] pylint cleanse
Diffstat (limited to 'roles')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 599793ae9..c99452062 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -1697,12 +1697,29 @@ def set_builddefaults_facts(facts): def delete_empty_keys(keylist): - count=0 - c=len(keylist) - for i in range(0,c): - if len(keylist[i-count]['value'])==0: - del keylist[i-count] - count+=1 + """ Delete dictionary elements from keylist where "value" is empty. + + Args: + keylist(list): A list of builddefault configuration envs. + + Returns: + none + + Example: + keylist = [{'name': 'HTTP_PROXY', 'value': 'http://file.rdu.redhat.com:3128'}, + {'name': 'HTTPS_PROXY', 'value': 'http://file.rdu.redhat.com:3128'}, + {'name': 'NO_PROXY', 'value': ''}] + + After calling delete_empty_keys the provided list is modified to become: + + [{'name': 'HTTP_PROXY', 'value': 'http://file.rdu.redhat.com:3128'}, + {'name': 'HTTPS_PROXY', 'value': 'http://file.rdu.redhat.com:3128'}] + """ + count = 0 + for i in range(0, len(keylist)): + if len(keylist[i - count]['value']) == 0: + del keylist[i - count] + count += 1 def set_buildoverrides_facts(facts): |