diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-01-26 14:51:54 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-01-26 14:51:54 -0500 |
commit | 82634f8920e912a9cf567065a2da4cf20faeccbc (patch) | |
tree | ce4efb686eae3ac2cc1476275ee9b72e885487fc /roles/lib_openshift/library | |
parent | 1e7bd9bf98531d7a6666937df54484641bfe3a15 (diff) | |
download | openshift-82634f8920e912a9cf567065a2da4cf20faeccbc.tar.gz openshift-82634f8920e912a9cf567065a2da4cf20faeccbc.tar.bz2 openshift-82634f8920e912a9cf567065a2da4cf20faeccbc.tar.xz openshift-82634f8920e912a9cf567065a2da4cf20faeccbc.zip |
Fixing linters.
Diffstat (limited to 'roles/lib_openshift/library')
-rw-r--r-- | roles/lib_openshift/library/oadm_manage_node.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/roles/lib_openshift/library/oadm_manage_node.py b/roles/lib_openshift/library/oadm_manage_node.py index 39e6384da..1d2b70885 100644 --- a/roles/lib_openshift/library/oadm_manage_node.py +++ b/roles/lib_openshift/library/oadm_manage_node.py @@ -1285,7 +1285,7 @@ class ManageNode(OpenShiftCLI): _node = {} _node['name'] = node['metadata']['name'] _node['schedulable'] = True - if node['spec'].has_key('unschedulable'): + if 'unschedulable' in node['spec']: _node['schedulable'] = False nodes.append(_node) @@ -1363,9 +1363,9 @@ class ManageNode(OpenShiftCLI): # This is a short circuit based on the way we fetch nodes. # If node is a dict/list then we've already fetched them. for node in nodes: - if isinstance(node, dict) and node.has_key('returncode'): + if isinstance(node, dict) and 'returncode' in node: return {'results': nodes, 'returncode': node['returncode']} - if isinstance(node, list) and node[0].has_key('returncode'): + if isinstance(node, list) and 'returncode' in node[0]: return {'results': nodes, 'returncode': node[0]['returncode']} # check all the nodes that were returned and verify they are: # node['schedulable'] == self.config.config_options['schedulable']['value'] @@ -1382,7 +1382,7 @@ class ManageNode(OpenShiftCLI): # removing header line and trailing new line character of node lines for node_results in results['results'].split('\n')[1:-1]: parts = node_results.split() - nodes.append({'name': parts[0], 'schedulable': 'Ready' == parts[1]}) + nodes.append({'name': parts[0], 'schedulable': parts[1] == 'Ready'}) results['nodes'] = nodes return results @@ -1414,8 +1414,12 @@ class ManageNode(OpenShiftCLI): results = None changed = False if params['schedulable'] != None: + if check_mode: + # schedulable returns results after the fact. + # We need to redo how this works to support check_mode completely. + return {'changed': True, 'msg': 'CHECK_MODE: would have called schedulable.'} results = oadm_mn.schedulable() - if not results.has_key('changed'): + if 'changed' not in results: changed = True if params['evacuate']: |