Revision 32e4e343 snf-cyclades-app/synnefo/api/floating_ips.py
b/snf-cyclades-app/synnefo/api/floating_ips.py | ||
---|---|---|
142 | 142 |
else: |
143 | 143 |
try: |
144 | 144 |
network_id = int(pool) |
145 |
except ValueErrorx:
|
|
145 |
except ValueError: |
|
146 | 146 |
raise faults.BadRequest("Invalid pool ID.") |
147 |
network = next((n for n in net_objects if n.id==pool), None) |
|
147 |
network = next((n for n in net_objects if n.id == network_id), |
|
148 |
None) |
|
148 | 149 |
if network is None: |
149 | 150 |
raise faults.ItemNotFound("Pool '%s' does not exist." % pool) |
150 | 151 |
if address is None: |
... | ... | |
169 | 170 |
# If address is not available, check that it belongs to the |
170 | 171 |
# same user |
171 | 172 |
elif not network.nics.filter(ipv4=address, |
172 |
machine__userid=userid).exists(): |
|
173 |
machine__userid=userid).exists():
|
|
173 | 174 |
msg = "Address '%s' is already in use" % address |
174 | 175 |
raise faults.Conflict(msg) |
175 | 176 |
floating_ip = FloatingIP.objects.create(ipv4=address, network=network, |
Also available in: Unified diff