Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
salt.3514
0075-Generate-Salt-Thin-with-configured-extra-m...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0075-Generate-Salt-Thin-with-configured-extra-modules.patch of Package salt.3514
From fb3385fa826f429b494c8bc0bd3e6c2b22832b4d Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <bo@suse.de> Date: Tue, 27 Sep 2016 10:59:07 +0200 Subject: [PATCH 75/75] Generate Salt Thin with configured extra modules * Add thin options to the master config. * Get the thin Salt with configured extra modules on SSH * Add a description of the thin/min parameters to the master config * Add documentation about Salt Thin configuration * Add extra-mods options to the Salt-Thin via SSH CLI --- conf/master | 7 +++++++ doc/ref/configuration/master.rst | 9 +++++++++ salt/client/ssh/__init__.py | 2 +- salt/config.py | 4 ++++ salt/runners/thin.py | 4 ++++ salt/utils/parsers.py | 6 ++++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/conf/master b/conf/master index 5f6beaa..2cb0078 100644 --- a/conf/master +++ b/conf/master @@ -824,3 +824,10 @@ hash_type: sha256 ############################################ # Default match type for filtering events tags: startswith, endswith, find, regex, fnmatch #event_match_type: startswith + +# Permanently include any available Python 3rd party modules into Salt Thin +# when they are generated for Salt-SSH or other purposes. +# The modules should be named by the names they are actually imported inside the Python. +# The value of the parameters can be either one module or a comma separated list of them. +#thin_extra_mods: foo,bar + diff --git a/doc/ref/configuration/master.rst b/doc/ref/configuration/master.rst index 4799b88..e835f9d 100644 --- a/doc/ref/configuration/master.rst +++ b/doc/ref/configuration/master.rst @@ -527,6 +527,15 @@ overridden on a per-minion basis in the roster (``minion_opts``) minion_opts: gpg_keydir: /root/gpg +``thin_extra_mods`` +------------------- + +Default: None + +List of additional modules, needed to be included into the Salt Thin. +Pass a list of importable Python modules that are typically located in +the `site-packages` Python directory so they will be also always included +into the Salt Thin, once generated. Master Security Settings ======================== diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index 047b7d7..caff178 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -240,7 +240,7 @@ class SSH(object): self.serial = salt.payload.Serial(opts) self.returners = salt.loader.returners(self.opts, {}) self.fsclient = salt.fileclient.FSClient(self.opts) - self.thin = salt.utils.thin.gen_thin(self.opts['cachedir']) + self.thin = salt.utils.thin.gen_thin(self.opts['cachedir'], extra_mods=self.opts.get('thin_extra_mods')) self.mods = mod_data(self.fsclient) def get_pubkey(self): diff --git a/salt/config.py b/salt/config.py index d0a395f..eab7668 100644 --- a/salt/config.py +++ b/salt/config.py @@ -766,6 +766,9 @@ VALID_OPTS = { # Delay in seconds before executing bootstrap (salt cloud) 'bootstrap_delay': int, + + # Extra modules for Salt Thin + 'thin_extra_mods': str, } # default configurations @@ -1206,6 +1209,7 @@ DEFAULT_MASTER_OPTS = { 'dummy_pub': False, 'http_request_timeout': 1 * 60 * 60.0, # 1 hour 'http_max_body': 100 * 1024 * 1024 * 1024, # 100GB + 'thin_extra_mods': '', } diff --git a/salt/runners/thin.py b/salt/runners/thin.py index 0a8b398..5a3386f 100644 --- a/salt/runners/thin.py +++ b/salt/runners/thin.py @@ -30,4 +30,8 @@ def generate(extra_mods='', overwrite=False, so_mods=''): salt-run thin.generate mako,wempy 1 salt-run thin.generate overwrite=1 ''' + conf_mods = __opts__.get('thin_extra_mods') + if conf_mods: + extra_mods = ','.join([conf_mods, extra_mods]) + return salt.utils.thin.gen_thin(__opts__['cachedir'], extra_mods, overwrite, so_mods) diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index d5050c0..40dc30e 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -2471,6 +2471,12 @@ class SaltSSHOptionParser(six.with_metaclass(OptionParserMeta, help='Pass in extra files to include in the state tarball' ) self.add_option( + '--thin-extra-modules', + dest='thin_extra_mods', + default=None, + help='One or comma-separated list of extra Python modules' + 'to be included into Thin Salt.') + self.add_option( '-v', '--verbose', default=False, action='store_true', -- 2.9.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor