Lint: F841 local variable '<variable>' is assigned to but never used
This commit is contained in:
@ -158,10 +158,6 @@ class DNSNetworkInstance(object):
|
||||
# Add a new network to the aggregator database
|
||||
def add_network(self):
|
||||
network_domain = self.network.domain
|
||||
if self.network.ip4_gateway != 'None':
|
||||
network_gateway = self.network.ip4_gateway
|
||||
else:
|
||||
network_gateway = self.network.ip6_gateway
|
||||
|
||||
self.logger.out(
|
||||
'Adding entry for client domain {}'.format(
|
||||
@ -330,8 +326,6 @@ class AXFRDaemonInstance(object):
|
||||
while not self.thread_stopper.is_set():
|
||||
# We do this for each network
|
||||
for network, instance in self.dns_networks.items():
|
||||
zone_modified = False
|
||||
|
||||
# Set up our SQL cursor
|
||||
try:
|
||||
sql_curs = self.sql_conn.cursor()
|
||||
|
@ -233,7 +233,7 @@ def readConfig(pvcnoded_config_file, myhostname):
|
||||
# Verify the network provided is valid
|
||||
try:
|
||||
network = ip_network(config[network_key])
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print('ERROR: Network address {} for {} is not valid!'.format(config[network_key], network_key))
|
||||
exit(1)
|
||||
|
||||
@ -253,7 +253,7 @@ def readConfig(pvcnoded_config_file, myhostname):
|
||||
# Verify we're in the network
|
||||
if floating_addr not in list(network.hosts()):
|
||||
raise
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print('ERROR: Floating address {} for {} is not valid!'.format(config[floating_key], floating_key))
|
||||
exit(1)
|
||||
|
||||
@ -571,15 +571,14 @@ def cleanup():
|
||||
if d_domain[domain].getnode() == myhostname:
|
||||
try:
|
||||
d_domain[domain].console_log_instance.stop()
|
||||
except NameError as e:
|
||||
except NameError:
|
||||
pass
|
||||
except AttributeError as e:
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# Force into secondary coordinator state if needed
|
||||
try:
|
||||
if this_node.router_state == 'primary':
|
||||
is_primary = True
|
||||
zkhandler.writedata(zk_conn, {
|
||||
'/primary_node': 'none'
|
||||
})
|
||||
@ -891,7 +890,7 @@ if enable_networking:
|
||||
try:
|
||||
dns_aggregator.add_network(d_network[network])
|
||||
except Exception as e:
|
||||
logger.out('Failed to create DNS Aggregator for network {}'.format(network), 'w')
|
||||
logger.out('Failed to create DNS Aggregator for network {}: {}'.format(network, e), 'w')
|
||||
# Start primary functionality
|
||||
if this_node.router_state == 'primary' and d_network[network].nettype == 'managed':
|
||||
d_network[network].createGateways()
|
||||
@ -1150,7 +1149,7 @@ def collect_ceph_stats(queue):
|
||||
})
|
||||
except Exception as e:
|
||||
# One or more of the status commands timed out, just continue
|
||||
logger.out('Failed to format and send pool data', state='w')
|
||||
logger.out('Failed to format and send pool data: {}'.format(e), state='w')
|
||||
pass
|
||||
|
||||
# Only grab OSD stats if there are OSDs to grab (otherwise `ceph osd df` hangs)
|
||||
@ -1341,7 +1340,7 @@ def collect_vm_stats(queue):
|
||||
try:
|
||||
if instance.getdom().state()[0] != libvirt.VIR_DOMAIN_RUNNING:
|
||||
raise
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# Toggle a state "change"
|
||||
zkhandler.writedata(zk_conn, { '/domains/{}/state'.format(domain): instance.getstate() })
|
||||
elif instance.getnode() == this_node.name:
|
||||
@ -1621,11 +1620,9 @@ def node_keepalive():
|
||||
for node_name in d_node:
|
||||
try:
|
||||
node_daemon_state = zkhandler.readdata(zk_conn, '/nodes/{}/daemonstate'.format(node_name))
|
||||
node_domain_state = zkhandler.readdata(zk_conn, '/nodes/{}/domainstate'.format(node_name))
|
||||
node_keepalive = int(zkhandler.readdata(zk_conn, '/nodes/{}/keepalive'.format(node_name)))
|
||||
except Exception:
|
||||
node_daemon_state = 'unknown'
|
||||
node_domain_state = 'unknown'
|
||||
node_keepalive = 0
|
||||
|
||||
# Handle deadtime and fencng if needed
|
||||
|
@ -174,19 +174,15 @@ class MetadataAPIInstance(object):
|
||||
pass
|
||||
|
||||
# Get our real information on the host; now we can start querying about it
|
||||
client_hostname = host_information.get('hostname', None)
|
||||
client_macaddr = host_information.get('mac_address', None)
|
||||
client_ipaddr = host_information.get('ip4_address', None)
|
||||
|
||||
# Find the VM with that MAC address - we can't assume that the hostname is actually right
|
||||
_discard, vm_list = pvc_vm.get_list(self.zk_conn, None, None, None)
|
||||
vm_name = None
|
||||
vm_details = dict()
|
||||
for vm in vm_list:
|
||||
try:
|
||||
for network in vm.get('networks'):
|
||||
if network.get('mac', None) == client_macaddr:
|
||||
vm_name = vm.get('name')
|
||||
vm_details = vm
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -512,7 +512,7 @@ class VMInstance(object):
|
||||
time.sleep(0.5) # Time for reader to acquire the lock
|
||||
|
||||
if do_migrate_shutdown:
|
||||
migrate_shutdown_result = migrate_shutdown()
|
||||
migrate_shutdown()
|
||||
|
||||
self.logger.out('Releasing write lock for synchronization phase C', state='i', prefix='Domain {}'.format(self.domuuid))
|
||||
lock.release()
|
||||
@ -547,7 +547,6 @@ class VMInstance(object):
|
||||
time.sleep(0.1)
|
||||
|
||||
self.inreceive = True
|
||||
live_receive = True
|
||||
|
||||
self.logger.out('Receiving VM migration from node "{}"'.format(self.node), state='i', prefix='Domain {}'.format(self.domuuid))
|
||||
|
||||
|
@ -149,7 +149,7 @@ def findTargetNode(zk_conn, config, logger, dom_uuid):
|
||||
# Determine VM search field
|
||||
try:
|
||||
search_field = zkhandler.readdata(zk_conn, '/domains/{}/node_selector'.format(dom_uuid))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
search_field = None
|
||||
|
||||
# If our search field is invalid, use and set the default (for next time)
|
||||
|
@ -43,7 +43,6 @@ def readdata(zk_conn, key):
|
||||
try:
|
||||
data_raw = zk_conn.get(key)
|
||||
data = data_raw[0].decode('utf8')
|
||||
meta = data_raw[1]
|
||||
return data
|
||||
except Exception:
|
||||
return None
|
||||
|
Reference in New Issue
Block a user