Commit 985c7417 authored by Marco Mariani's avatar Marco Mariani

removed short lived string objects

parent 782aad7a
...@@ -236,10 +236,8 @@ class Software(object): ...@@ -236,10 +236,8 @@ class Software(object):
else: else:
self.logger.info('Path %r does not exists, no need to remove.' % self.logger.info('Path %r does not exists, no need to remove.' %
self.software_path) self.software_path)
except IOError as error: except IOError as exc:
error_string = "I/O error while removing software (%s): %s" % (self.url, raise IOError("I/O error while removing software (%s): %s" % (self.url, exc))
error)
raise IOError(error_string)
class Partition(object): class Partition(object):
...@@ -368,10 +366,10 @@ class Partition(object): ...@@ -368,10 +366,10 @@ class Partition(object):
self.logger.debug("Copying %r to %r" % (template_location, config_location)) self.logger.debug("Copying %r to %r" % (template_location, config_location))
try: try:
shutil.copy(template_location, config_location) shutil.copy(template_location, config_location)
except IOError as e: except IOError as exc:
# Template not found on SR, we notify user. # Template not found on SR, we notify user.
raise IOError('Software Release %s is not correctly installed.\n' raise IOError('Software Release %s is not correctly installed.\n%s' % (
'%s' % (self.software_release_url, e)) self.software_release_url, exc))
# fill generated buildout with additional information # fill generated buildout with additional information
buildout_text = open(config_location).read() buildout_text = open(config_location).read()
buildout_text += '\n\n' + pkg_resources.resource_string(__name__, buildout_text += '\n\n' + pkg_resources.resource_string(__name__,
...@@ -480,8 +478,8 @@ class Partition(object): ...@@ -480,8 +478,8 @@ class Partition(object):
partition_id = self.computer_partition.getId() partition_id = self.computer_partition.getId()
try: try:
supervisor.startProcessGroup(partition_id, False) supervisor.startProcessGroup(partition_id, False)
except xmlrpclib.Fault as e: except xmlrpclib.Fault as exc:
if e.faultString.startswith('BAD_NAME:'): if exc.faultString.startswith('BAD_NAME:'):
self.logger.info("Nothing to start on %s..." % self.logger.info("Nothing to start on %s..." %
self.computer_partition.getId()) self.computer_partition.getId())
else: else:
...@@ -493,8 +491,8 @@ class Partition(object): ...@@ -493,8 +491,8 @@ class Partition(object):
try: try:
supervisor = self.getSupervisorRPC() supervisor = self.getSupervisorRPC()
supervisor.stopProcessGroup(partition_id, False) supervisor.stopProcessGroup(partition_id, False)
except xmlrpclib.Fault as e: except xmlrpclib.Fault as exc:
if e.faultString.startswith('BAD_NAME:'): if exc.faultString.startswith('BAD_NAME:'):
self.logger.info('Partition %s not known in supervisord, ignoring' % partition_id) self.logger.info('Partition %s not known in supervisord, ignoring' % partition_id)
else: else:
self.logger.info("Requested stop of %s..." % self.computer_partition.getId()) self.logger.info("Requested stop of %s..." % self.computer_partition.getId())
...@@ -541,10 +539,8 @@ class Partition(object): ...@@ -541,10 +539,8 @@ class Partition(object):
if os.path.exists(self.supervisord_partition_configuration_path): if os.path.exists(self.supervisord_partition_configuration_path):
os.remove(self.supervisord_partition_configuration_path) os.remove(self.supervisord_partition_configuration_path)
self.updateSupervisor() self.updateSupervisor()
except IOError as error: except IOError as exc:
error_string = "I/O error while freeing partition (%s): %s" \ raise IOError("I/O error while freeing partition (%s): %s" % (self.instance_path, exc))
% (self.instance_path, error)
raise IOError(error_string)
def fetchInformations(self): def fetchInformations(self):
"""Fetch usage informations with buildout, returns it. """Fetch usage informations with buildout, returns it.
......
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