Revision 8646e606 snf-cyclades-app/synnefo/api/management/commands/subnet-create.py
b/snf-cyclades-app/synnefo/api/management/commands/subnet-create.py | ||
---|---|---|
72 | 72 |
" The IP must be inside the CIDR range and cannot be the" |
73 | 73 |
" subnet or broadcast IP. If no value is specified, the" |
74 | 74 |
" first available IP of the subnet will be used."), |
75 |
make_option("--dhcp", action="store_true", dest="dhcp", default=True, |
|
75 |
make_option("--no-dhcp", action="store_true", dest="dhcp", |
|
76 |
default=False, |
|
76 | 77 |
help="True/False value for DHCP/SLAAC. True by default."), |
77 | 78 |
make_option("--dns", dest="dns", |
78 | 79 |
help="DNS nameservers to be used by the VMs in the subnet." |
... | ... | |
92 | 93 |
cidr = options["cidr"] |
93 | 94 |
|
94 | 95 |
if not network_id: |
95 |
raise CommandError("network_id is mandatory")
|
|
96 |
raise CommandError("network-id is mandatory")
|
|
96 | 97 |
if not cidr: |
97 | 98 |
raise CommandError("cidr is mandatory") |
98 | 99 |
|
99 | 100 |
user_id = common.get_network(network_id).userid |
100 | 101 |
name = options["name"] |
101 | 102 |
allocation_pools = options["allocation_pools"] |
102 |
ipversion = int(options["ipversion"])
|
|
103 |
ipversion = options["ipversion"]
|
|
103 | 104 |
if not ipversion: |
104 | 105 |
ipversion = 4 |
106 |
else: |
|
107 |
try: |
|
108 |
ipversion = int(ipversion) |
|
109 |
except ValueError: |
|
110 |
raise CommandError("ip-version must be 4 or 6") |
|
111 |
|
|
105 | 112 |
gateway = options["gateway"] |
106 | 113 |
if not gateway: |
107 | 114 |
gateway = "" |
108 | 115 |
dhcp = options["dhcp"] |
109 |
if not dhcp: |
|
110 |
dhcp = True |
|
116 |
dhcp = False if dhcp else True |
|
111 | 117 |
dns = options["dns"] |
112 | 118 |
host_routes = options["host_routes"] |
113 | 119 |
|
Also available in: Unified diff