diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-01-26 12:00:36 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-01-26 14:20:19 -0500 |
commit | 853170d0e42ef23b8986e7b1a266232709f5b6f9 (patch) | |
tree | 86ea3d30326307cc0c33dfd69e5c7195787a3574 /roles/lib_openshift/src/class | |
parent | 0db4215a5570b550251af614e8e944b9f2db7094 (diff) | |
download | openshift-853170d0e42ef23b8986e7b1a266232709f5b6f9.tar.gz openshift-853170d0e42ef23b8986e7b1a266232709f5b6f9.tar.bz2 openshift-853170d0e42ef23b8986e7b1a266232709f5b6f9.tar.xz openshift-853170d0e42ef23b8986e7b1a266232709f5b6f9.zip |
Added unit integration tests. Enhanced unit tests. Fixed an issue in openshift_cmd for namespace.
Diffstat (limited to 'roles/lib_openshift/src/class')
-rw-r--r-- | roles/lib_openshift/src/class/oadm_manage_node.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/roles/lib_openshift/src/class/oadm_manage_node.py b/roles/lib_openshift/src/class/oadm_manage_node.py index bf750d83f..948e3f1ef 100644 --- a/roles/lib_openshift/src/class/oadm_manage_node.py +++ b/roles/lib_openshift/src/class/oadm_manage_node.py @@ -131,9 +131,11 @@ class ManageNode(OpenShiftCLI): if isinstance(tmp_result, dict): tmp_nodes.append(tmp_result) continue - tmp_nodes.extend(self.get_nodes(name)) + tmp_nodes.extend(tmp_result) nodes = tmp_nodes + # 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'): return {'results': nodes, 'returncode': node['returncode']} @@ -143,10 +145,21 @@ class ManageNode(OpenShiftCLI): # node['schedulable'] == self.config.config_options['schedulable']['value'] if any([node['schedulable'] != self.config.config_options['schedulable']['value'] for node in nodes]): - return self._schedulable(node=self.config.config_options['node']['value'], - selector=self.config.config_options['selector']['value'], - schedulable=self.config.config_options['schedulable']['value'], - ) + results = self._schedulable(node=self.config.config_options['node']['value'], + selector=self.config.config_options['selector']['value'], + schedulable=self.config.config_options['schedulable']['value']) + + # 'NAME STATUS AGE\\nip-172-31-49-140.ec2.internal Ready 4h\\n' # E501 + # normalize formatting with previous return objects + if results['results'].startswith('NAME'): + nodes = [] + # 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]}) + results['nodes'] = nodes + + return results results = {} results['returncode'] = 0 |