Fix salt-call on standalone minion case (#32521)

* skip connection error if master_type == disable

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>

* 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 <alejandro.delcastillo@ni.com>
This commit is contained in:
Alejandro del Castillo 2016-04-13 09:04:54 -05:00 committed by Mike Place
parent bb4d47dc93
commit 9ec7c7c620
2 changed files with 12 additions and 10 deletions

View File

@ -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()

View File

@ -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: