From a481be41df7a8ee7a81b5ddca8d2fa6fb2b3d6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com> Date: Thu, 9 Aug 2012 12:18:56 +0200 Subject: [PATCH] We don't care about creating (and possibly fetching informations to server) Partition object if we don't do anythign with it. --- slapos/grid/slapgrid.py | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/slapos/grid/slapgrid.py b/slapos/grid/slapgrid.py index d0ce86569..aa3b53f4d 100644 --- a/slapos/grid/slapgrid.py +++ b/slapos/grid/slapgrid.py @@ -944,26 +944,26 @@ class Slapgrid(object): software_url = computer_partition.getSoftwareRelease().getURI() except NotFoundError: software_url = None - software_path = os.path.join(self.software_root, - getSoftwareUrlHash(software_url)) - local_partition = Partition( - software_path=software_path, - instance_path=os.path.join(self.instance_root, - computer_partition.getId()), - supervisord_partition_configuration_path=os.path.join( - self.supervisord_configuration_directory, '%s.conf' % - computer_partition_id), - supervisord_socket=self.supervisord_socket, - computer_partition=computer_partition, - computer_id=self.computer_id, - partition_id=computer_partition_id, - server_url=self.master_url, - software_release_url=software_url, - certificate_repository_path=self.certificate_repository_path, - console=self.console, buildout=self.buildout - ) if computer_partition.getState() == "destroyed": try: + software_path = os.path.join(self.software_root, + getSoftwareUrlHash(software_url)) + local_partition = Partition( + software_path=software_path, + instance_path=os.path.join(self.instance_root, + computer_partition.getId()), + supervisord_partition_configuration_path=os.path.join( + self.supervisord_configuration_directory, '%s.conf' % + computer_partition_id), + supervisord_socket=self.supervisord_socket, + computer_partition=computer_partition, + computer_id=self.computer_id, + partition_id=computer_partition_id, + server_url=self.master_url, + software_release_url=software_url, + certificate_repository_path=self.certificate_repository_path, + console=self.console, buildout=self.buildout + ) local_partition.stop() try: computer_partition.stopped() @@ -973,6 +973,11 @@ class Slapgrid(object): raise except Exception: 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): exception = traceback.format_exc() computer_partition.error(exception) @@ -982,11 +987,6 @@ class Slapgrid(object): exception = traceback.format_exc() computer_partition.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: computer_partition.destroyed() except slap.NotFoundError: -- 2.30.9