More places where salt.state.State needs a proxy param, sysmod had wrong __proxyenabled__, core grains were checking for proxy the wrong way.

This commit is contained in:
C. R. Oldham 2015-10-09 18:35:16 -06:00
parent ed23f36279
commit 37c145bcd5
3 changed files with 31 additions and 18 deletions

View file

@ -1366,7 +1366,7 @@ def locale_info():
grains = {}
grains['locale_info'] = {}
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return grains
try:
@ -1395,7 +1395,7 @@ def hostname():
# domain
grains = {}
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return grains
grains['localhost'] = socket.gethostname()
@ -1411,7 +1411,7 @@ def append_domain():
grain = {}
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return grain
if 'append_domain' in __opts__:
@ -1424,7 +1424,7 @@ def ip4():
Return a list of ipv4 addrs
'''
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
return {'ipv4': salt.utils.network.ip_addrs(include_loopback=True)}
@ -1435,7 +1435,7 @@ def fqdn_ip4():
Return a list of ipv4 addrs of fqdn
'''
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
try:
@ -1451,7 +1451,7 @@ def ip6():
Return a list of ipv6 addrs
'''
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
return {'ipv6': salt.utils.network.ip_addrs6(include_loopback=True)}
@ -1462,7 +1462,7 @@ def fqdn_ip6():
Return a list of ipv6 addrs of fqdn
'''
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
try:
@ -1480,7 +1480,7 @@ def ip_interfaces():
# Provides:
# ip_interfaces
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
ret = {}
@ -1507,7 +1507,7 @@ def ip4_interfaces():
# Provides:
# ip_interfaces
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
ret = {}
@ -1531,7 +1531,7 @@ def ip6_interfaces():
# Provides:
# ip_interfaces
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
ret = {}
@ -1674,7 +1674,7 @@ def _hw_data(osdata):
.. versionadded:: 0.9.5
'''
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
grains = {}
@ -1763,7 +1763,7 @@ def _smartos_zone_data():
# hypervisor_uuid
# datacenter
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
grains = {}
@ -1815,7 +1815,7 @@ def get_server_id():
# Provides:
# server_id
if 'proxyminion' in __opts__:
if salt.utils.is_proxy():
return {}
return {'server_id': abs(hash(__opts__.get('id', '')) % (2 ** 31))}

View file

@ -183,7 +183,10 @@ def low(data, queue=False, **kwargs):
conflict = _check_queue(queue, kwargs)
if conflict is not None:
return conflict
st_ = salt.state.State(__opts__)
try:
st_ = salt.state.State(__opts__, proxy=__proxy__)
except NameError:
st_ = salt.state.State(__opts__)
err = st_.verify_data(data)
if err:
__context__['retcode'] = 1
@ -224,7 +227,11 @@ def high(data, test=False, queue=False, **kwargs):
raise SaltInvocationError(
'Pillar data must be formatted as a dictionary'
)
st_ = salt.state.State(__opts__, pillar)
try:
st_ = salt.state.State(__opts__, pillar, proxy=__proxy__)
except NameError:
st_ = salt.state.State(__opts__, pillar)
ret = st_.call_high(data)
_set_retcode(ret)
return ret
@ -283,7 +290,10 @@ def template_str(tem, queue=False, **kwargs):
conflict = _check_queue(queue, kwargs)
if conflict is not None:
return conflict
st_ = salt.state.State(__opts__)
try:
st_ = salt.state.State(__opts__, proxy=__proxy__)
except NameError:
st_ = salt.state.State(__opts__)
ret = st_.call_template_str(tem)
_set_retcode(ret)
return ret
@ -1111,7 +1121,10 @@ def single(fun, name, test=None, queue=False, **kwargs):
'Pillar data must be formatted as a dictionary'
)
st_ = salt.state.State(opts, pillar)
try:
st_ = salt.state.State(opts, pillar, proxy=__proxy__)
except NameError:
st_ = salt.state.State(opts, pillar)
err = st_.verify_data(kwargs)
if err:
__context__['retcode'] = 1

View file

@ -23,7 +23,7 @@ log = logging.getLogger(__name__)
# Define the module's virtual name
__virtualname__ = 'sys'
__proxyenabled__ = '*'
__proxyenabled__ = ['*']
def __virtual__():