From 2cf696671fa49a2ac880b32e86911c525ca59fb7 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Tue, 12 Jul 2016 16:23:49 +0200 Subject: [PATCH 01/13] Introduce configuration error exception --- salt/exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/salt/exceptions.py b/salt/exceptions.py index 2a79c2d2fda..086e4d55c7e 100644 --- a/salt/exceptions.py +++ b/salt/exceptions.py @@ -301,6 +301,11 @@ class SaltWheelError(SaltException): Problem in wheel ''' +class SaltConfigurationError(SaltException): + ''' + Configuration error + ''' + class SaltSystemExit(SystemExit): ''' From 575767022b4544cb702df89cc7e4afb9fc4a21ae Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Tue, 12 Jul 2016 17:03:07 +0200 Subject: [PATCH 02/13] Cover exception handling in the utils.parsers --- salt/utils/parsers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index de996c9301b..d45c8ddec21 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -38,6 +38,7 @@ import salt.utils.jid from salt.utils import kinds from salt.defaults import DEFAULT_TARGET_DELIM from salt.utils.validate.path import is_writeable +import salt.exceptions # Import 3rd-party libs import salt.ext.six as six @@ -385,7 +386,12 @@ class SaltfileMixIn(six.with_metaclass(MixInMeta, object)): 'Loading Saltfile from \'{0}\''.format(self.options.saltfile) ) - saltfile_config = config._read_conf_file(saltfile) + try: + saltfile_config = config._read_conf_file(saltfile) + except salt.exceptions.SaltConfigurationError as error: + self.error(error.message) + self.exit(salt.defaults.exitcodes.EX_GENERIC, + '{0}: error: {1}\n'.format(self.get_prog_name(), error.message)) if not saltfile_config: # No configuration was loaded from the Saltfile From c5de6c8c4ad94c2e9b58b9bc3d844aa2a00049fa Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Tue, 12 Jul 2016 17:14:20 +0200 Subject: [PATCH 03/13] Raise an exception on any found wrong configuration file --- salt/config/__init__.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/salt/config/__init__.py b/salt/config/__init__.py index fee83262cf3..6767055734f 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -1516,18 +1516,18 @@ def _read_conf_file(path): try: conf_opts = yaml.safe_load(conf_file.read()) or {} except yaml.YAMLError as err: - log.error( - 'Error parsing configuration file: {0} - {1}'.format(path, err) - ) - conf_opts = {} + message = 'Error parsing configuration file: {0} - {1}'.format(path, err) + log.error(message) + raise salt.exceptions.SaltConfigurationError(message) + # only interpret documents as a valid conf, not things like strings, # which might have been caused by invalid yaml syntax if not isinstance(conf_opts, dict): - log.error( - 'Error parsing configuration file: {0} - conf should be a ' - 'document, not {1}.'.format(path, type(conf_opts)) - ) - conf_opts = {} + message = 'Error parsing configuration file: {0} - conf ' \ + 'should be a document, not {1}.'.format(path, type(conf_opts)) + log.error(message) + raise salt.exceptions.SaltConfigurationError(message) + # allow using numeric ids: convert int to string if 'id' in conf_opts: if not isinstance(conf_opts['id'], six.string_types): From 0c2d3511c98a254bb0f22a3e714efbdd29c6a3ea Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Tue, 12 Jul 2016 17:27:11 +0200 Subject: [PATCH 04/13] Exit immediately on configuration error --- salt/config/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 6767055734f..286d74a12e7 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -1654,7 +1654,10 @@ def include_config(include, orig_path, verbose): for fn_ in sorted(glob.glob(path)): log.debug('Including configuration from \'{0}\''.format(fn_)) - opts = _read_conf_file(fn_) + try: + opts = _read_conf_file(fn_) + except salt.exceptions.SaltConfigurationError as error: + sys.exit(1) include = opts.get('include', []) if include: From 6b660678fadf7c05e9d1571bedc1991e5d6bcb3c Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Tue, 12 Jul 2016 17:29:04 +0200 Subject: [PATCH 05/13] Use Salt default exit codes instead of hard-coded values --- salt/config/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 286d74a12e7..057b83ee709 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -40,6 +40,7 @@ import salt.utils.xdg import salt.exceptions import salt.utils.sdb from salt.utils.locales import sdecode +import salt.defaults.exitcodes log = logging.getLogger(__name__) @@ -1610,9 +1611,13 @@ def load_config(path, env_var, default_path=None): out.write(ifile.read()) if salt.utils.validate.path.is_readable(path): - opts = _read_conf_file(path) - opts['conf_file'] = path - return opts + try: + opts = _read_conf_file(path) + opts['conf_file'] = path + return opts + except salt.exceptions.SaltConfigurationError as error: + log.error(error.message) + sys.exit(salt.defaults.exitcodes.EX_GENERIC) log.debug('Missing configuration file: {0}'.format(path)) return {} @@ -1657,7 +1662,7 @@ def include_config(include, orig_path, verbose): try: opts = _read_conf_file(fn_) except salt.exceptions.SaltConfigurationError as error: - sys.exit(1) + sys.exit(salt.defaults.exitcodes.EX_GENERIC) include = opts.get('include', []) if include: From 23d1031a098ae8b23a90c48fae8901faba2dd149 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Wed, 13 Jul 2016 10:10:31 +0200 Subject: [PATCH 06/13] Fix lint: E8302 --- salt/exceptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/salt/exceptions.py b/salt/exceptions.py index 086e4d55c7e..79a3add9d3d 100644 --- a/salt/exceptions.py +++ b/salt/exceptions.py @@ -301,6 +301,7 @@ class SaltWheelError(SaltException): Problem in wheel ''' + class SaltConfigurationError(SaltException): ''' Configuration error From e5f43e671190ced30e20a00cd0740b75cb2c16d0 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Wed, 13 Jul 2016 11:44:33 +0200 Subject: [PATCH 07/13] Remove deprecation: BaseException.message deprecated as of 2.6 --- salt/config/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 057b83ee709..72a1059b7e9 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -1616,7 +1616,7 @@ def load_config(path, env_var, default_path=None): opts['conf_file'] = path return opts except salt.exceptions.SaltConfigurationError as error: - log.error(error.message) + log.error(error) sys.exit(salt.defaults.exitcodes.EX_GENERIC) log.debug('Missing configuration file: {0}'.format(path)) @@ -1662,6 +1662,7 @@ def include_config(include, orig_path, verbose): try: opts = _read_conf_file(fn_) except salt.exceptions.SaltConfigurationError as error: + log.error(error) sys.exit(salt.defaults.exitcodes.EX_GENERIC) include = opts.get('include', []) From abd10b5782ae735ff0540e9052bc498076890895 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Wed, 13 Jul 2016 18:46:01 +0200 Subject: [PATCH 08/13] Ignore minion config errors everywhere but the minion itself --- salt/config/__init__.py | 14 +++++++++----- salt/master.py | 14 +++++++++----- salt/minion.py | 5 +++-- salt/utils/parsers.py | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 72a1059b7e9..a547d550a02 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -1623,7 +1623,7 @@ def load_config(path, env_var, default_path=None): return {} -def include_config(include, orig_path, verbose): +def include_config(include, orig_path, verbose, exit_on_config_errors=False): ''' Parses extra configuration file(s) specified in an include list in the main config file. @@ -1663,7 +1663,8 @@ def include_config(include, orig_path, verbose): opts = _read_conf_file(fn_) except salt.exceptions.SaltConfigurationError as error: log.error(error) - sys.exit(salt.defaults.exitcodes.EX_GENERIC) + if exit_on_config_errors: + sys.exit(salt.defaults.exitcodes.EX_GENERIC) include = opts.get('include', []) if include: @@ -1706,7 +1707,8 @@ def insert_system_path(opts, paths): def minion_config(path, env_var='SALT_MINION_CONFIG', defaults=None, - cache_minion_id=False): + cache_minion_id=False, + ignore_config_errors=True): ''' Reads in the minion configuration file and sets up special options @@ -1741,8 +1743,10 @@ def minion_config(path, defaults['default_include']) include = overrides.get('include', []) - overrides.update(include_config(default_include, path, verbose=False)) - overrides.update(include_config(include, path, verbose=True)) + overrides.update(include_config(default_include, path, verbose=False, + exit_on_config_errors=not ignore_config_errors)) + overrides.update(include_config(include, path, verbose=True, + exit_on_config_errors=not ignore_config_errors)) opts = apply_minion_config(overrides, defaults, cache_minion_id=cache_minion_id) _validate_opts(opts) diff --git a/salt/master.py b/salt/master.py index 24531f1a761..ca3334b5362 100644 --- a/salt/master.py +++ b/salt/master.py @@ -878,9 +878,9 @@ class MWorker(SignalHandlingMultiprocessingProcess): ''' salt.utils.appendproctitle(self.name) self.clear_funcs = ClearFuncs( - self.opts, - self.key, - ) + self.opts, + self.key, + ) self.aes_funcs = AESFuncs(self.opts) salt.utils.reinit_crypto() self.__bind() @@ -912,7 +912,9 @@ class AESFuncs(object): self.mminion = salt.minion.MasterMinion( self.opts, states=False, - rend=False) + rend=False, + ignore_config_errors=True + ) self.__setup_fileserver() self.masterapi = salt.daemons.masterapi.RemoteFuncs(opts) @@ -1595,7 +1597,9 @@ class ClearFuncs(object): self.mminion = salt.minion.MasterMinion( self.opts, states=False, - rend=False) + rend=False, + ignore_config_errors=True + ) # Make a wheel object self.wheel_ = salt.wheel.Wheel(opts) # Make a masterapi object diff --git a/salt/minion.py b/salt/minion.py index f3386f02d29..c0b86271e9b 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -656,8 +656,9 @@ class MasterMinion(object): states=True, rend=True, matcher=True, - whitelist=None): - self.opts = salt.config.minion_config(opts['conf_file']) + whitelist=None, + ignore_config_errors=True): + self.opts = salt.config.minion_config(opts['conf_file'], ignore_config_errors=ignore_config_errors) self.opts.update(opts) self.whitelist = whitelist self.opts['grains'] = salt.loader.grains(opts) diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index d45c8ddec21..e2ac8e8a5ac 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -1690,7 +1690,7 @@ class MinionOptionParser(six.with_metaclass(OptionParserMeta, MasterOptionParser def setup_config(self): return config.minion_config(self.get_config_file_path(), # pylint: disable=no-member - cache_minion_id=True) + cache_minion_id=True, ignore_config_errors=False) class ProxyMinionOptionParser(six.with_metaclass(OptionParserMeta, From fb7542f920276689e0db30061df632d8e745985a Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Wed, 13 Jul 2016 19:20:27 +0200 Subject: [PATCH 09/13] Add option to master config reader on ignoring system exit for wrong configuration --- salt/config/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/salt/config/__init__.py b/salt/config/__init__.py index a547d550a02..9bad078bed7 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -2965,7 +2965,7 @@ def apply_minion_config(overrides=None, return opts -def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None): +def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None, exit_on_config_errors=False): ''' Reads in the master configuration file and sets up default options @@ -2992,8 +2992,8 @@ def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None): defaults['default_include']) include = overrides.get('include', []) - overrides.update(include_config(default_include, path, verbose=False)) - overrides.update(include_config(include, path, verbose=True)) + overrides.update(include_config(default_include, path, verbose=False), exit_on_config_errors=exit_on_config_errors) + overrides.update(include_config(include, path, verbose=True), exit_on_config_errors=exit_on_config_errors) opts = apply_master_config(overrides, defaults) _validate_opts(opts) # If 'nodegroups:' is uncommented in the master config file, and there are From d4144039bc7fb11b8bb7d42c42b9d852958ceba5 Mon Sep 17 00:00:00 2001 From: Steve Hajducko Date: Fri, 15 Jul 2016 23:12:52 -0700 Subject: [PATCH 10/13] Fix ldap auth for function matches The expand_ldap_entries doesn't take into account that certain entries may not actually be dicts, such as @runner, @wheel, @jobs, or even .* --- salt/auth/ldap.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/salt/auth/ldap.py b/salt/auth/ldap.py index 2ee6cbd5a5c..528f18c1e60 100644 --- a/salt/auth/ldap.py +++ b/salt/auth/ldap.py @@ -391,6 +391,8 @@ def expand_ldap_entries(entries, opts=None): bind = _bind_for_search(opts=opts) acl_tree = [] for user_or_group_dict in entries: + if not isinstance(user_or_group_dict, dict): + acl_tree.append(user_or_group_dict) for minion_or_ou, matchers in six.iteritems(user_or_group_dict): permissions = matchers retrieved_minion_ids = [] From 9c803d05a5cae4c899edb450cf4f7f34b8ddfa24 Mon Sep 17 00:00:00 2001 From: rallytime Date: Sat, 16 Jul 2016 12:45:55 -0600 Subject: [PATCH 11/13] Add output_file option to master config docs Fixes #34703 --- conf/master | 5 +++++ doc/ref/configuration/master.rst | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/conf/master b/conf/master index e96d0a63b11..ac99754a32e 100644 --- a/conf/master +++ b/conf/master @@ -84,6 +84,11 @@ # Set the default outputter used by the salt command. The default is "nested". #output: nested +# Set the default output file used by the salt command. Default is to output +# to the CLI and not to a file. Functions the same way as the "--out-file" +CLI option, only sets this to a single file for all salt commands. +#output_file: None + # Return minions that timeout when running commands like test.ping #show_timeout: True diff --git a/doc/ref/configuration/master.rst b/doc/ref/configuration/master.rst index 43129a34c2d..d49156ae4a2 100644 --- a/doc/ref/configuration/master.rst +++ b/doc/ref/configuration/master.rst @@ -339,6 +339,21 @@ Default: ``nested`` Set the default outputter used by the salt command. +.. conf_master:: output_file + +``output_file`` +--------------- + +Default: None + +# Set the default output file used by the salt command. Default is to output +# to the CLI and not to a file. Functions the same way as the "--out-file" +CLI option, only sets this to a single file for all salt commands. + +.. code-block:: yaml + + output_file: /path/output/file + .. conf_master:: color ``color`` From cca9446c377492bd26a7b0f79d4ea4c5a9fcea1e Mon Sep 17 00:00:00 2001 From: rallytime Date: Sat, 16 Jul 2016 13:17:09 -0600 Subject: [PATCH 12/13] Various spelling fixes Fixes #34630 --- doc/topics/installation/suse.rst | 2 +- doc/topics/reactor/index.rst | 2 +- doc/topics/releases/2015.5.3.rst | 2 +- doc/topics/releases/2015.8.9.rst | 4 ++-- doc/topics/releases/2016.3.1.rst | 2 +- doc/topics/transports/index.rst | 2 +- doc/topics/troubleshooting/master.rst | 2 +- salt/modules/chocolatey.py | 4 ++-- salt/modules/cmdmod.py | 2 +- salt/modules/dockercompose.py | 6 +++--- salt/modules/file.py | 2 +- salt/modules/infoblox.py | 10 +++++----- salt/modules/opkg.py | 2 +- salt/modules/smartos_vmadm.py | 14 +++++++------- salt/modules/solaris_fmadm.py | 2 +- salt/modules/status.py | 2 +- salt/modules/telemetry.py | 2 +- salt/modules/win_certutil.py | 4 ++-- salt/modules/win_task.py | 2 +- salt/modules/zfs.py | 8 ++++---- salt/modules/zpool.py | 4 ++-- salt/pillar/git_pillar.py | 2 +- salt/pillar/stack.py | 4 ++-- salt/runners/jobs.py | 4 ++-- salt/states/kmod.py | 2 +- salt/states/ldap.py | 2 +- salt/states/mac_xattr.py | 2 +- salt/utils/context.py | 6 +++--- salt/utils/gitfs.py | 4 ++-- tests/unit/modules/postgres_test.py | 2 +- 30 files changed, 54 insertions(+), 54 deletions(-) diff --git a/doc/topics/installation/suse.rst b/doc/topics/installation/suse.rst index d85476961ad..8c7a3fdb5c7 100644 --- a/doc/topics/installation/suse.rst +++ b/doc/topics/installation/suse.rst @@ -18,7 +18,7 @@ Installation from the SUSE Repository Since openSUSE 13.2, Salt 2014.1.11 is available in the primary repositories. With the release of SUSE manager 3 a new repository setup has been created. The new repo will by systemsmanagement:saltstack, which is the source -for newer stable packages. For backward compatibilty a linkpackage will be +for newer stable packages. For backward compatibility a linkpackage will be created to the old devel:language:python repo. All development of suse packages will be done in systemsmanagement:saltstack:testing. This will ensure that salt will be in mainline suse repo's, a stable release diff --git a/doc/topics/reactor/index.rst b/doc/topics/reactor/index.rst index 22c8273904a..397b95dd56c 100644 --- a/doc/topics/reactor/index.rst +++ b/doc/topics/reactor/index.rst @@ -515,7 +515,7 @@ authentication every ten seconds by default. .. code-block:: yaml - {# Ink server faild to authenticate -- remove accepted key #} + {# Ink server failed to authenticate -- remove accepted key #} {% if not data['result'] and data['id'].startswith('ink') %} minion_remove: wheel.key.delete: diff --git a/doc/topics/releases/2015.5.3.rst b/doc/topics/releases/2015.5.3.rst index c7e3664d39f..6de48e07bbe 100644 --- a/doc/topics/releases/2015.5.3.rst +++ b/doc/topics/releases/2015.5.3.rst @@ -45,7 +45,7 @@ Changes: * a983942 Merge pull request `#25095`_ from jfindlay/win_groupadd_test * 564dffd depend on win libs rather than mocking them - * 9b9aeb8 resolved all erors. + * 9b9aeb8 resolved all errors. * aaf8935 adding win_groupadd unit test case. diff --git a/doc/topics/releases/2015.8.9.rst b/doc/topics/releases/2015.8.9.rst index c71617d960f..d698aef42ea 100644 --- a/doc/topics/releases/2015.8.9.rst +++ b/doc/topics/releases/2015.8.9.rst @@ -236,7 +236,7 @@ Changes: - **PR** `#32588`_: (*anlutro*) Fix salt-ssh module function call argument type juggling by JSON encoding them -* 5e7edfc yumpkg: Ignore epoch in version comparison for explict versions without an epoch (`#32563`_) +* 5e7edfc yumpkg: Ignore epoch in version comparison for explicit versions without an epoch (`#32563`_) * fea6056 Fixing critical bug to remove only the specified Host instead of the entire Host cluster (`#32640`_) @@ -296,7 +296,7 @@ Changes: - **PR** `#32423`_: (*jtand*) Update glusterfs_test to be inline with `#32312`_ -- **PR** `#32425`_: (*cachedout*) Fix salt-cloud paralell provisioning +- **PR** `#32425`_: (*cachedout*) Fix salt-cloud parallel provisioning * 51fb2ac FreeBSD supports packages in format java/openjdk7 so the prior commit broke that functionality. Check freebsd/pkg`#1409`_ for more info. diff --git a/doc/topics/releases/2016.3.1.rst b/doc/topics/releases/2016.3.1.rst index 95415c23244..db85e40e6b8 100644 --- a/doc/topics/releases/2016.3.1.rst +++ b/doc/topics/releases/2016.3.1.rst @@ -34,7 +34,7 @@ Changes: - **PR** `#33851`_: (*ticosax*) [dockerng] Add support for edge case when `Cmd` and `Entrypoint` can't be blanked -- **PR** `#33821`_: (*cachedout*) Restore deafault log level to warning +- **PR** `#33821`_: (*cachedout*) Restore default log level to warning - **PR** `#33767`_: (*amontalban*) Fix `#33604`_ implementation when 'geom disk list' does not output rotat… diff --git a/doc/topics/transports/index.rst b/doc/topics/transports/index.rst index 9f03e1fa1a6..7702a7eb8e3 100644 --- a/doc/topics/transports/index.rst +++ b/doc/topics/transports/index.rst @@ -26,7 +26,7 @@ primarily used for fetching files and returning job returns. The req channels have two basic interfaces when talking to the master. ``send`` is the basic method that guarantees the message is encrypted at least so that only minions attached to the same master can read it-- but no guarantee of minion-master -confidentiality, wheras the ``crypted_transfer_decode_dictentry`` method does +confidentiality, whereas the ``crypted_transfer_decode_dictentry`` method does guarantee minion-master confidentiality. diff --git a/doc/topics/troubleshooting/master.rst b/doc/topics/troubleshooting/master.rst index 3379a7b9a01..9700ffec795 100644 --- a/doc/topics/troubleshooting/master.rst +++ b/doc/topics/troubleshooting/master.rst @@ -222,7 +222,7 @@ Salt Master Auth Flooding In large installations, care must be taken not to overwhealm the master with authentication requests. Several options can be set on the master which -mitigate the chances of an authentication flood from causing an interuption in +mitigate the chances of an authentication flood from causing an interruption in service. .. note:: diff --git a/salt/modules/chocolatey.py b/salt/modules/chocolatey.py index c6323f446cc..6ba1668ee25 100644 --- a/salt/modules/chocolatey.py +++ b/salt/modules/chocolatey.py @@ -813,10 +813,10 @@ def add_source(name, source_location, username=None, password=None): Location of the source you want to work with. username - Provide username for chocolatey sources that need authentification credentials. + Provide username for chocolatey sources that need authentication credentials. password - Provide password for chocolatey sources that need authentification credentials. + Provide password for chocolatey sources that need authentication credentials. CLI Example: diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index f89518ee43e..b5d36383f3f 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -2596,7 +2596,7 @@ def powershell(cmd, This passes the cmd argument directly to PowerShell without any further processing! Be absolutely sure that you - have properly santized the command passed to this function + have properly sanitized the command passed to this function and do not use untrusted inputs. Note that ``env`` represents the environment variables for the command, and diff --git a/salt/modules/dockercompose.py b/salt/modules/dockercompose.py index 98af76af9e2..0f474af24ca 100644 --- a/salt/modules/dockercompose.py +++ b/salt/modules/dockercompose.py @@ -12,7 +12,7 @@ Module to import docker-compose via saltstack Introduction ------------ -This module allows to deal with docker-compose file in a directory. +This module allows one to deal with docker-compose file in a directory. This is a first version only, the following commands are missing at the moment but will be built later on if the community is interested in this module: @@ -93,7 +93,7 @@ Functions - Manage containers image: - :py:func:`dockercompose.pull ` - :py:func:`dockercompose.build ` -- Gather informations about containers: +- Gather information about containers: - :py:func:`dockercompose.ps ` Detailed Function Documentation @@ -357,7 +357,7 @@ def build(path, service_names=None): python list, if omitted build images for all containers. Please note that at the moment the module does not allow you to upload your Dockerfile, nor any other file you could need with your docker-compose.yml, you will - have to make sure the files you need are actually in the directory sepcified + have to make sure the files you need are actually in the directory specified in the `build` keyword path diff --git a/salt/modules/file.py b/salt/modules/file.py index e04eddb7688..de2e3ee40c4 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -1674,7 +1674,7 @@ def replace(path, Replace occurrences of a pattern in a file. If ``show_changes`` is ``True``, then a diff of what changed will be returned, otherwise a - ``True`` will be returnd when changes are made, and ``False`` when + ``True`` will be returned when changes are made, and ``False`` when no changes are made. This is a pure Python implementation that wraps Python's :py:func:`~re.sub`. diff --git a/salt/modules/infoblox.py b/salt/modules/infoblox.py index f4bc700b09f..4187a36bc90 100644 --- a/salt/modules/infoblox.py +++ b/salt/modules/infoblox.py @@ -97,7 +97,7 @@ def delete_record(name, the infoblox user's password (can also use the infolblox:password pillar) infoblox_api_version - the infoblox api verison to use + the infoblox api version to use sslVerify should ssl verification be done on the connection to the Infoblox REST API @@ -174,7 +174,7 @@ def update_record(name, the infoblox user's password (can also use the infolblox:password pillar) infoblox_api_version - the infoblox api verison to use + the infoblox api version to use sslVerify should ssl verification be done on the connection to the Infoblox REST API @@ -268,7 +268,7 @@ def add_record(name, the infoblox user's password (can also use the infolblox:password pillar) infoblox_api_version - the infoblox api verison to use + the infoblox api version to use sslVerify should ssl verification be done on the connection to the Infoblox REST API @@ -351,7 +351,7 @@ def get_network(network_name, the infoblox user's password (can also use the infolblox:password pillar) infoblox_api_version - the infoblox api verison to use + the infoblox api version to use sslVerify should ssl verification be done on the connection to the Infoblox REST API @@ -424,7 +424,7 @@ def get_record(record_name, the infoblox DNS view to search, if not specified all views are searched infoblox_api_version - the infoblox api verison to use + the infoblox api version to use sslVerify should ssl verification be done on the connection to the Infoblox REST API diff --git a/salt/modules/opkg.py b/salt/modules/opkg.py index ee6a817a88a..01f3998848d 100644 --- a/salt/modules/opkg.py +++ b/salt/modules/opkg.py @@ -12,7 +12,7 @@ Support for Opkg .. note:: - For version comparision support, the ``opkg-utils`` package must be + For version comparison support, the ``opkg-utils`` package must be installed. ''' diff --git a/salt/modules/smartos_vmadm.py b/salt/modules/smartos_vmadm.py index 2c6aaaaddbc..007c8cb16ed 100644 --- a/salt/modules/smartos_vmadm.py +++ b/salt/modules/smartos_vmadm.py @@ -406,10 +406,10 @@ def lookup(search=None, order=None, one=False): def sysrq(vm, action='nmi', key='uuid'): ''' - Send non-maskable interupt to vm or capture a screenshot + Send non-maskable interrupt to vm or capture a screenshot vm : string - vm to be targetted + vm to be targeted action : string nmi or screenshot -- Default: nmi key : string [uuid|alias|hostname] @@ -490,7 +490,7 @@ def get(vm, key='uuid'): Output the JSON object describing a VM vm : string - vm to be targetted + vm to be targeted key : string [uuid|alias|hostname] value type of 'vm' parameter @@ -527,7 +527,7 @@ def info(vm, info_type='all', key='uuid'): Lookup info on running kvm vm : string - vm to be targetted + vm to be targeted info_type : string [all|block|blockstats|chardev|cpus|kvm|pci|spice|version|vnc] info type to return key : string [uuid|alias|hostname] @@ -572,7 +572,7 @@ def create_snapshot(vm, name, key='uuid'): Create snapshot of a vm vm : string - vm to be targetted + vm to be targeted name : string snapshot name The snapname must be 64 characters or less @@ -625,7 +625,7 @@ def delete_snapshot(vm, name, key='uuid'): Delete snapshot of a vm vm : string - vm to be targetted + vm to be targeted name : string snapshot name The snapname must be 64 characters or less @@ -675,7 +675,7 @@ def rollback_snapshot(vm, name, key='uuid'): Rollback snapshot of a vm vm : string - vm to be targetted + vm to be targeted name : string snapshot name The snapname must be 64 characters or less diff --git a/salt/modules/solaris_fmadm.py b/salt/modules/solaris_fmadm.py index 59aaa6f267c..71cc3fd1b86 100644 --- a/salt/modules/solaris_fmadm.py +++ b/salt/modules/solaris_fmadm.py @@ -518,7 +518,7 @@ def faulty(): def healthy(): ''' - Return wether fmadm is reporting faults + Return whether fmadm is reporting faults CLI Example: diff --git a/salt/modules/status.py b/salt/modules/status.py index fe9b49d3684..029426b81df 100644 --- a/salt/modules/status.py +++ b/salt/modules/status.py @@ -1083,7 +1083,7 @@ def time_(format='%A, %d. %B %Y %I:%M%p'): .. versionadded:: 2016.3.0 Return the current time on the minion, - formated based on the format parameter. + formatted based on the format parameter. Default date format: Monday, 27. July 2015 07:55AM diff --git a/salt/modules/telemetry.py b/salt/modules/telemetry.py index 5dcd80d31c4..6c98266f8d8 100644 --- a/salt/modules/telemetry.py +++ b/salt/modules/telemetry.py @@ -155,7 +155,7 @@ def get_alert_config(deployment_id, metric_name=None, api_key=None, profile="tel def get_notification_channel_id(notify_channel, profile="telemetry"): ''' Given an email address, creates a notification-channels - if one is not found and also returns the corresponsing + if one is not found and also returns the corresponding notification channel id. notify_channel diff --git a/salt/modules/win_certutil.py b/salt/modules/win_certutil.py index c978bf6ef70..471cf2bee87 100644 --- a/salt/modules/win_certutil.py +++ b/salt/modules/win_certutil.py @@ -65,7 +65,7 @@ def add_store(source, store, saltenv='base'): Add the given cert into the given Certificate Store source - The source certficate file this can be in the form + The source certificate file this can be in the form salt://path/to/file store @@ -91,7 +91,7 @@ def del_store(source, store, saltenv='base'): Delete the given cert into the given Certificate Store source - The source certficate file this can be in the form + The source certificate file this can be in the form salt://path/to/file store diff --git a/salt/modules/win_task.py b/salt/modules/win_task.py index a97752332d7..710fd512456 100644 --- a/salt/modules/win_task.py +++ b/salt/modules/win_task.py @@ -520,7 +520,7 @@ def create_task_from_xml(name, (C:\Windows\System32\tasks). :param str xml_text: A string of xml representing the task to be created. - This will be overriden by `xml_path` if passed. + This will be overridden by `xml_path` if passed. :param str xml_path: The path to an XML file on the local system containing the xml that defines the task. This will override `xml_text` diff --git a/salt/modules/zfs.py b/salt/modules/zfs.py index 141b7a06732..83d5fd916b3 100644 --- a/salt/modules/zfs.py +++ b/salt/modules/zfs.py @@ -320,7 +320,7 @@ def list_(name=None, **kwargs): depth : int limit recursion to depth properties : string - comma-seperated list of properties to list, the name property will always be added + comma-separated list of properties to list, the name property will always be added type : string comma-separated list of types to display, where type is one of filesystem, snapshot, volume, bookmark, or all. @@ -885,7 +885,7 @@ def hold(tag, *snapshot, **kwargs): .. note:: - A comma-seperated list can be provided for the tag parameter to hold multiple tags. + A comma-separated list can be provided for the tag parameter to hold multiple tags. CLI Example: @@ -963,7 +963,7 @@ def release(tag, *snapshot, **kwargs): .. note:: - A comma-seperated list can be provided for the tag parameter to release multiple tags. + A comma-separated list can be provided for the tag parameter to release multiple tags. CLI Example: @@ -1192,7 +1192,7 @@ def get(*dataset, **kwargs): depth : int recursively list children to depth fields : string - comma-seperated list of fields to include, the name and property field will always be added + comma-separated list of fields to include, the name and property field will always be added type : string comma-separated list of types to display, where type is one of filesystem, snapshot, volume, bookmark, or all. diff --git a/salt/modules/zpool.py b/salt/modules/zpool.py index 41bf3ff417c..930fb18fbb1 100644 --- a/salt/modules/zpool.py +++ b/salt/modules/zpool.py @@ -345,7 +345,7 @@ def list_(properties='size,alloc,free,cap,frag,health', zpool=None): optional zpool .. note:: - multiple storage pool can be provded as a space seperated list + multiple storage pool can be provded as a space separated list CLI Example: @@ -1085,7 +1085,7 @@ def import_(zpool=None, new_name=None, **kwargs): altroot : string equivalent to "-o cachefile=none,altroot=root" dir : string - searches for devices or files in dir, mutiple dirs can be specified as follows:: dir="dir1,dir2" + searches for devices or files in dir, multiple dirs can be specified as follows:: dir="dir1,dir2" no_mount : boolean import the pool without mounting any file systems. only_destroyed : boolean diff --git a/salt/pillar/git_pillar.py b/salt/pillar/git_pillar.py index e0f0839a3cb..c5a4226e4f3 100644 --- a/salt/pillar/git_pillar.py +++ b/salt/pillar/git_pillar.py @@ -125,7 +125,7 @@ Configuring git_pillar for Salt releases 2015.8.0 and later will also be logged. Beginning with Salt version 2015.8.0, pygit2_ is now supported in addition to -GitPython_ (Dulwich_ will not be supported for the forseeable future). The +GitPython_ (Dulwich_ will not be supported for the foreseeable future). The requirements for GitPython_ and pygit2_ are the same as for gitfs, as described :ref:`here `. diff --git a/salt/pillar/stack.py b/salt/pillar/stack.py index 8eb49b51f74..c635879b808 100644 --- a/salt/pillar/stack.py +++ b/salt/pillar/stack.py @@ -77,8 +77,8 @@ You can also provide a list of config files: Select config files through grains|pillar|opts matching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You can also opt for a much more flexible configuration: PillarStack allows to -select the config files for the current minion based on matching values from +You can also opt for a much more flexible configuration: PillarStack allows one +to select the config files for the current minion based on matching values from either grains, or pillar, or opts objects. Here is an example of such a configuration, which should speak by itself: diff --git a/salt/runners/jobs.py b/salt/runners/jobs.py index 6e99d2b9f51..7340393a6ee 100644 --- a/salt/runners/jobs.py +++ b/salt/runners/jobs.py @@ -374,7 +374,7 @@ def list_jobs(ext_source=None, else: log.error( '\'dateutil\' library not available, skipping start_time ' - 'comparision.' + 'comparison.' ) if end_time and _match: @@ -387,7 +387,7 @@ def list_jobs(ext_source=None, else: log.error( '\'dateutil\' library not available, skipping end_time ' - 'comparision.' + 'comparison.' ) if _match: diff --git a/salt/states/kmod.py b/salt/states/kmod.py index 79306e1b509..a2c69177b87 100644 --- a/salt/states/kmod.py +++ b/salt/states/kmod.py @@ -15,7 +15,7 @@ module: kmod.absent: - name: pcspkr -Mutiple modules can be specified for both kmod.present and kmod.absent. +Multiple modules can be specified for both kmod.present and kmod.absent. .. code-block:: yaml diff --git a/salt/states/ldap.py b/salt/states/ldap.py index 39edc779a8c..e12ee23a0a4 100644 --- a/salt/states/ldap.py +++ b/salt/states/ldap.py @@ -21,7 +21,7 @@ log = logging.getLogger(__name__) def managed(name, entries, connect_spec=None): - '''Ensure the existance (or not) of LDAP entries and their attributes + '''Ensure the existence (or not) of LDAP entries and their attributes Example: diff --git a/salt/states/mac_xattr.py b/salt/states/mac_xattr.py index dd57851477c..c221eb65186 100644 --- a/salt/states/mac_xattr.py +++ b/salt/states/mac_xattr.py @@ -42,7 +42,7 @@ def exists(name, attributes): attributes The attributes that should exist on the file/directory, this is accepted as an array, with key and value split with an equals sign, if you want to specify - a hex value then add 0x to the begining of the value. + a hex value then add 0x to the beginning of the value. ''' ret = {'name': name, diff --git a/salt/utils/context.py b/salt/utils/context.py index 6c0b129551b..1021584bb86 100644 --- a/salt/utils/context.py +++ b/salt/utils/context.py @@ -69,14 +69,14 @@ class ContextDict(collections.MutableMapping): def __init__(self, **data): # state should be thread local, so this object can be threadsafe self._state = threading.local() - # variable for the overriden data + # variable for the overridden data self._state.data = None self.global_data = {} @property def active(self): - '''Determine if this ContextDict is currently overriden - Since the ContextDict can be overriden in each thread, we check whether + '''Determine if this ContextDict is currently overridden + Since the ContextDict can be overridden in each thread, we check whether the _state.data is set or not. ''' try: diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py index 93a10c88500..6c5abc96423 100644 --- a/salt/utils/gitfs.py +++ b/salt/utils/gitfs.py @@ -2783,7 +2783,7 @@ class GitPillar(GitBase): def __init__(self, opts): self.role = 'git_pillar' # Dulwich has no function to check out a branch/tag, so this will be - # limited to GitPython and Pygit2 for the forseeable future. + # limited to GitPython and Pygit2 for the foreseeable future. GitBase.__init__(self, opts, valid_providers=('gitpython', 'pygit2')) @@ -2824,7 +2824,7 @@ class WinRepo(GitBase): def __init__(self, opts, winrepo_dir): self.role = 'winrepo' # Dulwich has no function to check out a branch/tag, so this will be - # limited to GitPython and Pygit2 for the forseeable future. + # limited to GitPython and Pygit2 for the foreseeable future. GitBase.__init__(self, opts, valid_providers=('gitpython', 'pygit2'), diff --git a/tests/unit/modules/postgres_test.py b/tests/unit/modules/postgres_test.py index d63f9d711e5..a74f27f5c44 100644 --- a/tests/unit/modules/postgres_test.py +++ b/tests/unit/modules/postgres_test.py @@ -913,7 +913,7 @@ class PostgresTestCase(TestCase): @patch('salt.modules.postgres.language_exists', Mock(return_value=True)) def test_language_exists(self): ''' - Test language existance check + Test language existence check ''' ret = postgres.language_exists( 'sql', From 4625ee65b8ec8fda8635adb8eccf943b39dc4821 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Mon, 18 Jul 2016 09:12:18 -0600 Subject: [PATCH 13/13] Remove unnedeed config test Refs #34607 --- tests/unit/config/config_test.py | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 42c5f9bcbdc..9a78247738a 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -18,7 +18,7 @@ from contextlib import contextmanager # Import Salt Testing libs from salttesting import TestCase from salttesting.mock import MagicMock, patch -from salttesting.helpers import ensure_in_syspath, TestsLoggingHandler +from salttesting.helpers import ensure_in_syspath from salt.exceptions import CommandExecutionError ensure_in_syspath('../') @@ -364,34 +364,6 @@ class ConfigTestCase(TestCase, integration.AdaptedConfigurationTestCaseMixIn): self.assertEqual(syndic_opts['_master_conf_file'], minion_conf_path) self.assertEqual(syndic_opts['_minion_conf_file'], syndic_conf_path) - def test_issue_6714_parsing_errors_logged(self): - try: - tempdir = tempfile.mkdtemp(dir=integration.SYS_TMP_DIR) - test_config = os.path.join(tempdir, 'config') - - # Let's populate a master configuration file with some basic - # settings - salt.utils.fopen(test_config, 'w').write( - 'root_dir: {0}\n' - 'log_file: {0}/foo.log\n'.format(tempdir) + - '\n\n\n' - 'blah:false\n' - ) - - with TestsLoggingHandler() as handler: - # Let's load the configuration - config = sconfig.master_config(test_config) - for message in handler.messages: - if message.startswith('ERROR:Error parsing configuration'): - break - else: - raise AssertionError( - 'No parsing error message was logged' - ) - finally: - if os.path.isdir(tempdir): - shutil.rmtree(tempdir) - @patch('salt.utils.network.get_fqhostname', MagicMock(return_value='localhost')) def test_get_id_etc_hostname(self): '''