Commit a80bd8e7 by Fukász Rómeó Ervin

occi: fix flake8 warnings

parent 5e3ad1e8
...@@ -204,7 +204,7 @@ class OcciComputeView(OcciViewMixin, View): ...@@ -204,7 +204,7 @@ class OcciComputeView(OcciViewMixin, View):
try: try:
vm = Instance.create_from_template(template, vm = Instance.create_from_template(template,
request.user) request.user)
except: except Exception:
return OcciResourceCreationError().response return OcciResourceCreationError().response
compute = Compute(vm) compute = Compute(vm)
return occi_response(compute.as_dict()) return occi_response(compute.as_dict())
...@@ -219,7 +219,7 @@ class OcciComputeView(OcciViewMixin, View): ...@@ -219,7 +219,7 @@ class OcciComputeView(OcciViewMixin, View):
return e.response return e.response
try: try:
compute.vm.destroy(user=request.user) compute.vm.destroy(user=request.user)
except: except Exception:
return OcciResourceDeletionError().response return OcciResourceDeletionError().response
return occi_response({"result": "Compute instance deleted."}) return occi_response({"result": "Compute instance deleted."})
...@@ -407,7 +407,7 @@ class OcciNetworkInterfaceView(OcciViewMixin, View): ...@@ -407,7 +407,7 @@ class OcciNetworkInterfaceView(OcciViewMixin, View):
compute = self.get_compute_object(user, vmid) compute = self.get_compute_object(user, vmid)
try: try:
interface = compute.vm.interface_set.get(vlan__pk=vlanid) interface = compute.vm.interface_set.get(vlan__pk=vlanid)
except: except Exception:
raise OcciResourceInstanceNotExist() raise OcciResourceInstanceNotExist()
return NetworkInterface(compute, Network(interface.vlan)) return NetworkInterface(compute, Network(interface.vlan))
...@@ -454,7 +454,7 @@ class OcciNetworkInterfaceView(OcciViewMixin, View): ...@@ -454,7 +454,7 @@ class OcciNetworkInterfaceView(OcciViewMixin, View):
network = self.get_network_object(request.user, kwargs["networkid"]) network = self.get_network_object(request.user, kwargs["networkid"])
try: try:
interface = compute.vm.interface_set.get(vlan=network.vlan) interface = compute.vm.interface_set.get(vlan=network.vlan)
except: except Exception:
return OcciResourceInstanceNotExist().response return OcciResourceInstanceNotExist().response
try: try:
from firewall.models import Host from firewall.models import Host
......
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 sign in to comment