Exception cleanup + be a little less verbose when reporting error to master

parent 8516df18
...@@ -263,8 +263,6 @@ class Partition(object): ...@@ -263,8 +263,6 @@ class Partition(object):
""" Creates configuration file from template in software_path, then """ Creates configuration file from template in software_path, then
installs the software partition with the help of buildout installs the software partition with the help of buildout
""" """
# XXX: Shall be no op in case if revision had not changed
# It requires implementation of revision on server
self.logger.info("Installing Computer Partition %s..." \ self.logger.info("Installing Computer Partition %s..." \
% self.computer_partition.getId()) % self.computer_partition.getId())
# Checks existence and permissions of Partition directory # Checks existence and permissions of Partition directory
...@@ -283,7 +281,6 @@ class Partition(object): ...@@ -283,7 +281,6 @@ class Partition(object):
os.environ = utils.getCleanEnvironment(pwd.getpwuid( os.environ = utils.getCleanEnvironment(pwd.getpwuid(
instance_stat_info.st_uid).pw_dir) instance_stat_info.st_uid).pw_dir)
# Generates buildout part from template # Generates buildout part from template
# TODO how to fetch the good template? Naming conventions?
template_location = os.path.join(self.software_path, 'template.cfg') template_location = os.path.join(self.software_path, 'template.cfg')
config_location = os.path.join(self.instance_path, 'buildout.cfg') config_location = os.path.join(self.instance_path, 'buildout.cfg')
self.logger.debug("Copying %r to %r" % (template_location, config_location)) self.logger.debug("Copying %r to %r" % (template_location, config_location))
......
...@@ -627,26 +627,15 @@ class Slapgrid(object): ...@@ -627,26 +627,15 @@ class Slapgrid(object):
local_partition.stop() local_partition.stop()
computer_partition.stopped() computer_partition.stopped()
elif computer_partition_state == "destroyed": elif computer_partition_state == "destroyed":
# Stop, but safely local_partition.stop()
try: try:
local_partition.stop() computer_partition.stopped()
try:
computer_partition.stopped()
except (SystemExit, KeyboardInterrupt):
exception = traceback.format_exc()
computer_partition.error(exception)
raise
except Exception:
pass
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
exception = traceback.format_exc() exception = traceback.format_exc()
computer_partition.error(exception) computer_partition.error(exception)
raise raise
except Exception: except Exception:
clean_run = False pass
exception = traceback.format_exc()
logger.error(exception)
computer_partition.error(exception)
else: else:
error_string = "Computer Partition %r has unsupported state: %s" % \ error_string = "Computer Partition %r has unsupported state: %s" % \
(computer_partition_id, computer_partition_state) (computer_partition_id, computer_partition_state)
...@@ -656,10 +645,9 @@ class Slapgrid(object): ...@@ -656,10 +645,9 @@ class Slapgrid(object):
exception = traceback.format_exc() exception = traceback.format_exc()
computer_partition.error(exception) computer_partition.error(exception)
raise raise
except Exception: except Exception as exception:
clean_run = False clean_run = False
exception = traceback.format_exc() logger.error(traceback.format_exc())
logger.error(exception)
try: try:
computer_partition.error(exception) computer_partition.error(exception)
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
......
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