Merge pull request #32178 from rallytime/merge-2016.3

[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
Nicole Thomas 2016-03-28 12:58:28 -06:00
commit be7277d338
10 changed files with 58 additions and 26 deletions

View File

@ -60,16 +60,16 @@ provide an ``interval`` argument to a beacon. The following beacons run on
/opt: {}
interval: 5
load:
- 1m:
1m:
- 0.0
- 2.0
- 5m:
5m:
- 0.0
- 1.5
- 15m:
15m:
- 0.1
- 1.0
- interval: 10
interval: 10
Avoiding Event Loops
--------------------

View File

@ -44,6 +44,7 @@ Available in
- Execution Modules
- State Modules
- Returners
- Runners
``__salt__`` contains the execution module functions. This allows for all
functions to be called as they have been set up by the salt loader.
@ -53,6 +54,11 @@ functions to be called as they have been set up by the salt loader.
__salt__['cmd.run']('fdisk -l')
__salt__['network.ip_addrs']()
.. note::
When used in runners, ``__salt__`` references other runner modules, and not
execution modules.
__grains__
----------

View File

@ -690,6 +690,8 @@ class LocalClient(object):
continue
yield fn_ret
self._clean_up_subscriptions(pub_data['jid'])
def cmd_iter_no_block(
self,
tgt,
@ -744,6 +746,8 @@ class LocalClient(object):
**kwargs):
yield fn_ret
self._clean_up_subscriptions(pub_data['jid'])
def cmd_full_return(
self,
tgt,
@ -825,6 +829,7 @@ class LocalClient(object):
found.update(set(event))
yield event
if len(found.intersection(minions)) >= len(minions):
self._clean_up_subscriptions(jid)
raise StopIteration()
# TODO: tests!!
@ -974,6 +979,8 @@ class LocalClient(object):
for raw in jinfo_iter:
# if there are no more events, lets stop waiting for the jinfo
if raw is None:
self.event.unsubscribe(jinfo['jid'])
jinfo_iter = []
break
# TODO: move to a library??
@ -1240,6 +1247,8 @@ class LocalClient(object):
}
break
time.sleep(0.01)
self._clean_up_subscriptions(jid)
return ret
def get_cli_event_returns(
@ -1299,6 +1308,8 @@ class LocalClient(object):
else:
yield {id_: min_ret}
self._clean_up_subscriptions(jid)
def get_event_iter_returns(self, jid, minions, timeout=None):
'''
Gather the return data from the event system, break hard when timeout
@ -1600,6 +1611,11 @@ class LocalClient(object):
# The call below will take care of calling 'self.event.destroy()'
del self.event
def _clean_up_subscriptions(self, job_id):
if self.opts.get('order_masters'):
self.event.unsubscribe('syndic/.*/{0}'.format(job_id), 'regex')
self.event.unsubscribe('salt/job/{0}'.format(job_id))
class FunctionWrapper(dict):
'''

View File

@ -39,7 +39,7 @@ minion or master config. Avoid storing the config in pillars!
cat /etc/salt/master.d/nacl.conf
nacl.config:
key: None
key: 'cKEzd4kXsbeCE7/nLTIqXwnUiD1ulg4NoeeYcCFpd9k='
keyfile: /root/.nacl
When the key is defined in the master config you can use it from the nacl runner:

View File

@ -67,18 +67,22 @@ def __virtual__():
else:
return (False, 'Cannot load rh_service module on SUSE > 11')
try:
osrelease = float(__grains__.get('osrelease', 0))
except ValueError:
return (False, 'Cannot load rh_service module: '
'osrelease grain, {0}, not a float,'.format(osrelease))
osrelease_major = __grains__.get('osrelease_info', [0])[0]
if __grains__['os'] == 'Fedora':
if osrelease > 15:
return (False, 'Cannot load rh_service module on Fedora >= 15')
if osrelease_major >= 15:
return (
False,
'Fedora >= 15 uses systemd, will not load rh_service.py '
'as virtual \'service\''
)
if __grains__['os'] in ('RedHat', 'CentOS', 'ScientificLinux', 'OEL'):
if osrelease >= 7:
return (False, 'Cannot load rh_service module on RedHat >= 7')
if osrelease_major >= 7:
return (
False,
'RedHat-based distros >= version 7 use systemd, will not '
'load rh_service.py as virtual \'service\''
)
return __virtualname__
return (False, 'Cannot load rh_service module: OS not in {0}'.format(enable))

View File

@ -771,6 +771,10 @@ class LowDataAdapter(object):
for chunk in lowstate:
if token:
chunk['token'] = token
if cherrypy.session.get('user'):
chunk['__current_eauth_user'] = cherrypy.session.get('user')
if cherrypy.session.get('groups'):
chunk['__current_eauth_groups'] = cherrypy.session.get('groups')
if client:
chunk['client'] = client
@ -1512,6 +1516,9 @@ class Login(LowDataAdapter):
cherrypy.response.headers['X-Auth-Token'] = cherrypy.session.id
cherrypy.session['token'] = token['token']
cherrypy.session['timeout'] = (token['expire'] - token['start']) / 60
cherrypy.session['user'] = token['name']
if 'groups' in token:
cherrypy.session['groups'] = token['groups']
# Grab eauth config for the current backend for the current user
try:

View File

@ -15,7 +15,7 @@ so your users can create encrypted passwords using the runner nacl:
cat /etc/salt/master.d/nacl.conf
nacl.config:
key: None
key: 'cKEzd4kXsbeCE7/nLTIqXwnUiD1ulg4NoeeYcCFpd9k='
keyfile: /root/.nacl
Now with the config in the master you can use the runner nacl like:

View File

@ -22,8 +22,8 @@ Control the alternatives system
hadoop-0.20-conf:
alternatives.remove:
- name: hadoop-0.20-conf
- path: {{ my_hadoop_conf }}
- name: hadoop-0.20-conf
- path: {{ my_hadoop_conf }}
'''

View File

@ -1297,8 +1297,8 @@ def managed(name,
/path/to/file2:
file.managed:
- contents: |
This is line 1
This is line 2
This is line 1
This is line 2
contents_pillar
@ -1331,12 +1331,12 @@ def managed(name,
userdata:
deployer:
id_rsa: |
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAoQiwO3JhBquPAalQF9qP1lLZNXVjYMIswrMe2HcWUVBgh+vY
U7sCwx/dH6+VvNwmCoqmNnP+8gTPKGl1vgAObJAnMT623dMXjVKwnEagZPRJIxDy
B/HaAre9euNiY3LvIzBTWRSeMfT+rWvIKVBpvwlgGrfgz70m0pqxu+UyFbAGLin+
GpxzZAMaFpZw4sSbIlRuissXZj/sHpQb8p9M5IeO4Z3rjkCP1cxI
-----END RSA PRIVATE KEY-----
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAoQiwO3JhBquPAalQF9qP1lLZNXVjYMIswrMe2HcWUVBgh+vY
U7sCwx/dH6+VvNwmCoqmNnP+8gTPKGl1vgAObJAnMT623dMXjVKwnEagZPRJIxDy
B/HaAre9euNiY3LvIzBTWRSeMfT+rWvIKVBpvwlgGrfgz70m0pqxu+UyFbAGLin+
GpxzZAMaFpZw4sSbIlRuissXZj/sHpQb8p9M5IeO4Z3rjkCP1cxI
-----END RSA PRIVATE KEY-----
.. note::

View File

@ -59,7 +59,6 @@ class MacKeychainModuleTest(integration.ModuleCase):
if CERT_ALIAS in certs_list:
self.run_function('keychain.uninstall', [CERT_ALIAS])
@requires_system_grains
def test_mac_keychain_install(self, grains=None):
'''