From ab39a7bde2d44c80f53fa96e30d27a8aa17c1cc0 Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Fri, 16 Mar 2018 10:58:40 -0600 Subject: [PATCH] handle runners and wheel clients that return as a dict without 'data' --- scripts/pepper | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/pepper b/scripts/pepper index 3c49d9a..9d9c137 100755 --- a/scripts/pepper +++ b/scripts/pepper @@ -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 @@ -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},