Commit a3af45d8 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix bug in network-modify management cmd

Use 'parse_bool' function to parse '--dhcp' option. Also, include
'dhcp' to default columnds of 'network-list' command.
parent c4cfb380
......@@ -94,7 +94,7 @@ class Command(ListCommand):
}
fields = ["id", "name", "user.uuid", "state", "public", "subnet.ipv4",
"gateway.ipv4", "link", "mac_prefix"]
"gateway.ipv4", "link", "mac_prefix", "dhcp"]
def handle_args(self, *args, **options):
if options["public"]:
......
......@@ -37,6 +37,7 @@ from django.core.management.base import BaseCommand, CommandError
from synnefo.db.models import Network, pooled_rapi_client
from synnefo.management.common import validate_network_info, get_network
from synnefo.webproject.management.utils import parse_bool
HELP_MSG = """Modify a network.
......@@ -84,6 +85,8 @@ class Command(BaseCommand):
make_option(
'--dhcp',
dest='dhcp',
metavar="True|False",
choices=["True", "False"],
help="Set if network will use nfdhcp"),
make_option(
'--state',
......@@ -127,11 +130,14 @@ class Command(BaseCommand):
msg = "Invalid state, must be one of %s" % ', '.join(allowed)
raise CommandError(msg)
dhcp = options.get("dhcp")
if dhcp:
options["dhcp"] = parse_bool(dhcp)
fields = ('name', 'userid', 'subnet', 'gateway', 'subnet6', 'gateway6',
'dhcp', 'state', 'link', 'mac_prefix')
for field in fields:
value = options.get(field, None)
if value:
if value is not None:
network.__setattr__(field, value)
add_reserved_ips = options.get('add_reserved_ips')
......
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