From 9ec7c7c620d17bcae5a7b19aaa9800a93c48b60e Mon Sep 17 00:00:00 2001 From: Alejandro del Castillo Date: Wed, 13 Apr 2016 09:04:54 -0500 Subject: [PATCH] Fix salt-call on standalone minion case (#32521) * skip connection error if master_type == disable Signed-off-by: Alejandro del Castillo * fix salt-call when master_type == disable salt-call errors out on salt.pillar.get_pillar if master_type == disable. Skip get_pillar call on standalone minion case. Also skip code that returns job info back to the master. Signed-off-by: Alejandro del Castillo --- salt/cli/caller.py | 4 ++-- salt/minion.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/salt/cli/caller.py b/salt/cli/caller.py index 17da914a00..3cc5192a57 100644 --- a/salt/cli/caller.py +++ b/salt/cli/caller.py @@ -229,7 +229,8 @@ class BaseCaller(object): if isinstance(oput, six.string_types): ret['out'] = oput is_local = self.opts['local'] or self.opts.get( - 'file_client', False) == 'local' + 'file_client', False) == 'local' or self.opts.get( + 'master_type') == 'disable' returners = self.opts.get('return', '').split(',') if (not is_local) or returners: ret['id'] = self.opts['id'] @@ -246,7 +247,6 @@ class BaseCaller(object): pass # return the job infos back up to the respective minion's master - if not is_local: try: mret = ret.copy() diff --git a/salt/minion.py b/salt/minion.py index a474befd7b..7aee32a218 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -628,13 +628,15 @@ class SMinion(MinionBase): ''' Load all of the modules for the minion ''' - self.opts['pillar'] = salt.pillar.get_pillar( - self.opts, - self.opts['grains'], - self.opts['id'], - self.opts['environment'], - pillarenv=self.opts.get('pillarenv'), - ).compile_pillar() + if self.opts.get('master_type') != 'disable': + self.opts['pillar'] = salt.pillar.get_pillar( + self.opts, + self.opts['grains'], + self.opts['id'], + self.opts['environment'], + pillarenv=self.opts.get('pillarenv'), + ).compile_pillar() + self.utils = salt.loader.utils(self.opts) self.functions = salt.loader.minion_mods(self.opts, utils=self.utils, include_errors=True) @@ -2034,7 +2036,7 @@ class Minion(MinionBase): # add handler to subscriber if hasattr(self, 'pub_channel') and self.pub_channel is not None: self.pub_channel.on_recv(self._handle_payload) - else: + elif self.opts.get('master_type') != 'disable': log.error('No connection to master found. Scheduled jobs will not run.') if start: