mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Merge branch '2014.7' into develop
Conflicts: salt/output/key.py
This commit is contained in:
commit
999d695d8f
@ -7,9 +7,9 @@ Is Salt open-core?
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
No. Salt is 100% committed to being open-source, including all of our APIs and
|
No. Salt is 100% committed to being open-source, including all of our APIs and
|
||||||
the new `'Halite' web interface`_ which was introduced in version 0.17.0. It
|
the `'Halite' web interface`_ which was introduced in version 0.17.0. It is
|
||||||
is developed under the `Apache 2.0 license`_, allowing it to be used in both
|
developed under the `Apache 2.0 license`_, allowing it to be used in both open
|
||||||
open and proprietary projects.
|
and proprietary projects.
|
||||||
|
|
||||||
.. _`'Halite' web interface`: https://github.com/saltstack/halite
|
.. _`'Halite' web interface`: https://github.com/saltstack/halite
|
||||||
.. _`Apache 2.0 license`: http://www.apache.org/licenses/LICENSE-2.0.html
|
.. _`Apache 2.0 license`: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -278,6 +278,7 @@ class SSH(object):
|
|||||||
self.opts,
|
self.opts,
|
||||||
argv,
|
argv,
|
||||||
host,
|
host,
|
||||||
|
mods=self.mods,
|
||||||
**target)
|
**target)
|
||||||
if salt.utils.which('ssh-copy-id'):
|
if salt.utils.which('ssh-copy-id'):
|
||||||
# we have ssh-copy-id, use it!
|
# we have ssh-copy-id, use it!
|
||||||
@ -290,6 +291,7 @@ class SSH(object):
|
|||||||
self.opts,
|
self.opts,
|
||||||
self.opts['argv'],
|
self.opts['argv'],
|
||||||
host,
|
host,
|
||||||
|
mods=self.mods,
|
||||||
**target)
|
**target)
|
||||||
stdout, stderr, retcode = single.cmd_block()
|
stdout, stderr, retcode = single.cmd_block()
|
||||||
try:
|
try:
|
||||||
@ -639,6 +641,7 @@ class Single(object):
|
|||||||
pre_wrapper = salt.client.ssh.wrapper.FunctionWrapper(
|
pre_wrapper = salt.client.ssh.wrapper.FunctionWrapper(
|
||||||
self.opts,
|
self.opts,
|
||||||
self.id,
|
self.id,
|
||||||
|
mods=self.mods,
|
||||||
**self.target)
|
**self.target)
|
||||||
opts_pkg = pre_wrapper['test.opts_pkg']()
|
opts_pkg = pre_wrapper['test.opts_pkg']()
|
||||||
opts_pkg['file_roots'] = self.opts['file_roots']
|
opts_pkg['file_roots'] = self.opts['file_roots']
|
||||||
@ -687,6 +690,7 @@ class Single(object):
|
|||||||
wrapper = salt.client.ssh.wrapper.FunctionWrapper(
|
wrapper = salt.client.ssh.wrapper.FunctionWrapper(
|
||||||
opts,
|
opts,
|
||||||
self.id,
|
self.id,
|
||||||
|
mods=self.mods,
|
||||||
**self.target)
|
**self.target)
|
||||||
self.wfuncs = salt.loader.ssh_wrapper(opts, wrapper, self.opts)
|
self.wfuncs = salt.loader.ssh_wrapper(opts, wrapper, self.opts)
|
||||||
wrapper.wfuncs = self.wfuncs
|
wrapper.wfuncs = self.wfuncs
|
||||||
@ -961,9 +965,9 @@ def mod_data(opts):
|
|||||||
pl_dir = os.path.join(path, '_{0}'.format(ref))
|
pl_dir = os.path.join(path, '_{0}'.format(ref))
|
||||||
if os.path.isdir(pl_dir):
|
if os.path.isdir(pl_dir):
|
||||||
for fn_ in os.listdir(pl_dir):
|
for fn_ in os.listdir(pl_dir):
|
||||||
if not os.path.isfile(fn_):
|
|
||||||
continue
|
|
||||||
mod_path = os.path.join(pl_dir, fn_)
|
mod_path = os.path.join(pl_dir, fn_)
|
||||||
|
if not os.path.isfile(mod_path):
|
||||||
|
continue
|
||||||
with open(mod_path) as fp_:
|
with open(mod_path) as fp_:
|
||||||
code_str = fp_.read().encode('base64')
|
code_str = fp_.read().encode('base64')
|
||||||
mod_str += '{0}|{1},'.format(fn_, code_str)
|
mod_str += '{0}|{1},'.format(fn_, code_str)
|
||||||
|
@ -162,7 +162,6 @@ def write_modules():
|
|||||||
'var',
|
'var',
|
||||||
'cache',
|
'cache',
|
||||||
'salt',
|
'salt',
|
||||||
'minion',
|
|
||||||
'extmods')
|
'extmods')
|
||||||
for mtype in mtypes:
|
for mtype in mtypes:
|
||||||
dest_dir = os.path.join(modcache, mtype)
|
dest_dir = os.path.join(modcache, mtype)
|
||||||
|
@ -25,10 +25,15 @@ class FunctionWrapper(dict):
|
|||||||
id_,
|
id_,
|
||||||
host,
|
host,
|
||||||
wfuncs=None,
|
wfuncs=None,
|
||||||
|
mods=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
super(FunctionWrapper, self).__init__()
|
super(FunctionWrapper, self).__init__()
|
||||||
self.wfuncs = wfuncs if isinstance(wfuncs, dict) else {}
|
self.wfuncs = wfuncs if isinstance(wfuncs, dict) else {}
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
|
if isinstance(mods, dict):
|
||||||
|
self.mods = mods
|
||||||
|
else:
|
||||||
|
self.mods = {}
|
||||||
self.kwargs = {'id_': id_,
|
self.kwargs = {'id_': id_,
|
||||||
'host': host}
|
'host': host}
|
||||||
self.kwargs.update(kwargs)
|
self.kwargs.update(kwargs)
|
||||||
@ -50,6 +55,7 @@ class FunctionWrapper(dict):
|
|||||||
single = salt.client.ssh.Single(
|
single = salt.client.ssh.Single(
|
||||||
self.opts,
|
self.opts,
|
||||||
argv,
|
argv,
|
||||||
|
mods=self.mods,
|
||||||
**self.kwargs
|
**self.kwargs
|
||||||
)
|
)
|
||||||
stdout, stderr, _ = single.cmd_block()
|
stdout, stderr, _ = single.cmd_block()
|
||||||
|
@ -56,12 +56,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_HALITE = False
|
HAS_HALITE = False
|
||||||
|
|
||||||
try:
|
|
||||||
import systemd.daemon
|
|
||||||
HAS_PYTHON_SYSTEMD = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_PYTHON_SYSTEMD = False
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -495,13 +489,6 @@ class ReqServer(object):
|
|||||||
|
|
||||||
self.workers.bind(self.w_uri)
|
self.workers.bind(self.w_uri)
|
||||||
|
|
||||||
try:
|
|
||||||
if HAS_PYTHON_SYSTEMD and systemd.daemon.booted():
|
|
||||||
systemd.daemon.notify('READY=1')
|
|
||||||
except SystemError:
|
|
||||||
# Daemon wasn't started by systemd
|
|
||||||
pass
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
zmq.device(zmq.QUEUE, self.clients, self.workers)
|
zmq.device(zmq.QUEUE, self.clients, self.workers)
|
||||||
|
@ -134,6 +134,10 @@ def option(
|
|||||||
return __opts__[value]
|
return __opts__[value]
|
||||||
if not omit_master:
|
if not omit_master:
|
||||||
if value in __pillar__.get('master', {}):
|
if value in __pillar__.get('master', {}):
|
||||||
|
salt.utils.warn_until(
|
||||||
|
'Lithium',
|
||||||
|
'pillar_opts will default to False in the Lithium release'
|
||||||
|
)
|
||||||
return __pillar__['master'][value]
|
return __pillar__['master'][value]
|
||||||
if not omit_pillar:
|
if not omit_pillar:
|
||||||
if value in __pillar__:
|
if value in __pillar__:
|
||||||
@ -168,6 +172,10 @@ def merge(value,
|
|||||||
return ret
|
return ret
|
||||||
if not omit_master:
|
if not omit_master:
|
||||||
if value in __pillar__.get('master', {}):
|
if value in __pillar__.get('master', {}):
|
||||||
|
salt.utils.warn_until(
|
||||||
|
'Lithium',
|
||||||
|
'pillar_opts will default to False in the Lithium release'
|
||||||
|
)
|
||||||
tmp = __pillar__['master'][value]
|
tmp = __pillar__['master'][value]
|
||||||
if ret is None:
|
if ret is None:
|
||||||
ret = tmp
|
ret = tmp
|
||||||
@ -241,6 +249,10 @@ def get(key, default=''):
|
|||||||
return sdb.sdb_get(ret, __opts__)
|
return sdb.sdb_get(ret, __opts__)
|
||||||
|
|
||||||
ret = salt.utils.traverse_dict_and_list(__pillar__.get('master', {}), key, '_|-')
|
ret = salt.utils.traverse_dict_and_list(__pillar__.get('master', {}), key, '_|-')
|
||||||
|
salt.utils.warn_until(
|
||||||
|
'Lithium',
|
||||||
|
'pillar_opts will default to False in the Lithium release'
|
||||||
|
)
|
||||||
if ret != '_|-':
|
if ret != '_|-':
|
||||||
return sdb.sdb_get(ret, __opts__)
|
return sdb.sdb_get(ret, __opts__)
|
||||||
|
|
||||||
@ -260,6 +272,10 @@ def dot_vals(value):
|
|||||||
'''
|
'''
|
||||||
ret = {}
|
ret = {}
|
||||||
for key, val in __pillar__.get('master', {}).items():
|
for key, val in __pillar__.get('master', {}).items():
|
||||||
|
salt.utils.warn_until(
|
||||||
|
'Lithium',
|
||||||
|
'pillar_opts will default to False in the Lithium release'
|
||||||
|
)
|
||||||
if key.startswith('{0}.'.format(value)):
|
if key.startswith('{0}.'.format(value)):
|
||||||
ret[key] = val
|
ret[key] = val
|
||||||
for key, val in __opts__.items():
|
for key, val in __opts__.items():
|
||||||
|
@ -376,7 +376,7 @@ def refresh_db():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def upgrade(refresh=True):
|
def upgrade(refresh=True): # pylint: disable=W0613
|
||||||
'''
|
'''
|
||||||
Run a full upgrade using MacPorts 'port upgrade outdated'
|
Run a full upgrade using MacPorts 'port upgrade outdated'
|
||||||
|
|
||||||
|
@ -480,6 +480,8 @@ def interface(iface):
|
|||||||
'''
|
'''
|
||||||
Return the inet address for a given interface
|
Return the inet address for a given interface
|
||||||
|
|
||||||
|
.. versionadded:: 2014.7
|
||||||
|
|
||||||
CLI Example:
|
CLI Example:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -493,6 +495,8 @@ def interface_ip(iface):
|
|||||||
'''
|
'''
|
||||||
Return the inet address for a given interface
|
Return the inet address for a given interface
|
||||||
|
|
||||||
|
.. versionadded:: 2014.7
|
||||||
|
|
||||||
CLI Example:
|
CLI Example:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -648,6 +652,8 @@ def connect(host, port=None, **kwargs):
|
|||||||
Test connectivity to a host using a particular
|
Test connectivity to a host using a particular
|
||||||
port from the minion.
|
port from the minion.
|
||||||
|
|
||||||
|
.. versionadded:: 2014.7
|
||||||
|
|
||||||
CLI Example:
|
CLI Example:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
@ -23,32 +23,50 @@ def output(data):
|
|||||||
pend = 'minions_pre'
|
pend = 'minions_pre'
|
||||||
den = 'minions_denied'
|
den = 'minions_denied'
|
||||||
rej = 'minions_rejected'
|
rej = 'minions_rejected'
|
||||||
|
|
||||||
|
cmap = {pend: color['RED'],
|
||||||
|
acc: color['GREEN'],
|
||||||
|
den: color['PURPLE'],
|
||||||
|
rej: color['BLUE'],
|
||||||
|
'local': color['PURPLE']}
|
||||||
|
|
||||||
|
trans = {pend: u'{0}Unaccepted Keys:{1}'.format(
|
||||||
|
color['LIGHT_RED'],
|
||||||
|
color['ENDC']),
|
||||||
|
acc: u'{0}Accepted Keys:{1}'.format(
|
||||||
|
color['LIGHT_GREEN'],
|
||||||
|
color['ENDC']),
|
||||||
|
den: u'{0}Denied Keys:{1}'.format(
|
||||||
|
color['LIGHT_PURPLE'],
|
||||||
|
color['ENDC']),
|
||||||
|
rej: u'{0}Rejected Keys:{1}'.format(
|
||||||
|
color['LIGHT_BLUE'],
|
||||||
|
color['ENDC']),
|
||||||
|
'local': u'{0}Local Keys:{1}'.format(
|
||||||
|
color['LIGHT_PURPLE'],
|
||||||
|
color['ENDC'])}
|
||||||
else:
|
else:
|
||||||
acc = 'accepted'
|
acc = 'accepted'
|
||||||
pend = 'pending'
|
pend = 'pending'
|
||||||
rej = 'rejected'
|
rej = 'rejected'
|
||||||
|
|
||||||
cmap = {pend: color['RED'],
|
cmap = {pend: color['RED'],
|
||||||
acc: color['GREEN'],
|
acc: color['GREEN'],
|
||||||
den: color['PURPLE'],
|
rej: color['BLUE'],
|
||||||
rej: color['BLUE'],
|
'local': color['PURPLE']}
|
||||||
'local': color['PURPLE']}
|
|
||||||
|
|
||||||
trans = {pend: u'{0}Unaccepted Keys:{1}'.format(
|
trans = {pend: u'{0}Unaccepted Keys:{1}'.format(
|
||||||
color['LIGHT_RED'],
|
color['LIGHT_RED'],
|
||||||
color['ENDC']),
|
color['ENDC']),
|
||||||
acc: u'{0}Accepted Keys:{1}'.format(
|
acc: u'{0}Accepted Keys:{1}'.format(
|
||||||
color['LIGHT_GREEN'],
|
color['LIGHT_GREEN'],
|
||||||
color['ENDC']),
|
color['ENDC']),
|
||||||
den: u'{0}Denied Keys:{1}'.format(
|
rej: u'{0}Rejected Keys:{1}'.format(
|
||||||
color['LIGHT_PURPLE'],
|
color['LIGHT_BLUE'],
|
||||||
color['ENDC']),
|
color['ENDC']),
|
||||||
rej: u'{0}Rejected Keys:{1}'.format(
|
'local': u'{0}Local Keys:{1}'.format(
|
||||||
color['LIGHT_BLUE'],
|
color['LIGHT_PURPLE'],
|
||||||
color['ENDC']),
|
color['ENDC'])}
|
||||||
'local': u'{0}Local Keys:{1}'.format(
|
|
||||||
color['LIGHT_PURPLE'],
|
|
||||||
color['ENDC'])}
|
|
||||||
|
|
||||||
ret = ''
|
ret = ''
|
||||||
|
|
||||||
|
@ -19,6 +19,12 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
import systemd.daemon
|
||||||
|
HAS_PYTHON_SYSTEMD = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON_SYSTEMD = False
|
||||||
|
|
||||||
|
|
||||||
def set_pidfile(pidfile, user):
|
def set_pidfile(pidfile, user):
|
||||||
'''
|
'''
|
||||||
@ -178,6 +184,13 @@ class ProcessManager(object):
|
|||||||
# make sure to kill the subprocesses if the parent is killed
|
# make sure to kill the subprocesses if the parent is killed
|
||||||
signal.signal(signal.SIGTERM, self.kill_children)
|
signal.signal(signal.SIGTERM, self.kill_children)
|
||||||
|
|
||||||
|
try:
|
||||||
|
if HAS_PYTHON_SYSTEMD and systemd.daemon.booted():
|
||||||
|
systemd.daemon.notify('READY=1')
|
||||||
|
except SystemError:
|
||||||
|
# Daemon wasn't started by systemd
|
||||||
|
pass
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
pid, exit_status = os.wait()
|
pid, exit_status = os.wait()
|
||||||
|
Loading…
Reference in New Issue
Block a user