Commit 2a99a6f2 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Cyclades: Rename 'Can not' to 'Cannot' to all msgs

parent 0765c492
......@@ -165,9 +165,9 @@ class Command(BaseCommand):
if (subnet is None) and (subnet6 is None):
raise CommandError("subnet or subnet6 is required")
if subnet is None and gateway is not None:
raise CommandError("Can not use gateway without subnet")
raise CommandError("Cannot use gateway without subnet")
if subnet6 is None and gateway6 is not None:
raise CommandError("Can not use gateway6 without subnet6")
raise CommandError("Cannot use gateway6 without subnet6")
if public and not (backend_ids or floating_ip_pool):
raise CommandError("backend-ids is required")
if not userid and not public:
......
......@@ -128,7 +128,7 @@ class Command(BaseCommand):
floating_ip_pool = parse_bool(floating_ip_pool)
if floating_ip_pool is False and network.floating_ip_pool is True:
if network.ips.filter(deleted=False, floating_ip=True).exists():
msg = ("Can not make network a non floating IP pool."
msg = ("Cannot make network a non floating IP pool."
" There are still reserved floating IPs.")
raise CommandError(msg)
network.floating_ip_pool = floating_ip_pool
......@@ -173,7 +173,7 @@ class Command(BaseCommand):
backend = get_backend(remove_from_backend)
if network.nics.filter(machine__backend=backend,
machine__deleted=False).exists():
msg = "Can not remove. There are still connected VMs to this"\
msg = "Cannot remove. There are still connected VMs to this"\
" network"
raise CommandError(msg)
backend_mod.delete_network(network, backend, disconnect=True)
......
......@@ -215,7 +215,7 @@ def remove_instance_nics(instance, backend_client, stream=sys.stdout):
jobid = backend_client.ModifyInstance(instance_name, nics=op)
(status, error) = wait_for_job(backend_client, jobid)
if status != 'success':
raise CommandError("Can not rename instance: %s" % error)
raise CommandError("Cannot rename instance: %s" % error)
def add_public_nic(instance_name, nic, backend_client, stream=sys.stdout):
......@@ -223,7 +223,7 @@ def add_public_nic(instance_name, nic, backend_client, stream=sys.stdout):
jobid = backend_client.ModifyInstance(instance_name, nics=[('add', nic)])
(status, error) = wait_for_job(backend_client, jobid)
if status != 'success':
raise CommandError("Can not rename instance: %s" % error)
raise CommandError("Cannot rename instance: %s" % error)
def shutdown_instance(instance, backend_client, stream=sys.stdout):
......@@ -234,7 +234,7 @@ def shutdown_instance(instance, backend_client, stream=sys.stdout):
jobid = backend_client.ShutdownInstance(instance_name)
(status, error) = wait_for_job(backend_client, jobid)
if status != 'success':
raise CommandError("Can not shutdown instance: %s" % error)
raise CommandError("Cannot shutdown instance: %s" % error)
def rename_instance(old_name, new_name, backend_client, stream=sys.stdout):
......@@ -244,7 +244,7 @@ def rename_instance(old_name, new_name, backend_client, stream=sys.stdout):
ip_check=False, name_check=False)
(status, error) = wait_for_job(backend_client, jobid)
if status != 'success':
raise CommandError("Can not rename instance: %s" % error)
raise CommandError("Cannot rename instance: %s" % error)
def startup_instance(name, backend_client, stream=sys.stdout):
......@@ -252,4 +252,4 @@ def startup_instance(name, backend_client, stream=sys.stdout):
jobid = backend_client.StartupInstance(name)
(status, error) = wait_for_job(backend_client, jobid)
if status != 'success':
raise CommandError("Can not rename instance: %s" % error)
raise CommandError("Cannot rename instance: %s" % error)
......@@ -112,7 +112,7 @@ def create_network(request):
if flavor not in Network.FLAVORS.keys():
raise api.faults.BadRequest("Invalid network type '%s'" % flavor)
if flavor not in settings.API_ENABLED_NETWORK_FLAVORS:
raise api.faults.Forbidden("Can not create network of type '%s'." %
raise api.faults.Forbidden("Cannot create network of type '%s'." %
flavor)
name = api.utils.get_attribute(network_dict, "name", required=False)
......@@ -143,7 +143,7 @@ def update_network(request, network_id):
network = util.get_network(network_id, request.user_uniq, for_update=True)
if network.public:
raise api.faults.Forbidden("Can not rename the public network.")
raise api.faults.Forbidden("Cannot rename the public network.")
network = networks.rename(network, new_name)
return render_network(request, network_to_dict(network), 200)
......@@ -154,7 +154,7 @@ def delete_network(request, network_id):
log.info('delete_network %s', network_id)
network = util.get_network(network_id, request.user_uniq, for_update=True)
if network.public:
raise api.faults.Forbidden("Can not delete the public network.")
raise api.faults.Forbidden("Cannot delete the public network.")
networks.delete(network)
return HttpResponse(status=204)
......
......@@ -166,12 +166,12 @@ def create_network(request):
elif flavor not in Network.FLAVORS.keys():
raise faults.BadRequest("Invalid network type '%s'" % flavor)
elif flavor not in settings.API_ENABLED_NETWORK_FLAVORS:
raise faults.Forbidden("Can not create network of type '%s'" %
raise faults.Forbidden("Cannot create network of type '%s'" %
flavor)
public = d.get("public", False)
if public:
raise faults.Forbidden("Can not create a public network.")
raise faults.Forbidden("Cannot create a public network.")
dhcp = d.get('dhcp', True)
......@@ -229,7 +229,7 @@ def update_network_name(request, network_id):
network = util.get_network(network_id, request.user_uniq)
if network.public:
raise faults.Forbidden('Can not rename the public network.')
raise faults.Forbidden('Cannot rename the public network.')
network = networks.rename(network, name)
return HttpResponse(status=204)
......@@ -247,7 +247,7 @@ def delete_network(request, network_id):
log.info('delete_network %s', network_id)
network = util.get_network(network_id, request.user_uniq, for_update=True)
if network.public:
raise faults.Forbidden('Can not delete the public network.')
raise faults.Forbidden('Cannot delete the public network.')
networks.delete(network)
return HttpResponse(status=204)
......@@ -265,7 +265,7 @@ def demux_network_action(request, network_id):
net = util.get_network(network_id, request.user_uniq)
if net.public:
raise faults.Forbidden('Can not modify the public network.')
raise faults.Forbidden('Cannot modify the public network.')
if net.deleted:
raise faults.BadRequest("Network has been deleted.")
......
......@@ -342,7 +342,7 @@ class FloatingIPAPITest(BaseAPITest):
network = ip.network
network.public = False
network.save()
# Can not remove network with floating IPs
# Cannot remove network with floating IPs
with mocked_quotaholder():
response = self.delete(NETWORKS_URL + "/%s" % self.pool.id,
self.pool.userid)
......
......@@ -233,7 +233,7 @@ def get_port(port_id, user_id, for_update=False):
if for_update:
objects = objects.select_for_update()
# if (port.device_owner != "vm") and for_update:
# raise faults.BadRequest('Can not update non vm port')
# raise faults.BadRequest('Cannot update non vm port')
return objects.get(id=port_id)
except (ValueError, NetworkInterface.DoesNotExist):
raise faults.ItemNotFound("Port '%s' not found." % port_id)
......
......@@ -62,8 +62,8 @@ def decrypt_db_charfield(ciphertext):
plaintext = plaintext[SALT_LEN:]
if salt != pure_salt:
# Can not decrtypt password
raise CorruptedPassword("Can not decrypt password. Check the key")
# Cannot decrtypt password
raise CorruptedPassword("Cannot decrypt password. Check the key")
else:
return plaintext
......
......@@ -102,7 +102,7 @@ class Migration(DataMigration):
def backwards(self, orm):
"Write your backwards methods here."
raise RuntimeError("Can not reverse this migrations")
raise RuntimeError("Cannot reverse this migrations")
models = {
'db.backend': {
......
......@@ -69,8 +69,8 @@ def decrypt_db_charfield_old(ciphertext):
plaintext = plaintext[SALT_LEN:]
if salt != pure_salt:
# Can not decrtypt password
raise CorruptedPassword("Can not decrypt password. Check the key")
# Cannot decrtypt password
raise CorruptedPassword("Cannot decrypt password. Check the key")
else:
return plaintext
......@@ -108,8 +108,8 @@ def decrypt_db_charfield(ciphertext):
plaintext = plaintext[SALT_LEN:]
if salt != pure_salt:
# Can not decrtypt password
raise CorruptedPassword("Can not decrypt password. Check the key")
# Cannot decrtypt password
raise CorruptedPassword("Cannot decrypt password. Check the key")
else:
return plaintext
......
......@@ -166,7 +166,7 @@ class Backend(models.Model):
first_free = [x for x in xrange(0, 16) if x not in indexes][0]
self.index = first_free
except IndexError:
raise Exception("Can not create more than 16 backends")
raise Exception("Cannot create more than 16 backends")
def use_hotplug(self):
return self.hypervisor == "kvm" and snf_settings.GANETI_USE_HOTPLUG
......@@ -755,7 +755,7 @@ class IPAddress(models.Model):
ip_pool.put(self.address)
ip_pool.save()
return
log.error("Can not release address %s of NIC %s. Address does not"
log.error("Cannot release address %s of NIC %s. Address does not"
" belong to any of the IP pools of the subnet %s !",
self.address, self.nic, self.subnet_id)
......@@ -904,7 +904,7 @@ def pooled_rapi_client(obj):
if backend.offline:
log.warning("Trying to connect with offline backend: %s", backend)
raise faults.ServiceUnavailable("Can not connect to offline"
raise faults.ServiceUnavailable("Cannot connect to offline"
" backend: %s" % backend)
b = backend
......
......@@ -168,7 +168,7 @@ class PoolManager(object):
size = self.pool_size
tmp = self.available[(size - bits_num): size]
if tmp.count(UNAVAILABLE):
raise Exception("Can not shrink. In use")
raise Exception("Cannot shrink. In use")
self.resize(-bits_num)
def resize(self, bits_num):
......
......@@ -42,7 +42,7 @@ def allocate(backends, vm):
if len(backends) == 1:
return backends[0]
# Filter those that can not host the vm
# Filter those that cannot host the vm
capable_backends = [backend for backend in backends
if vm_fits_in_backend(backend, vm)]
......
......@@ -213,7 +213,7 @@ def _process_resize(vm, beparams):
disk=old_flavor.disk,
disk_template=old_flavor.disk_template)
except Flavor.DoesNotExist:
raise Exception("Can not find flavor for VM")
raise Exception("Cannot find flavor for VM")
vm.flavor = new_flavor
vm.save()
......@@ -363,7 +363,7 @@ def update_ip_address_log(nic, ip):
active=True)
except IPAddressLog.MultipleObjectsReturned:
logmsg = ("Multiple active log entries for IP %s, Network %s,"
"Server %s. Can not proceed!"
"Server %s. Cannot proceed!"
% (ip.address, ip.network, nic.machine))
log.error(logmsg)
raise
......@@ -451,7 +451,7 @@ def update_network_state(network):
# Release the resources on the deletion of the Network
if deleted:
if network.ips.filter(deleted=False, floating_ip=True).exists():
msg = "Can not delete network %s! Floating IPs still in use!"
msg = "Cannot delete network %s! Floating IPs still in use!"
log.error(msg % network)
raise Exception(msg % network)
log.info("Network %r deleted. Releasing link %r mac_prefix %r",
......
......@@ -91,7 +91,7 @@ def instance_from_msg(func):
log.error("VM for instance %s with id %d not found in DB.",
msg['instance'], vm_id)
except Network.InvalidBackendIdError, Network.DoesNotExist:
log.error("Invalid message, can not find network. msg: %s", msg)
log.error("Invalid message, cannot find network. msg: %s", msg)
return wrapper
......
......@@ -296,7 +296,7 @@ def main():
(opts, args) = parse_arguments(sys.argv[1:])
# Rename this process so 'ps' output looks like this is a native
# executable. Can not seperate command-line arguments from actual name of
# executable. Cannot seperate command-line arguments from actual name of
# the executable by NUL bytes, so only show the name of the executable
# instead. setproctitle.setproctitle("\x00".join(sys.argv))
setproctitle.setproctitle(sys.argv[0])
......
......@@ -44,7 +44,7 @@ def allocate_ip_from_pools(pool_rows, userid, address=None, floating_ip=False):
def allocate_ip(network, userid, address=None, floating_ip=False):
"""Try to allocate an IP from networks IP pools."""
if network.action == "DESTROY":
raise faults.Conflict("Can not allocate IP. Network %s is being"
raise faults.Conflict("Cannot allocate IP. Network %s is being"
" deleted" % network.id)
ip_pools = IPPoolTable.objects.select_for_update()\
.filter(subnet__network=network)
......@@ -100,7 +100,7 @@ def allocate_public_ip(userid, floating_ip=False, backend=None, networks=None):
if backend is not None:
log_msg += " Backend: %s" % backend
log.error(log_msg)
exception_msg = "Can not allocate a %s IP address." % ip_type
exception_msg = "Cannot allocate a %s IP address." % ip_type
raise faults.Conflict(exception_msg)
......@@ -110,11 +110,11 @@ def create_floating_ip(userid, network=None, address=None):
floating_ip = allocate_public_ip(userid, floating_ip=True)
else:
if not network.floating_ip_pool:
msg = ("Can not allocate floating IP. Network %s is"
msg = ("Cannot allocate floating IP. Network %s is"
" not a floating IP pool.")
raise faults.Conflict(msg % network.id)
if network.action == "DESTROY":
msg = "Can not allocate floating IP. Network %s is being deleted."
msg = "Cannot allocate floating IP. Network %s is being deleted."
raise faults.Conflict(msg % network.id)
# Allocate the floating IP
......
......@@ -55,7 +55,7 @@ class Command(BaseCommand):
write("Trying to remove backend: %s\n" % backend.clustername)
if backend.virtual_machines.filter(deleted=False).exists():
raise CommandError('Backend hosts non-deleted vms. Can not delete')
raise CommandError('Backend hosts non-deleted vms. Cannot delete')
# Get networks before deleting backend, because after deleting the
# backend, all BackendNetwork objects are deleted!
......@@ -64,7 +64,7 @@ class Command(BaseCommand):
try:
delete_backend(backend)
except models.ProtectedError as e:
msg = ("Can not delete backend because it contains"
msg = ("Cannot delete backend because it contains"
"non-deleted VMs:\n%s" % e)
raise CommandError(msg)
......
......@@ -73,12 +73,12 @@ def create(userid, name, flavor, subnet=None, gateway=None, subnet6=None,
raise faults.BadRequest("Invalid network type '%s'" % flavor)
if mac_prefix is not None and flavor == "MAC_FILTERED":
raise faults.BadRequest("Can not override MAC_FILTERED mac-prefix")
raise faults.BadRequest("Cannot override MAC_FILTERED mac-prefix")
if link is not None and flavor == "PHYSICAL_VLAN":
raise faults.BadRequest("Can not override PHYSICAL_VLAN link")
raise faults.BadRequest("Cannot override PHYSICAL_VLAN link")
if subnet is None and floating_ip_pool:
raise faults.BadRequest("IPv6 only networks can not be floating"
raise faults.BadRequest("IPv6 only networks cannot be floating"
" pools.")
# Check that network parameters are valid
subnets.validate_subnet_params(subnet, gateway, subnet6, gateway6)
......@@ -153,10 +153,10 @@ def rename(network, name):
@network_command("DESTROY")
def delete(network):
if network.nics.exists():
raise faults.Conflict("Can not delete network. There are ports still"
raise faults.Conflict("Cannot delete network. There are ports still"
" configured on network network %s" % network.id)
if network.ips.filter(deleted=False, floating_ip=True).exists():
msg = "Can not delete netowrk. Network has allocated floating IPs."
msg = "Cannot delete netowrk. Network has allocated floating IPs."
raise faults.Conflict(msg)
network.action = "DESTROY"
......
......@@ -460,7 +460,7 @@ class GanetiRapiClient(object): # pylint: disable=R0904
conflicts = set(kwargs.iterkeys()) & set(body.iterkeys())
if conflicts:
raise GanetiApiError("Required fields can not be specified as"
raise GanetiApiError("Required fields cannot be specified as"
" keywords: %s" % ", ".join(conflicts))
body.update((key, value) for key, value in kwargs.iteritems()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment