mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Add syncing of custom ssh wrappers
This commit is contained in:
parent
5dc987a630
commit
7b0d09bd29
5 changed files with 90 additions and 1 deletions
1
changelog/45450.added.md
Normal file
1
changelog/45450.added.md
Normal file
|
@ -0,0 +1 @@
|
|||
Added syncing of custom salt-ssh wrappers
|
|
@ -144,7 +144,7 @@ SDB ``salt.sdb`` (:ref:`index <all-salt.sdb>`) ``
|
|||
Serializer ``salt.serializers`` (:ref:`index <all-salt.serializers>`) ``serializers`` [#no-fs]_ ``serializers_dirs``
|
||||
SPM pkgdb ``salt.spm.pkgdb`` ``pkgdb`` [#no-fs]_ ``pkgdb_dirs``
|
||||
SPM pkgfiles ``salt.spm.pkgfiles`` ``pkgfiles`` [#no-fs]_ ``pkgfiles_dirs``
|
||||
SSH Wrapper ``salt.client.ssh.wrapper`` ``wrapper`` [#no-fs]_ ``wrapper_dirs``
|
||||
SSH Wrapper ``salt.client.ssh.wrapper`` ``wrapper`` ``wrapper_dirs``
|
||||
State ``salt.states`` (:ref:`index <all-salt.states>`) ``states`` ``states_dirs``
|
||||
Thorium ``salt.thorium`` (:ref:`index <all-salt.thorium>`) ``thorium`` ``thorium_dirs``
|
||||
Tokens ``salt.tokens`` ``tokens`` ``tokens_dirs``
|
||||
|
|
|
@ -1016,6 +1016,55 @@ def sync_executors(
|
|||
return ret
|
||||
|
||||
|
||||
def sync_wrapper(
|
||||
saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None
|
||||
):
|
||||
"""
|
||||
.. versionadded:: 3007.0
|
||||
|
||||
Sync salt-ssh wrapper modules from ``salt://_wrapper`` to the minion.
|
||||
|
||||
saltenv
|
||||
The fileserver environment from which to sync. To sync from more than
|
||||
one environment, pass a comma-separated list.
|
||||
|
||||
If not passed, then all environments configured in the :ref:`top files
|
||||
<states-top>` will be checked for wrappers to sync. If no top files
|
||||
are found, then the ``base`` environment will be synced.
|
||||
|
||||
refresh : True
|
||||
If ``True``, refresh the available wrapper modules on the minion.
|
||||
This refresh will be performed even if no wrappers are synced.
|
||||
Set to ``False`` to prevent this refresh.
|
||||
|
||||
extmod_whitelist : None
|
||||
comma-seperated list of modules to sync
|
||||
|
||||
extmod_blacklist : None
|
||||
comma-seperated list of modules to blacklist based on type
|
||||
|
||||
.. note::
|
||||
This function will raise an error if executed on a traditional (i.e.
|
||||
not masterless) minion.
|
||||
|
||||
CLI Examples:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' saltutil.sync_wrapper
|
||||
salt '*' saltutil.sync_wrapper saltenv=dev
|
||||
salt '*' saltutil.sync_wrapper saltenv=base,dev
|
||||
"""
|
||||
if __opts__["file_client"] != "local":
|
||||
raise CommandExecutionError(
|
||||
"Wrapper modules can only be synced to masterless minions"
|
||||
)
|
||||
ret = _sync("wrapper", saltenv, extmod_whitelist, extmod_blacklist)
|
||||
if refresh:
|
||||
refresh_modules()
|
||||
return ret
|
||||
|
||||
|
||||
def sync_all(
|
||||
saltenv=None,
|
||||
refresh=True,
|
||||
|
@ -1105,6 +1154,7 @@ def sync_all(
|
|||
ret["matchers"] = sync_matchers(saltenv, False, extmod_whitelist, extmod_blacklist)
|
||||
if __opts__["file_client"] == "local":
|
||||
ret["pillar"] = sync_pillar(saltenv, False, extmod_whitelist, extmod_blacklist)
|
||||
ret["wrapper"] = sync_wrapper(saltenv, False, extmod_whitelist, extmod_blacklist)
|
||||
if refresh:
|
||||
# we don't need to call refresh_modules here because it's done by refresh_pillar
|
||||
refresh_pillar(clean_cache=clean_pillar_cache)
|
||||
|
|
|
@ -146,6 +146,11 @@ def sync_all(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
|
|||
extmod_whitelist=extmod_whitelist,
|
||||
extmod_blacklist=extmod_blacklist,
|
||||
)
|
||||
ret["wrapper"] = sync_wrapper(
|
||||
saltenv=saltenv,
|
||||
extmod_whitelist=extmod_whitelist,
|
||||
extmod_blacklist=extmod_blacklist,
|
||||
)
|
||||
ret["roster"] = sync_roster(
|
||||
saltenv=saltenv,
|
||||
extmod_whitelist=extmod_whitelist,
|
||||
|
@ -835,3 +840,34 @@ def sync_executors(saltenv="base", extmod_whitelist=None, extmod_blacklist=None)
|
|||
extmod_whitelist=extmod_whitelist,
|
||||
extmod_blacklist=extmod_blacklist,
|
||||
)[0]
|
||||
|
||||
|
||||
def sync_wrapper(saltenv="base", extmod_whitelist=None, extmod_blacklist=None):
|
||||
"""
|
||||
.. versionadded:: 3000
|
||||
|
||||
Sync salt-ssh wrapper modules from ``salt://_wrapper`` to the master.
|
||||
|
||||
saltenv : base
|
||||
The fileserver environment from which to sync. To sync from more than
|
||||
one environment, pass a comma-separated list.
|
||||
|
||||
extmod_whitelist : None
|
||||
comma-seperated list of modules to sync
|
||||
|
||||
extmod_blacklist : None
|
||||
comma-seperated list of modules to blacklist based on type
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt-run saltutil.sync_wrapper
|
||||
"""
|
||||
return salt.utils.extmods.sync(
|
||||
__opts__,
|
||||
"wrapper",
|
||||
saltenv=saltenv,
|
||||
extmod_whitelist=extmod_whitelist,
|
||||
extmod_blacklist=extmod_blacklist,
|
||||
)[0]
|
||||
|
|
|
@ -31,6 +31,7 @@ def get_module_types():
|
|||
"tokens",
|
||||
"serializers",
|
||||
"executors",
|
||||
"wrapper",
|
||||
"roster",
|
||||
]
|
||||
return module_types
|
||||
|
@ -66,6 +67,7 @@ def module_sync_functions():
|
|||
"tokens": "eauth_tokens",
|
||||
"serializers": "serializers",
|
||||
"executors": "executors",
|
||||
"wrapper": "wrapper",
|
||||
"roster": "roster",
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue