Pylint: fix trivial issues 9
fix: undefined-loop-variable - at some places it's fake fail, at 2 places was a real problem Related-bug: #1556791 Change-Id: I321d82cac0a3c031c43fd9e1bcbf9bfaab3b1164
This commit is contained in:
parent
c058667639
commit
ee4eaaaf10
|
@ -810,6 +810,7 @@ def check_oswl_stat(postgres_actions, nailgun_actions,
|
||||||
q = "select resource_data from oswl_stats where" \
|
q = "select resource_data from oswl_stats where" \
|
||||||
" resource_type = '\"'\"'{0}'\"'\"';".format(resource)
|
" resource_type = '\"'\"'{0}'\"'\"';".format(resource)
|
||||||
|
|
||||||
|
# pylint: disable=undefined-loop-variable
|
||||||
def get_resource():
|
def get_resource():
|
||||||
result = postgres_actions.run_query('nailgun', q)
|
result = postgres_actions.run_query('nailgun', q)
|
||||||
logger.debug("resource state is {}".format(result))
|
logger.debug("resource state is {}".format(result))
|
||||||
|
@ -818,6 +819,7 @@ def check_oswl_stat(postgres_actions, nailgun_actions,
|
||||||
return (
|
return (
|
||||||
len(json.loads(result)[operation]) >
|
len(json.loads(result)[operation]) >
|
||||||
expected_resource_count[operation][resource])
|
expected_resource_count[operation][resource])
|
||||||
|
# pylint: enable=undefined-loop-variable
|
||||||
|
|
||||||
wait(get_resource, timeout=10,
|
wait(get_resource, timeout=10,
|
||||||
timeout_msg="resource {} wasn't updated in db".format(resource))
|
timeout_msg="resource {} wasn't updated in db".format(resource))
|
||||||
|
|
|
@ -776,8 +776,10 @@ class TestMultipleClusterNets(TestBasic):
|
||||||
'in error state..')
|
'in error state..')
|
||||||
for slave in custom_nodes:
|
for slave in custom_nodes:
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=undefined-loop-variable
|
||||||
wait(lambda: self.fuel_web.get_nailgun_node_by_devops_node(
|
wait(lambda: self.fuel_web.get_nailgun_node_by_devops_node(
|
||||||
slave)['status'] == 'error', timeout=60 * 5)
|
slave)['status'] == 'error', timeout=60 * 5)
|
||||||
|
# pylint: enable=undefined-loop-variable
|
||||||
logger.info('Node {} is in "error" state'.format(slave.name))
|
logger.info('Node {} is in "error" state'.format(slave.name))
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
raise TimeoutError('Node {} status wasn\'t changed '
|
raise TimeoutError('Node {} status wasn\'t changed '
|
||||||
|
|
|
@ -1259,10 +1259,12 @@ class VcenterDeploy(TestBasic):
|
||||||
"Current state of Vm {0} is {1}".format(
|
"Current state of Vm {0} is {1}".format(
|
||||||
srv.name, os_conn.get_instance_detail(srv).status))
|
srv.name, os_conn.get_instance_detail(srv).status))
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=undefined-loop-variable
|
||||||
wait(
|
wait(
|
||||||
lambda:
|
lambda:
|
||||||
os_conn.get_instance_detail(srv).status == "ACTIVE",
|
os_conn.get_instance_detail(srv).status == "ACTIVE",
|
||||||
timeout=60 * 60)
|
timeout=60 * 60)
|
||||||
|
# pylint: enable=undefined-loop-variable
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Current state of Vm {0} is {1}".format(
|
"Current state of Vm {0} is {1}".format(
|
||||||
|
@ -1376,10 +1378,12 @@ class VcenterDeploy(TestBasic):
|
||||||
"Current state of Vm {0} is {1}".format(
|
"Current state of Vm {0} is {1}".format(
|
||||||
srv.name, os_conn.get_instance_detail(srv).status))
|
srv.name, os_conn.get_instance_detail(srv).status))
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=undefined-loop-variable
|
||||||
wait(
|
wait(
|
||||||
lambda:
|
lambda:
|
||||||
os_conn.get_instance_detail(srv).status == "ACTIVE",
|
os_conn.get_instance_detail(srv).status == "ACTIVE",
|
||||||
timeout=60 * 60)
|
timeout=60 * 60)
|
||||||
|
# pylint: enable=undefined-loop-variable
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Current state of Vm {0} is {1}".format(
|
"Current state of Vm {0} is {1}".format(
|
||||||
|
|
|
@ -257,8 +257,9 @@ class TestHaFailoverBase(TestBasic):
|
||||||
logger.debug("Current controller nodes are {0}".format(
|
logger.debug("Current controller nodes are {0}".format(
|
||||||
[i.name for i in devops_controllers]))
|
[i.name for i in devops_controllers]))
|
||||||
|
|
||||||
|
checks_number = 10
|
||||||
for resource in resources:
|
for resource in resources:
|
||||||
for check_counter in xrange(1, 11):
|
for check_counter in xrange(1, checks_number + 1):
|
||||||
# 1. Locate where resource is running
|
# 1. Locate where resource is running
|
||||||
active_nodes = self.fuel_web.get_pacemaker_resource_location(
|
active_nodes = self.fuel_web.get_pacemaker_resource_location(
|
||||||
devops_controllers[0].name,
|
devops_controllers[0].name,
|
||||||
|
@ -327,8 +328,8 @@ class TestHaFailoverBase(TestBasic):
|
||||||
"restored on {1}".format(
|
"restored on {1}".format(
|
||||||
active_nodes[0].name,
|
active_nodes[0].name,
|
||||||
new_nodes[0].name))
|
new_nodes[0].name))
|
||||||
logger.info("Resource {0} restored "
|
logger.info("Resource {0} restored {1} times".format(
|
||||||
"{1} times".format(resource, check_counter))
|
resource, checks_number))
|
||||||
|
|
||||||
# Assert ha services are ready
|
# Assert ha services are ready
|
||||||
self.fuel_web.assert_ha_services_ready(cluster_id)
|
self.fuel_web.assert_ha_services_ready(cluster_id)
|
||||||
|
@ -622,7 +623,7 @@ class TestHaFailoverBase(TestBasic):
|
||||||
slave05 = self.fuel_web.get_nailgun_node_by_name('slave-05')
|
slave05 = self.fuel_web.get_nailgun_node_by_name('slave-05')
|
||||||
assert_true(
|
assert_true(
|
||||||
check_ping(slave05['ip'], DNS, deadline=120, interval=10),
|
check_ping(slave05['ip'], DNS, deadline=120, interval=10),
|
||||||
"No Internet access from {0}".format(node['fqdn'])
|
"No Internet access from {0}".format(slave05['fqdn'])
|
||||||
)
|
)
|
||||||
if OPENSTACK_RELEASE == OPENSTACK_RELEASE_UBUNTU:
|
if OPENSTACK_RELEASE == OPENSTACK_RELEASE_UBUNTU:
|
||||||
_ip = self.fuel_web.get_nailgun_node_by_name('slave-05')['ip']
|
_ip = self.fuel_web.get_nailgun_node_by_name('slave-05')['ip']
|
||||||
|
@ -1302,10 +1303,12 @@ class TestHaFailoverBase(TestBasic):
|
||||||
timeout=600, interval=20,
|
timeout=600, interval=20,
|
||||||
timeout_msg='RabbitMQ cluster was not assembled')
|
timeout_msg='RabbitMQ cluster was not assembled')
|
||||||
for node in rabbit_slaves:
|
for node in rabbit_slaves:
|
||||||
|
# pylint: disable=undefined-loop-variable
|
||||||
wait(lambda: count_run_rabbit(node, all_up=True), timeout=60,
|
wait(lambda: count_run_rabbit(node, all_up=True), timeout=60,
|
||||||
interval=10,
|
interval=10,
|
||||||
timeout_msg='Some nodes did not back to the cluster after'
|
timeout_msg='Some nodes did not back to the cluster after'
|
||||||
'10 minutes wait.')
|
'10 minutes wait.')
|
||||||
|
# pylint: enable=undefined-loop-variable
|
||||||
|
|
||||||
for node in d_ctrls:
|
for node in d_ctrls:
|
||||||
with self.fuel_web.get_ssh_for_node(node.name) as remote:
|
with self.fuel_web.get_ssh_for_node(node.name) as remote:
|
||||||
|
|
Loading…
Reference in New Issue