Revision 052ef3b9 snf-cyclades-app/synnefo/api/management/commands/network-modify.py

b/snf-cyclades-app/synnefo/api/management/commands/network-modify.py
37 37

  
38 38
from synnefo.db.models import Network, pooled_rapi_client
39 39
from synnefo.management.common import validate_network_info, get_network
40
from synnefo.webproject.management.utils import parse_bool
40 41

  
41 42
HELP_MSG = """Modify a network.
42 43

  
......
84 85
        make_option(
85 86
            '--dhcp',
86 87
            dest='dhcp',
88
            metavar="True|False",
89
            choices=["True", "False"],
87 90
            help="Set if network will use nfdhcp"),
88 91
        make_option(
89 92
            '--state',
......
127 130
                msg = "Invalid state, must be one of %s" % ', '.join(allowed)
128 131
                raise CommandError(msg)
129 132

  
133
        dhcp = options.get("dhcp")
134
        if dhcp:
135
            options["dhcp"] = parse_bool(dhcp)
130 136
        fields = ('name', 'userid', 'subnet', 'gateway', 'subnet6', 'gateway6',
131 137
                  'dhcp', 'state', 'link', 'mac_prefix')
132 138
        for field in fields:
133 139
            value = options.get(field, None)
134
            if value:
140
            if value is not None:
135 141
                network.__setattr__(field, value)
136 142

  
137 143
        add_reserved_ips = options.get('add_reserved_ips')

Also available in: Unified diff