Commit 8d988bfd authored by Dionysis Grigoropoulos's avatar Dionysis Grigoropoulos Committed by Christos Stavrakakis
Browse files

cyclades: Verbal fixes on some snf-manage commands

parent 09bc0fab
......@@ -41,16 +41,18 @@ from synnefo.logic import ips
class Command(RemoveCommand):
args = "<Floating-IP ID or Floating-IP IDs>"
help = "Release a floating IP"
@common.convert_api_faults
@transaction.commit_on_success
def handle(self, *args, **options):
if not args:
raise CommandError("Please provide a floating-ip address")
raise CommandError("Please provide a floating-ip ID")
force = options['force']
self.confirm_deletion(force, "floating ip(s)", args)
message = "floating IPs" if len(args) > 1 else "floating IP"
self.confirm_deletion(force, message, args)
for floating_ip_id in args:
self.stdout.write("\n")
......
......@@ -37,6 +37,7 @@ from synnefo.management.common import get_network, convert_api_faults
class Command(RemoveCommand):
can_import_settings = True
args = "<Network ID or Network IDs>"
help = "Remove a network from the Database, and Ganeti"
@convert_api_faults
......@@ -45,7 +46,8 @@ class Command(RemoveCommand):
raise CommandError("Please provide a network ID")
force = options['force']
self.confirm_deletion(force, "network(s)", args)
message = "networks" if len(args) > 1 else "network"
self.confirm_deletion(force, message, args)
for network_id in args:
self.stdout.write("\n")
......
......@@ -38,6 +38,7 @@ from snf_django.management.commands import RemoveCommand
class Command(RemoveCommand):
can_import_settings = True
args = "<Port ID or Port IDs>"
help = "Remove a port from the Database and from the VMs attached to"
option_list = RemoveCommand.option_list + (
make_option(
......@@ -55,7 +56,8 @@ class Command(RemoveCommand):
raise CommandError("Please provide a port ID")
force = options['force']
self.confirm_deletion(force, "port(s)", args)
message = "ports" if len(args) > 1 else "port"
self.confirm_deletion(force, message, args)
for port_id in args:
self.stdout.write("\n")
......
......@@ -43,7 +43,7 @@ from snf_django.lib.api import faults
class Command(RemoveCommand):
args = "<server ID>"
args = "<server ID or server IDs>"
help = "Remove a server by deleting the instance from the Ganeti backend."
option_list = RemoveCommand.option_list + (
......@@ -62,7 +62,8 @@ class Command(RemoveCommand):
raise CommandError("Please provide a server ID")
force = options['force']
self.confirm_deletion(force, "server(s)", args)
message = "servers" if len(args) > 1 else "server"
self.confirm_deletion(force, message, args)
for server_id in args:
self.stdout.write("\n")
......
......@@ -355,4 +355,5 @@ class RemoveCommand(BaseCommand):
if answer != 1:
raise CommandError("Aborting deletion")
except ValueError:
raise CommandError("Invalid Y/N value, aborting")
raise CommandError("Unaccepted input value. Please choose yes/no"
" (y/n).")
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