diff --git a/heat/engine/environment.py b/heat/engine/environment.py index 7a29290d8b..5d1eae3e41 100644 --- a/heat/engine/environment.py +++ b/heat/engine/environment.py @@ -820,9 +820,8 @@ def read_global_environment(env, env_dir=None): try: env_files = glob.glob(os.path.join(env_dir, '*')) - except OSError as osex: - LOG.error(_LE('Failed to read %s'), env_dir) - LOG.exception(osex) + except OSError: + LOG.exception(_LE('Failed to read %s'), env_dir) return for file_path in env_files: @@ -832,11 +831,7 @@ def read_global_environment(env, env_dir=None): env_body = env_fmt.parse(env_fd.read()) env_fmt.default_for_missing(env_body) env.load(env_body) - except ValueError as vex: - LOG.error(_LE('Failed to parse %(file_path)s'), { - 'file_path': file_path}) - LOG.exception(vex) - except IOError as ioex: - LOG.error(_LE('Failed to read %(file_path)s'), { - 'file_path': file_path}) - LOG.exception(ioex) + except ValueError: + LOG.exception(_LE('Failed to parse %s'), file_path) + except IOError: + LOG.exception(_LE('Failed to read %s'), file_path) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index d679676db9..9ffc2c9bd0 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -168,11 +168,12 @@ class Resource(object): try: svc_available = cls.is_service_available(context) except Exception as exc: + LOG.exception(_LE("Resource type %s unavailable"), + resource_type) ex = exception.ResourceTypeUnavailable( resource_type=resource_type, service_name=cls.default_client_name, reason=six.text_type(exc)) - LOG.exception(exc) raise ex else: if not svc_available: diff --git a/heat/engine/resources/openstack/nova/server.py b/heat/engine/resources/openstack/nova/server.py index 6edad44ef5..4336d6af98 100644 --- a/heat/engine/resources/openstack/nova/server.py +++ b/heat/engine/resources/openstack/nova/server.py @@ -1246,15 +1246,16 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin, self.context, sd['id']) self.rpc_client().delete_software_config( self.context, sc['id']) - except Exception as e: + except Exception: # Updating the software config transport is on a best-effort # basis as any raised exception here would result in the resource # going into an ERROR state, which will be replaced on the next # stack update. This is not desirable for a server. The old # transport will continue to work, and the new transport may work # despite exceptions in the above block. - LOG.error(_LE('Error while updating software config transport')) - LOG.exception(e) + LOG.exception( + _LE('Error while updating software config transport') + ) def check_update_complete(self, updaters): """Push all updaters to completion in list order.""" diff --git a/heat/engine/stack.py b/heat/engine/stack.py index 37e15565c3..833e95a19d 100644 --- a/heat/engine/stack.py +++ b/heat/engine/stack.py @@ -1564,14 +1564,12 @@ class Stack(collections.Mapping): # There are cases where the user_creds cannot be returned # due to credentials truncated when being saved to DB. # Ignore this error instead of blocking stack deletion. - user_creds = None try: - user_creds = ucreds_object.UserCreds.get_by_id( - self.context, self.user_creds_id) - except exception.Error as err: - LOG.exception(err) - pass - return user_creds + return ucreds_object.UserCreds.get_by_id(self.context, + self.user_creds_id) + except exception.Error: + LOG.exception(_LE("Failed to retrieve user_creds")) + return None def _delete_credentials(self, stack_status, reason, abandon): # Cleanup stored user_creds so they aren't accessible via @@ -1601,7 +1599,7 @@ class Stack(collections.Mapping): self.clients.client('keystone').delete_trust( trust_id) except Exception as ex: - LOG.exception(ex) + LOG.exception(_LE("Error deleting trust")) stack_status = self.FAILED reason = ("Error deleting trust: %s" % six.text_type(ex)) @@ -1629,7 +1627,7 @@ class Stack(collections.Mapping): keystone.delete_stack_domain_project( project_id=self.stack_user_project_id) except Exception as ex: - LOG.exception(ex) + LOG.exception(_LE("Error deleting project")) stack_status = self.FAILED reason = "Error deleting project: %s" % six.text_type(ex) diff --git a/heat_integrationtests/scenario/test_volumes.py b/heat_integrationtests/scenario/test_volumes.py index 7980d81db3..603c8f2117 100644 --- a/heat_integrationtests/scenario/test_volumes.py +++ b/heat_integrationtests/scenario/test_volumes.py @@ -77,9 +77,8 @@ class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase): template_name='test_volumes_create_from_backup.yaml', add_parameters={'backup_id': backup.id}) stack2 = self.client.stacks.get(stack_identifier2) - except exceptions.StackBuildErrorException as e: - LOG.error("Halting test due to bug: #1382300") - LOG.exception(e) + except exceptions.StackBuildErrorException: + LOG.exception("Halting test due to bug: #1382300") return # Verify with cinder that the volume exists, with matching details