Add quotes around vars in all return messages

This commit is contained in:
Joshua Boniface 2019-07-08 22:37:26 -04:00
parent dd78aa8fb8
commit a3de9da513
4 changed files with 13 additions and 13 deletions

View File

@ -208,7 +208,7 @@ def add_osd(zk_conn, node, device, weight):
# Verify target block device isn't in use
block_osd = verifyOSDBlock(zk_conn, node, device)
if block_osd:
return False, 'ERROR: Block device {} on node {} is used by OSD {}'.format(device, node, block_osd)
return False, 'ERROR: Block device "{}" on node "{}" is used by OSD "{}"'.format(device, node, block_osd)
# Tell the cluster to create a new OSD for the host
add_osd_string = 'osd_add {},{},{}'.format(node, device, weight)
@ -253,7 +253,7 @@ def remove_osd(zk_conn, osd_id):
try:
result = zkhandler.readdata(zk_conn, '/ceph/cmd').split()[0]
if result == 'success-osd_remove':
message = 'Removed OSD {} from the cluster.'.format(osd_id)
message = 'Removed OSD "{}" from the cluster.'.format(osd_id)
success = True
else:
message = 'ERROR: Failed to remove OSD; check node logs for details.'
@ -702,7 +702,7 @@ def remove_pool(zk_conn, name):
try:
result = zkhandler.readdata(zk_conn, '/ceph/cmd').split()[0]
if result == 'success-pool_remove':
message = 'Removed RBD pool {} and all volumes.'.format(name)
message = 'Removed RBD pool "{}" and all volumes.'.format(name)
success = True
else:
message = 'ERROR: Failed to remove pool; check node logs for details.'
@ -981,7 +981,7 @@ def remove_volume(zk_conn, pool, name):
try:
result = zkhandler.readdata(zk_conn, '/ceph/cmd').split()[0]
if result == 'success-volume_remove':
message = 'Removed RBD volume {} in pool {}.'.format(name, pool)
message = 'Removed RBD volume "{}" in pool "{}".'.format(name, pool)
success = True
else:
message = 'ERROR: Failed to remove volume; check node logs for details.'
@ -1198,7 +1198,7 @@ def remove_snapshot(zk_conn, pool, volume, name):
try:
result = zkhandler.readdata(zk_conn, '/ceph/cmd').split()[0]
if result == 'success-snapshot_remove':
message = 'Removed RBD snapshot {} and all volumes.'.format(name)
message = 'Removed RBD snapshot "{}" of volume "{}" in pool "{}".'.format(name, volume, pool)
success = True
else:
message = 'ERROR: Failed to remove snapshot; check node logs for details.'

View File

@ -231,11 +231,11 @@ def add_network(zk_conn, vni, description, nettype,
# Check if a network with this VNI or description already exists
if zkhandler.exists(zk_conn, '/networks/{}'.format(vni)):
return False, 'ERROR: A network with VNI {} already exists!'.format(vni)
return False, 'ERROR: A network with VNI "{}" already exists!'.format(vni)
for network in zkhandler.listchildren(zk_conn, '/networks'):
network_description = zkhandler.readdata(zk_conn, '/networks/{}'.format(network))
if network_description == description:
return False, 'ERROR: A network with description {} already exists!'.format(description)
return False, 'ERROR: A network with description "{}" already exists!'.format(description)
# We're generating the default gateway to be ip6_network::1/YY
if ip6_network:

View File

@ -112,7 +112,7 @@ def secondary_node(zk_conn, node):
'/primary_node': 'none'
})
else:
return False, 'Node {} is already in secondary router mode.'.format(node)
return False, 'Node "{}" is already in secondary router mode.'.format(node)
return True, retmsg
@ -139,7 +139,7 @@ def primary_node(zk_conn, node):
'/primary_node': node
})
else:
return False, 'Node {} is already in primary router mode.'.format(node)
return False, 'Node "{}" is already in primary router mode.'.format(node)
return True, retmsg

View File

@ -181,7 +181,7 @@ def define_vm(zk_conn, config_data, target_node, selector):
# Verify node is valid
valid_node = common.verifyNode(zk_conn, target_node)
if not valid_node:
return False, "Specified node {} is invalid.".format(target_node)
return False, 'Specified node "{}" is invalid.'.format(target_node)
# Add the new domain to Zookeeper
zkhandler.writedata(zk_conn, {
@ -382,7 +382,7 @@ def move_vm(zk_conn, domain, target_node, selector):
# Verify node is valid
valid_node = common.verifyNode(zk_conn, target_node)
if not valid_node:
return False, "Specified node {} is invalid.".format(target_node)
return False, 'Specified node "{}" is invalid.'.format(target_node)
# Verify if node is current node
if target_node == current_node:
@ -437,7 +437,7 @@ def migrate_vm(zk_conn, domain, target_node, selector, force_migrate, is_cli=Fal
# Verify node is valid
valid_node = common.verifyNode(zk_conn, target_node)
if not valid_node:
return False, "Specified node {} is invalid.".format(target_node)
return False, 'Specified node "{}" is invalid.'.format(target_node)
# Verify if node is current node
if target_node == current_node:
@ -568,7 +568,7 @@ def get_list(zk_conn, node, state, limit, is_fuzzy=True):
if node:
# Verify node is valid
if not common.verifyNode(zk_conn, node):
return False, "Specified node {} is invalid.".format(node)
return False, 'Specified node "{}" is invalid.'.format(node)
if state:
valid_states = [ 'start', 'restart', 'shutdown', 'stop', 'failed', 'migrate', 'unmigrate' ]