Commit ef3488a7 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Gracefuly raise 404 error in network delete

Refs: #4325
parent c19f938c
...@@ -1032,8 +1032,8 @@ class network_delete(_init_cyclades, _optional_output_cmd, _network_wait): ...@@ -1032,8 +1032,8 @@ class network_delete(_init_cyclades, _optional_output_cmd, _network_wait):
@errors.generic.all @errors.generic.all
@errors.cyclades.connection @errors.cyclades.connection
@errors.cyclades.network_id
@errors.cyclades.network_in_use @errors.cyclades.network_in_use
@errors.cyclades.network_id
def _run(self, network_id): def _run(self, network_id):
status = 'DELETED' status = 'DELETED'
if self['wait']: if self['wait']:
......
...@@ -233,10 +233,10 @@ class cyclades(object): ...@@ -233,10 +233,10 @@ class cyclades(object):
try: try:
return foo(self, *args, **kwargs) return foo(self, *args, **kwargs)
except ClientError as ce: except ClientError as ce:
if network_id and ce.status == 400: if network_id and ce.status in (400, ):
msg = 'Network with id %s does not exist' % network_id, msg = 'Network with id %s does not exist' % network_id,
raiseCLIError(ce, msg, details=this.about_network_id) raiseCLIError(ce, msg, details=this.about_network_id)
elif network_id or ce.status == 421: elif network_id or ce.status in (421, ):
msg = 'Network with id %s is in use' % network_id, msg = 'Network with id %s is in use' % network_id,
raiseCLIError(ce, msg, details=[ raiseCLIError(ce, msg, details=[
'Disconnect all nics/servers of this network first', 'Disconnect all nics/servers of this network first',
......
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