Flip the sense of the test for items (modules, etc) loaded by the proxy. Now load everything a regular minion would load, and only check to make sure __proxyenabled__ is present for proxymodules and grains

This commit is contained in:
C. R. Oldham 2016-01-12 15:02:31 -07:00
parent 00c4ef6ec2
commit db8a281ab8
3 changed files with 15 additions and 7 deletions

View file

@ -1224,7 +1224,7 @@ class LazyLoader(salt.utils.lazy.LazyDict):
#
# Render modules and state modules are OK though
if 'proxy' in self.opts:
if self.tag not in ['render', 'states', 'utils']:
if self.tag in ['grains', 'proxy']:
if not hasattr(mod, '__proxyenabled__') or \
(self.opts['proxy']['proxytype'] not in mod.__proxyenabled__ and
'*' not in mod.__proxyenabled__):

View file

@ -1374,6 +1374,11 @@ class Minion(MinionBase):
log.debug('Refreshing modules. Notify={0}'.format(notify))
if hasattr(self, 'proxy'):
self.functions, self.returners, _ = self._load_modules(force_refresh, notify=notify, proxy=self.proxy)
# Proxies have a chicken-and-egg problem. Usually we load grains early
# in the setup process, but we can't load grains for proxies until
# we talk to the device we are proxying for. So reload the grains
# functions here, and then force a grains sync here
self.functions['saltutil.sync_grains'](saltenv='base')
else:
self.functions, self.returners, _ = self._load_modules(force_refresh, notify=notify)
@ -2554,11 +2559,11 @@ class ProxyMinion(Minion):
self.opts['master'] = master
self.opts['pillar'] = yield salt.pillar.get_async_pillar(
self.opts,
self.opts['grains'],
self.opts['id'],
self.opts['environment'],
pillarenv=self.opts.get('pillarenv'),
self.opts,
self.opts['grains'],
self.opts['id'],
self.opts['environment'],
pillarenv=self.opts.get('pillarenv'),
).compile_pillar()
if 'proxy' not in self.opts['pillar']:
@ -2584,6 +2589,7 @@ class ProxyMinion(Minion):
self.functions.pack['__proxy__'] = self.proxy
self.proxy.pack['__salt__'] = self.functions
self.proxy.pack['__ret__'] = self.returners
self.proxy.pack['__pillar__'] = self.opts['pillar']
if ('{0}.init'.format(fq_proxyname) not in self.proxy
or '{0}.shutdown'.format(fq_proxyname) not in self.proxy):
@ -2598,7 +2604,7 @@ class ProxyMinion(Minion):
# Proxies have a chicken-and-egg problem. Usually we load grains early
# in the setup process, but we can't load grains for proxies until
# we talk to the device we are proxying for. So reload the grains
# functions here, and then force a grains sync.
# functions here, and then force a grains sync in modules_refresh
self.opts['grains'] = salt.loader.grains(self.opts, force_refresh=True)
# Check config 'add_proxymodule_to_opts' Remove this in Boron.
@ -2645,3 +2651,4 @@ class ProxyMinion(Minion):
}, persist=True)
self.grains_cache = self.opts['grains']

View file

@ -3563,6 +3563,7 @@ def add_host_to_vsphere(host, username, password, vsphere_protocol=None,
ret[host_name].update({'status': False})
host_ref = _get_host_ref(service_instance, host, host_name)
def add_host_to_dvs(host, username, password, vmknic_name, vmnic_name,
dvs_name, portgroup_name, protocol=None, port=None,
host_names=None):