diff options
author | Andrew Butcher <abutcher@redhat.com> | 2017-01-24 13:26:59 -0500 |
---|---|---|
committer | Andrew Butcher <abutcher@redhat.com> | 2017-01-24 13:53:02 -0500 |
commit | 43c80102ecfebf1b5afcb0e7cf2bf25c4289d7f9 (patch) | |
tree | cf75f8a2842109da94ee89d7341f8ebb2d1a0ecd /roles/openshift_facts | |
parent | 46532d49f6960f437458dcd02d2cd8e9459f98a3 (diff) | |
download | openshift-43c80102ecfebf1b5afcb0e7cf2bf25c4289d7f9.tar.gz openshift-43c80102ecfebf1b5afcb0e7cf2bf25c4289d7f9.tar.bz2 openshift-43c80102ecfebf1b5afcb0e7cf2bf25c4289d7f9.tar.xz openshift-43c80102ecfebf1b5afcb0e7cf2bf25c4289d7f9.zip |
Clean up pylint for delete_empty_keys.
Diffstat (limited to 'roles/openshift_facts')
-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): |