split out publishing to ssh minions

and clean up docs
This commit is contained in:
Daniel Wallace 2017-12-18 12:21:24 -07:00
parent 190110be8f
commit 262405b0e8
No known key found for this signature in database
GPG key ID: 5FA5E5544F010D48
2 changed files with 18 additions and 11 deletions

View file

@ -102,7 +102,7 @@ The user to run the Salt processes
Default: ``False``
Tell the master to also use SaltSSH when running commands against minions.
Tell the master to also use salt-ssh when running commands against minions.
.. code-block:: yaml
@ -110,7 +110,7 @@ Tell the master to also use SaltSSH when running commands against minions.
.. note::
Cross minion type communication is still not possible. The SaltMine and
Cross-minion communication is still not possible. The Salt mine and
publish.publish do not work between minion types.
``ret_port``

View file

@ -1959,15 +1959,7 @@ class ClearFuncs(object):
payload = self._prep_pub(minions, jid, clear_load, extra, missing)
# Send it!
if self.opts[u'enable_ssh_minions'] is True and isinstance(clear_load[u'tgt'], six.string_types):
# The isinstances makes sure that syndics work
log.debug('Use SSHClient for rostered minions')
ssh = salt.client.ssh.client.SSHClient()
ssh_minions = ssh._prep_ssh(**clear_load).targets.keys()
if ssh_minions:
minions.extend(ssh_minions)
threading.Thread(target=ssh.cmd, kwargs=clear_load).start()
minions.extend(self._send_ssh_pub(payload))
self._send_pub(payload)
return {
@ -2030,6 +2022,21 @@ class ClearFuncs(object):
chan = salt.transport.server.PubServerChannel.factory(opts)
chan.publish(load)
def _send_ssh_pub(self, load):
'''
Take a load and send it across the network to connected minions
'''
minions = []
if self.opts['enable_ssh_minions'] is True and isinstance(load['tgt'], six.string_types):
# The isinstances makes sure that syndics work
log.debug('Use SSHClient for rostered minions')
ssh = salt.client.ssh.client.SSHClient()
ssh_minions = ssh._prep_ssh(**load).targets.keys()
if ssh_minions:
minions.extend(ssh_minions)
threading.Thread(target=ssh.cmd, kwargs=clear_load).start()
return minions
def _prep_pub(self, minions, jid, clear_load, extra, missing):
'''
Take a given load and perform the necessary steps