Make sure that the __proxy__ gets passed all the way into the state system.

This commit is contained in:
C. R. Oldham 2015-10-06 16:58:09 -06:00
parent 4a20d48b35
commit c41e49d8e5
3 changed files with 11 additions and 8 deletions

View file

@ -882,7 +882,7 @@ class Minion(MinionBase):
functions = salt.loader.minion_mods(s_opts, utils=self.utils, proxy=proxy,
loaded_base_name=self.loaded_base_name, notify=notify)
else:
functions = salt.loader.minion_mods(self.opts, utils=self.utils, notify=notify)
functions = salt.loader.minion_mods(self.opts, utils=self.utils, notify=notify, proxy=proxy)
returners = salt.loader.returners(self.opts, functions)
errors = {}
if '_errors' in functions:

View file

@ -681,7 +681,10 @@ def sls(mods,
'{0}.cache.p'.format(kwargs.get('cache_name', 'highstate'))
)
st_ = salt.state.HighState(opts, pillar, kwargs.get('__pub_jid'))
try:
st_ = salt.state.HighState(opts, pillar, kwargs.get('__pub_jid'), proxy=__proxy__)
except NameError:
st_ = salt.state.HighState(opts, pillar, kwargs.get('__pub_jid'))
if kwargs.get('cache'):
if os.path.isfile(cfn):

View file

@ -593,14 +593,14 @@ class State(object):
'''
Class used to execute salt states
'''
def __init__(self, opts, pillar=None, jid=None):
def __init__(self, opts, pillar=None, jid=None, proxy=None):
if 'grains' not in opts:
opts['grains'] = salt.loader.grains(opts)
self.opts = opts
self._pillar_override = pillar
self.opts['pillar'] = self._gather_pillar()
self.state_con = {}
self.load_modules()
self.load_modules(proxy=proxy)
self.active = set()
self.mod_init = set()
self.pre = {}
@ -731,13 +731,13 @@ class State(object):
return ret
return ret
def load_modules(self, data=None):
def load_modules(self, data=None, proxy=None):
'''
Load the modules into the state
'''
log.info('Loading fresh modules for state activity')
self.utils = salt.loader.utils(self.opts)
self.functions = salt.loader.minion_mods(self.opts, self.state_con, utils=self.utils, proxy=self.proxy)
self.functions = salt.loader.minion_mods(self.opts, self.state_con, utils=self.utils, proxy=proxy)
if isinstance(data, dict):
if data.get('provider', False):
if isinstance(data['provider'], str):
@ -3158,11 +3158,11 @@ class HighState(BaseHighState):
# a stack of active HighState objects during a state.highstate run
stack = []
def __init__(self, opts, pillar=None, jid=None):
def __init__(self, opts, pillar=None, jid=None, proxy=None):
self.opts = opts
self.client = salt.fileclient.get_file_client(self.opts)
BaseHighState.__init__(self, opts)
self.state = State(self.opts, pillar, jid)
self.state = State(self.opts, pillar, jid, proxy=proxy)
self.matcher = salt.minion.Matcher(self.opts)
# tracks all pydsl state declarations globally across sls files