diff --git a/cloudpulse/operator/ansible/openstack_node.py b/cloudpulse/operator/ansible/openstack_node.py index f0f4076..cb64613 100644 --- a/cloudpulse/operator/ansible/openstack_node.py +++ b/cloudpulse/operator/ansible/openstack_node.py @@ -1,42 +1,38 @@ -# Copyright 2010-2011 OpenStack Foundation -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -class openstack_node_obj(object): - def __init__(self, host, ip, user, password, role, name): - self.host = host - self.ip = ip - self.user = user - self.password = password - self.role = role - self.name = name - - def getHost(self): - return self.host - - def getIp(self): - return self.ip - - def getUser(self): - return self.user - - def getPassword(self): - return self.password - - def getRole(self): - return self.role - - def getName(self): - return self.name +# Copyright 2010-2011 OpenStack Foundation +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +class openstack_node_obj(object): + def __init__(self, host, ip, user, role, name): + self.host = host + self.ip = ip + self.user = user + self.role = role + self.name = name + + def getHost(self): + return self.host + + def getIp(self): + return self.ip + + def getUser(self): + return self.user + + def getRole(self): + return self.role + + def getName(self): + return self.name diff --git a/cloudpulse/operator/ansible/openstack_node_info_reader.py b/cloudpulse/operator/ansible/openstack_node_info_reader.py index 85bc09f..f6055ab 100644 --- a/cloudpulse/operator/ansible/openstack_node_info_reader.py +++ b/cloudpulse/operator/ansible/openstack_node_info_reader.py @@ -40,10 +40,9 @@ class openstack_node_info_reader(object): ip = self.hostYamlObj[key]["ip"] hostname = key username = self.hostYamlObj[key]["user"] - password = self.hostYamlObj[key]["password"] role = self.hostYamlObj[key]["role"] node_obj = openstack_node_obj(hostname, ip, username, - password, role, name) + role, name) openstack_host_list.append(node_obj) return openstack_host_list diff --git a/cloudpulse/scenario/plugins/operator_tests/operator.py b/cloudpulse/scenario/plugins/operator_tests/operator.py index 77ae55a..f7bb3ba 100644 --- a/cloudpulse/scenario/plugins/operator_tests/operator.py +++ b/cloudpulse/scenario/plugins/operator_tests/operator.py @@ -79,13 +79,13 @@ class operator_scenario(base.Scenario): out = self.ans_runner.execute(cmd) res, output = self.ans_runner.validate_results(out) - node_status = res['contacted'][res['contacted'].keys()[0]]['stdout'] - node_status_string = node_status.replace('\n', '') - mathobj = re.search( - r'running_nodes,(.*?)}', node_status_string, re.M | re.I) - nodes = mathobj.group(1) - if res['status'] is 'PASS': + node_status = res['contacted'][ + res['contacted'].keys()[0]]['stdout'] + node_status_string = node_status.replace('\n', '') + mathobj = re.search( + r'running_nodes,(.*?)}', node_status_string, re.M | re.I) + nodes = mathobj.group(1) return (200, "Active Nodes : %s" % nodes, ['RabbitMQ-server Running']) else: @@ -97,8 +97,9 @@ class operator_scenario(base.Scenario): self.load() galera = self.os_node_info_obj.get_galera_details() - cmd = (r"mysql -u %s -e 'SHOW STATUS;'|grep wsrep_incoming_addresses" % - (galera['username'])) + cmd = ((r"mysql -u %s -p%s -e 'SHOW STATUS;'|grep " + "wsrep_incoming_addresses") % + (galera['username'], galera['password'])) is_containerized = cfg.CONF.operator_test.containerized if is_containerized: @@ -108,14 +109,13 @@ class operator_scenario(base.Scenario): out = self.ans_runner.execute(cmd) results, failed_hosts = self.ans_runner.validate_results(out) - galera_status = results['contacted'][ - results['contacted'].keys()[0]]['stdout'] - galera_status_string = galera_status.replace('\n', '') - mathobj = re.search(r'wsrep_incoming_addresses\s+(.*?)$', - galera_status_string, re.M | re.I) - nodes = mathobj.group(1) - if results['status'] is 'PASS': + galera_status = results['contacted'][ + results['contacted'].keys()[0]]['stdout'] + galera_status_string = galera_status.replace('\n', '') + mathobj = re.search(r'wsrep_incoming_addresses\s+(.*?)$', + galera_status_string, re.M | re.I) + nodes = mathobj.group(1) return (200, "Active Nodes : %s" % nodes, ['Galera Cluster Test Passed']) else: