We don't care about creating (and possibly fetching informations to server)...

We don't care about creating (and possibly fetching informations to server) Partition object if we don't do anythign with it.
parent c155196f
...@@ -944,6 +944,8 @@ class Slapgrid(object): ...@@ -944,6 +944,8 @@ class Slapgrid(object):
software_url = computer_partition.getSoftwareRelease().getURI() software_url = computer_partition.getSoftwareRelease().getURI()
except NotFoundError: except NotFoundError:
software_url = None software_url = None
if computer_partition.getState() == "destroyed":
try:
software_path = os.path.join(self.software_root, software_path = os.path.join(self.software_root,
getSoftwareUrlHash(software_url)) getSoftwareUrlHash(software_url))
local_partition = Partition( local_partition = Partition(
...@@ -962,8 +964,6 @@ class Slapgrid(object): ...@@ -962,8 +964,6 @@ class Slapgrid(object):
certificate_repository_path=self.certificate_repository_path, certificate_repository_path=self.certificate_repository_path,
console=self.console, buildout=self.buildout console=self.console, buildout=self.buildout
) )
if computer_partition.getState() == "destroyed":
try:
local_partition.stop() local_partition.stop()
try: try:
computer_partition.stopped() computer_partition.stopped()
...@@ -973,6 +973,11 @@ class Slapgrid(object): ...@@ -973,6 +973,11 @@ class Slapgrid(object):
raise raise
except Exception: except Exception:
pass pass
if computer_partition.getId() in report_usage_issue_cp_list:
logger.info('Ignoring destruction of %r, as not report usage was '
'sent' % computer_partition.getId())
continue
local_partition.destroy()
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
exception = traceback.format_exc() exception = traceback.format_exc()
computer_partition.error(exception) computer_partition.error(exception)
...@@ -982,11 +987,6 @@ class Slapgrid(object): ...@@ -982,11 +987,6 @@ class Slapgrid(object):
exception = traceback.format_exc() exception = traceback.format_exc()
computer_partition.error(exception) computer_partition.error(exception)
logger.error(exception) logger.error(exception)
if computer_partition.getId() in report_usage_issue_cp_list:
logger.info('Ignoring destruction of %r, as not report usage was '
'sent' % computer_partition.getId())
continue
local_partition.destroy()
try: try:
computer_partition.destroyed() computer_partition.destroyed()
except slap.NotFoundError: except slap.NotFoundError:
......
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