Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
fix(Security): added missing return statements
Browse files Browse the repository at this point in the history
  • Loading branch information
vktrrdk committed Nov 10, 2021
1 parent a6e0226 commit 182df67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions VirtualMachineService/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2204,13 +2204,13 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tags, description)
LOG.exception("Create snapshot {0} error: {1}".format(openstack_id, e))

raise conflictException(Reason="409")
return None
except Exception:
LOG.exception("Instance {0} not found".format(openstack_id))
return
return None
try:
snapshot = self.conn.get_image_by_id(snapshot_munch["id"])
snapshot_id = snapshot["id"]
# todo check again
try:
image = self.conn.get_image(name_or_id=snapshot_id)
if description:
Expand All @@ -2222,12 +2222,14 @@ def create_snapshot(self, openstack_id, name, elixir_id, base_tags, description)
self.conn.image.add_tag(image=snapshot_id, tag=tag)
except Exception:
LOG.exception("Tag error catched")
return None
try:
self.conn.image.add_tag(image=snapshot_id, tag=elixir_id)
except Exception:
LOG.exception(
f"Could not add Tag {elixir_id} to Snapshot: {snapshot_id}"
)
return None

return snapshot_id
except Exception as e:
Expand Down

0 comments on commit 182df67

Please sign in to comment.