Skip to content

Commit

Permalink
only load opts if salt is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
gtmanfred committed May 17, 2018
1 parent ab39a7b commit 5a486e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/pepper
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ logger.addHandler(NullHandler())
class Pepper(object):
def __init__(self):
self.cli = PepperCli()
self.opts = salt.config.client_config(self.cli.options.master)
if HAS_SALT:
self.opts = salt.config.client_config(self.cli.options.master)
else:
self.opts = {}

@property
def output(self):
Expand All @@ -48,7 +51,7 @@ class Pepper(object):
def __call__(self):
try:
for exit_code, result in self.cli.run():
if HAS_SALT:
if HAS_SALT and self.opts:
logger.info('Use Salt outputters')
for ret in json.loads(result)['return']:
if isinstance(ret, dict):
Expand Down

0 comments on commit 5a486e9

Please sign in to comment.