Skip to content

Commit

Permalink
handle runners and wheel clients that return as a dict without 'data'
Browse files Browse the repository at this point in the history
  • Loading branch information
gtmanfred committed Mar 16, 2018
1 parent 7496b75 commit ab39a7b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions scripts/pepper
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ class Pepper(object):
logger.info('Use Salt outputters')
for ret in json.loads(result)['return']:
if isinstance(ret, dict):
if 'data' in ret:
salt.output.display_output(
ret['data'],
self.cli.options.output or ret.get('outputter', 'nested'),
opts=self.opts
)
else:
if self.cli.options.client == 'local':
for minionid, minionret in ret.items():
if isinstance(minionret, dict) and 'ret' in minionret:
# version >= 2017.7
Expand All @@ -73,6 +67,18 @@ class Pepper(object):
self.cli.options.output or self.output,
opts=self.opts
)
elif 'data' in ret:
salt.output.display_output(
ret['data'],
self.cli.options.output or ret.get('outputter', 'nested'),
opts=self.opts
)
else:
salt.output.display_output(
{self.cli.options.client: ret},
self.cli.options.output or ret.get('outputter', 'nested'),
opts=self.opts
)
else:
salt.output.display_output(
{self.cli.options.client: ret},
Expand Down

0 comments on commit ab39a7b

Please sign in to comment.