Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Feb 15, 2024
1 parent 45a8087 commit b6a7cf9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions IM/connectors/OpenNebula.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def finalize(self, vm, last, auth_data):
if vm.id:
one_ver = self.getONEVersion(auth_data)
op = 'terminate'
if one_ver <= Version("4.14.0"):
if Version(one_ver) <= Version("4.14.0"):
op = 'delete'
success, err = server.one.vm.action(session_id, op, int(vm.id))[0:2]
else:
Expand All @@ -587,7 +587,7 @@ def finalize(self, vm, last, auth_data):
if last and success:
one_ver = self.getONEVersion(auth_data)
# Security Groups appears in version 4.12.0
if one_ver >= Version("4.12.0"):
if Version(one_ver) >= Version("4.12.0"):
self.delete_security_groups(vm.inf, auth_data)

return (success, err)
Expand Down Expand Up @@ -1181,7 +1181,7 @@ def create_snapshot(self, vm, disk_num, image_name, auto_delete, auth_data):

image_type = "" # Use the default one
one_ver = self.getONEVersion(auth_data)
if one_ver >= Version("5.0"):
if Version(one_ver) >= Version("5.0"):
success, res_info = server.one.vm.disksaveas(session_id, int(vm.id), disk_num,
image_name, image_type, -1)[0:2]
else:
Expand Down

0 comments on commit b6a7cf9

Please sign in to comment.