From 91219d4b8880b3ce9c29e414634809d093ebdecf Mon Sep 17 00:00:00 2001 From: Thomas S Hatch Date: Tue, 27 Mar 2012 22:17:32 -0600 Subject: [PATCH] handle no minions targeted case --- salt/client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/salt/client.py b/salt/client.py index 3c51690513..a7b96f6adc 100644 --- a/salt/client.py +++ b/salt/client.py @@ -189,6 +189,8 @@ class LocalClient(object): if pub_data['jid'] == '0': # Failed to connect to the master and send the pub return {} + elif not pub_data['jid']: + return {} return self.get_returns(pub_data['jid'], pub_data['minions'], timeout) def cmd_cli( @@ -220,6 +222,9 @@ class LocalClient(object): if pub_data['jid'] == '0': print 'Failed to connect to the Master, is the Salt Master running?' yield {} + elif not pub_data['jid']: + print 'No minions match the target' + yield {} else: for fn_ret in self.get_cli_returns(pub_data['jid'], pub_data['minions'], @@ -259,6 +264,8 @@ class LocalClient(object): if pub_data['jid'] == '0': # Failed to connect to the master and send the pub yield {} + elif not pub_data['jid']: + yield {} else: for fn_ret in self.get_iter_returns(pub_data['jid'], pub_data['minions'], @@ -295,6 +302,8 @@ class LocalClient(object): if pub_data['jid'] == '0': # Failed to connect to the master and send the pub yield {} + elif not pub_data['jid']: + yield {} else: for fn_ret in self.get_iter_returns(pub_data['jid'], pub_data['minions'], @@ -329,6 +338,8 @@ class LocalClient(object): if pub_data['jid'] == '0': # Failed to connect to the master and send the pub return {} + elif not pub_data['jid']: + return {} return (self.get_returns(pub_data['jid'], pub_data['minions'], timeout))