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

Commit

Permalink
Merge pull request #515 from deNBI/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
dweinholz authored Nov 9, 2020
2 parents b5a485d + 2f15143 commit e01452f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions VirtualMachineService/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class VirtualMachineHandler(Iface):
BUILD = "BUILD"
ACTIVE = "ACTIVE"
ERROR = "ERROR"
NOT_FOUND = "NOT FOUND"
PREPARE_PLAYBOOK_BUILD = "PREPARE_PLAYBOOK_BUILD"
BUILD_PLAYBOOK = "BUILD_PLAYBOOK"
PLAYBOOK_FAILED = "PLAYBOOK_FAILED"
Expand Down Expand Up @@ -599,7 +600,7 @@ def get_server(self, openstack_id):
server = self.conn.compute.get_server(openstack_id)
except Exception as e:
LOG.exception("No Server found {0} | Error {1}".format(openstack_id, e))
return VM(status="NOT FOUND")
return VM(status=self.NOT_FOUND)

serv = server.to_dict()

Expand Down Expand Up @@ -1729,10 +1730,12 @@ def check_server_status(self, openstack_id):
server = self.conn.compute.get_server(openstack_id)
except Exception:
LOG.exception("No Server with id {0} ".format(openstack_id))
return None
return VM(status=self.NOT_FOUND)

if server is None:
LOG.exception("No Server with id {0} ".format(openstack_id))
return None
return VM(status=self.NOT_FOUND)

serv = server.to_dict()

try:
Expand Down Expand Up @@ -1785,7 +1788,7 @@ def check_server_status(self, openstack_id):
return server
except Exception as e:
LOG.exception("Check Status VM {0} error: {1}".format(openstack_id, e))
return None
return VM(status=self.ERROR)

def openstack_server_to_thrift_server(self, server):
LOG.info("Convert server {} to thrift server".format(server))
Expand Down

0 comments on commit e01452f

Please sign in to comment.