Display warning when progressbar can't be loaded

Closes #25435
This commit is contained in:
Mike Place 2015-07-24 15:18:58 -06:00
parent ea0d295d49
commit 4e2fee17cc

View File

@ -179,7 +179,10 @@ class SaltCMD(parsers.SaltCMDOptionParser):
ret = {} ret = {}
for progress in cmd_func(**kwargs): for progress in cmd_func(**kwargs):
out = 'progress' 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: if 'return_count' not in progress:
ret.update(progress) ret.update(progress)
self._progress_end(out) self._progress_end(out)
@ -272,7 +275,11 @@ class SaltCMD(parsers.SaltCMDOptionParser):
import salt.output import salt.output
# Get the progress bar # Get the progress bar
if not hasattr(self, '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) salt.output.update_progress(self.config, progress, self.progress_bar, out)
def _output_ret(self, ret, out): def _output_ret(self, ret, out):