From 4e2fee17cc7c3d4491c7ac8c73ffc0d6b36cc2ed Mon Sep 17 00:00:00 2001 From: Mike Place Date: Fri, 24 Jul 2015 15:18:58 -0600 Subject: [PATCH 1/2] Display warning when progressbar can't be loaded Closes #25435 --- salt/cli/salt.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/salt/cli/salt.py b/salt/cli/salt.py index 9335103e2b..af7f36b856 100644 --- a/salt/cli/salt.py +++ b/salt/cli/salt.py @@ -179,7 +179,10 @@ class SaltCMD(parsers.SaltCMDOptionParser): ret = {} for progress in cmd_func(**kwargs): out = 'progress' - self._progress_ret(progress, out) + try: + self._progress_ret(progress, out) + except salt.exceptions.LoaderError as exc: + raise salt.exceptions.SaltSystemExit(exc) if 'return_count' not in progress: ret.update(progress) self._progress_end(out) @@ -272,7 +275,11 @@ class SaltCMD(parsers.SaltCMDOptionParser): import salt.output # Get the progress bar if not hasattr(self, 'progress_bar'): - self.progress_bar = salt.output.get_progress(self.config, out, progress) + try: + self.progress_bar = salt.output.get_progress(self.config, out, progress) + except Exception as exc: + raise salt.exceptions.LoaderError('\nWARNING: Install the `progressbar` python package. ' + 'Requested job was still run but output cannot be displayed.\n') salt.output.update_progress(self.config, progress, self.progress_bar, out) def _output_ret(self, ret, out): From 44f34684efef778a060757a4b0318e76724ac050 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Fri, 24 Jul 2015 15:20:56 -0600 Subject: [PATCH 2/2] Included note in help docs --- salt/utils/parsers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index 9fbf47cfbf..ba5fe6717c 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -1485,7 +1485,7 @@ class SaltCMDOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn, '-p', '--progress', default=False, action='store_true', - help=('Display a progress graph') + help=('Display a progress graph. [Requires `progressbar` python package.]') ) self.add_option( '--failhard',