diff --git a/gbpclient/gbp/v2_0/purge.py b/gbpclient/gbp/v2_0/purge.py index f364eea..3668d15 100644 --- a/gbpclient/gbp/v2_0/purge.py +++ b/gbpclient/gbp/v2_0/purge.py @@ -11,6 +11,7 @@ # under the License. # +import errno import re import sys @@ -73,12 +74,14 @@ class Purge(n_purge.Purge): sys.stdout.write("\rPurging resources: %d%% complete." % percent_complete) sys.stdout.flush() - except Exception: + except IOError as e: # A broken pipe IOError exception might get thrown if # invoked from our MD's keystone tenant delete handler # code. We should just ignore that then continue to # purge the rest of the resources. - continue + if e.errno == errno.EPIPE: + continue + return (deleted, failed, failures) def take_action(self, parsed_args): diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index e279159..51a912d 100644 --- a/tools/install_venv_common.py +++ b/tools/install_venv_common.py @@ -26,7 +26,7 @@ from __future__ import print_function import optparse import os -import subprocess +import subprocess # nosec import sys @@ -61,7 +61,7 @@ class InstallVenv(object): else: stdout = None - proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout) + proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout) # nosec output = proc.communicate()[0] if check_exit_code and proc.returncode != 0: self.die('Command "%s" failed.\n%s', ' '.join(cmd), output)