From c676846066139095cfc3ca8317b4bb2ef2268eca Mon Sep 17 00:00:00 2001 From: Mike Place Date: Thu, 8 Dec 2016 13:01:10 -0700 Subject: [PATCH 01/17] Kill pkg_resources for CLI tools --- salt/cli/call.py | 2 ++ salt/cli/cp.py | 2 ++ salt/cli/key.py | 3 +++ salt/cli/run.py | 2 ++ salt/cli/salt.py | 3 ++- salt/cli/spm.py | 2 ++ 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/salt/cli/call.py b/salt/cli/call.py index b7cc235deb5..4712e731d84 100644 --- a/salt/cli/call.py +++ b/salt/cli/call.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import +import sys +sys.modules['pkg_resources'] = None import os from salt.utils import parsers diff --git a/salt/cli/cp.py b/salt/cli/cp.py index 601c17461e2..63d35fec71f 100644 --- a/salt/cli/cp.py +++ b/salt/cli/cp.py @@ -9,6 +9,8 @@ Salt-cp can be used to distribute configuration files # Import python libs from __future__ import print_function from __future__ import absolute_import +import sys +sys.modules['pkg_resources'] = None import os import sys diff --git a/salt/cli/key.py b/salt/cli/key.py index d89c3c3b174..990925a8697 100644 --- a/salt/cli/key.py +++ b/salt/cli/key.py @@ -1,6 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import +import sys +sys.modules['pkg_resources'] = None + from salt.utils import parsers from salt.utils.verify import check_user, verify_log diff --git a/salt/cli/run.py b/salt/cli/run.py index cb8437999d2..fa286c7446c 100644 --- a/salt/cli/run.py +++ b/salt/cli/run.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import +import sys +sys.modules['pkg_resources'] = None from salt.utils import parsers from salt.utils import activate_profile diff --git a/salt/cli/salt.py b/salt/cli/salt.py index a00d8a21f99..1fc9a835082 100644 --- a/salt/cli/salt.py +++ b/salt/cli/salt.py @@ -2,8 +2,9 @@ # Import python libs from __future__ import absolute_import, print_function -import os import sys +sys.modules['pkg_resources'] = None +import os # Import Salt libs from salt.ext.six import string_types diff --git a/salt/cli/spm.py b/salt/cli/spm.py index 3d347c80a8d..a7e8fc72c69 100644 --- a/salt/cli/spm.py +++ b/salt/cli/spm.py @@ -10,6 +10,8 @@ # Import Python libs from __future__ import absolute_import +import sys +sys.modules['pkg_resources'] = None # Import Salt libs import salt.spm From bb3af72317ef6dd93a7b13a4d5157315eb945c22 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Fri, 9 Dec 2016 12:24:28 -0700 Subject: [PATCH 02/17] Remove from salt-call --- salt/cli/call.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/salt/cli/call.py b/salt/cli/call.py index 4712e731d84..b7cc235deb5 100644 --- a/salt/cli/call.py +++ b/salt/cli/call.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import -import sys -sys.modules['pkg_resources'] = None import os from salt.utils import parsers From 6a30fe6aeb64d5cb10f6b1961b26772e2515910c Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 22 Dec 2016 15:35:30 +0100 Subject: [PATCH 03/17] Update PillarStack stack.py to latest upstream version which provides a fix for issue https://github.com/bbinet/pillarstack/issues/6 --- salt/pillar/stack.py | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/salt/pillar/stack.py b/salt/pillar/stack.py index 3d5d7104c50..1a2564a1f76 100644 --- a/salt/pillar/stack.py +++ b/salt/pillar/stack.py @@ -105,7 +105,9 @@ are jinja2 templates which must render as a simple ordered list of ``yaml`` files that will then be merged to build pillar data. The path of these ``yaml`` files must be relative to the directory of the -PillarStack config file. +PillarStack config file. These paths support unix style pathname pattern +expansion through the +`Python glob module `. The following variables are available in jinja2 templating of PillarStack configuration files: @@ -128,6 +130,7 @@ For example, you could have a PillarStack config file which looks like: $ cat /path/to/stack/config.cfg core.yml + common/*.yml osarchs/{{ __grains__['osarch'] }}.yml oscodenames/{{ __grains__['oscodename'] }}.yml {%- for role in pillar.get('roles', []) %} @@ -143,6 +146,9 @@ And the whole directory structure could look like: /path/to/stack/ ├── config.cfg ├── core.yml + ├── common/ + │   ├── xxx.yml + │   └── yyy.yml ├── osarchs/ │   ├── amd64.yml │   └── armhf.yml @@ -164,6 +170,8 @@ amd64 platform running Debian Jessie, and which pillar ``roles`` is ``["db"]``, the following ``yaml`` files would be merged in order: - ``core.yml`` +- ``common/xxx.yml`` +- ``common/yyy.yml`` - ``osarchs/amd64.yml`` - ``oscodenames/jessie.yml`` - ``roles/db.yml`` @@ -371,11 +379,14 @@ from __future__ import absolute_import import os import logging from functools import partial +from glob import glob + import yaml from jinja2 import FileSystemLoader, Environment, TemplateNotFound # Import Salt libs import salt.ext.six as six +import salt.utils log = logging.getLogger(__name__) @@ -383,7 +394,6 @@ strategies = ('overwrite', 'merge-first', 'merge-last', 'remove') def ext_pillar(minion_id, pillar, *args, **kwargs): - import salt.utils stack = {} stack_config_files = list(args) traverse = { @@ -417,28 +427,28 @@ def _process_stack_cfg(cfg, stack, minion_id, pillar): "__opts__": __opts__, "__salt__": __salt__, "__grains__": __grains__, + "__stack__": { 'traverse': salt.utils.traverse_dict_and_list }, "minion_id": minion_id, "pillar": pillar, }) - for path in _parse_stack_cfg(jenv.get_template(filename).render(stack=stack)): - try: + for item in _parse_stack_cfg( + jenv.get_template(filename).render(stack=stack)): + if not item.strip(): + continue # silently ignore whitespace or empty lines + paths = glob(os.path.join(basedir, item)) + if not paths: + log.warning('Ignoring pillar stack template "{0}": can\'t find from ' + 'root dir "{1}"'.format(item, basedir)) + continue + for path in sorted(paths): log.debug('YAML: basedir={0}, path={1}'.format(basedir, path)) - obj = yaml.safe_load(jenv.get_template(path).render(stack=stack)) + obj = yaml.safe_load(jenv.get_template( + os.path.relpath(path, basedir)).render(stack=stack)) if not isinstance(obj, dict): log.info('Ignoring pillar stack template "{0}": Can\'t parse ' 'as a valid yaml dictionary'.format(path)) continue stack = _merge_dict(stack, obj) - except TemplateNotFound as e: - if hasattr(e, 'name') and e.name != path: - log.info('Jinja include file "{0}" not found ' - 'from root dir "{1}", which was included ' - 'by stack template "{2}"'.format( - e.name, basedir, path)) - else: - log.info('Ignoring pillar stack template "{0}": can\'t find from ' - 'root dir "{1}"'.format(path, basedir)) - continue return stack From b66b4bd0604d441eef715d4b5b00be46aa241e3f Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 22 Dec 2016 17:29:45 +0100 Subject: [PATCH 04/17] Fix lint violations in stack.py --- salt/pillar/stack.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/salt/pillar/stack.py b/salt/pillar/stack.py index 1a2564a1f76..09159ba4a4c 100644 --- a/salt/pillar/stack.py +++ b/salt/pillar/stack.py @@ -382,7 +382,7 @@ from functools import partial from glob import glob import yaml -from jinja2 import FileSystemLoader, Environment, TemplateNotFound +from jinja2 import FileSystemLoader, Environment # Import Salt libs import salt.ext.six as six @@ -427,7 +427,9 @@ def _process_stack_cfg(cfg, stack, minion_id, pillar): "__opts__": __opts__, "__salt__": __salt__, "__grains__": __grains__, - "__stack__": { 'traverse': salt.utils.traverse_dict_and_list }, + "__stack__": { + 'traverse': salt.utils.traverse_dict_and_list + }, "minion_id": minion_id, "pillar": pillar, }) From f28e33b9b6696d4affc0ca7d0b276cdc0fafc8e3 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Thu, 22 Dec 2016 12:44:50 -0700 Subject: [PATCH 05/17] Remove from all but salt cli --- salt/cli/cp.py | 2 -- salt/cli/key.py | 2 -- salt/cli/run.py | 2 -- salt/cli/spm.py | 2 -- salt/client/__init__.py | 2 +- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/salt/cli/cp.py b/salt/cli/cp.py index 63d35fec71f..601c17461e2 100644 --- a/salt/cli/cp.py +++ b/salt/cli/cp.py @@ -9,8 +9,6 @@ Salt-cp can be used to distribute configuration files # Import python libs from __future__ import print_function from __future__ import absolute_import -import sys -sys.modules['pkg_resources'] = None import os import sys diff --git a/salt/cli/key.py b/salt/cli/key.py index 990925a8697..1454a2b43c4 100644 --- a/salt/cli/key.py +++ b/salt/cli/key.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import -import sys -sys.modules['pkg_resources'] = None from salt.utils import parsers diff --git a/salt/cli/run.py b/salt/cli/run.py index fa286c7446c..cb8437999d2 100644 --- a/salt/cli/run.py +++ b/salt/cli/run.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import -import sys -sys.modules['pkg_resources'] = None from salt.utils import parsers from salt.utils import activate_profile diff --git a/salt/cli/spm.py b/salt/cli/spm.py index a7e8fc72c69..3d347c80a8d 100644 --- a/salt/cli/spm.py +++ b/salt/cli/spm.py @@ -10,8 +10,6 @@ # Import Python libs from __future__ import absolute_import -import sys -sys.modules['pkg_resources'] = None # Import Salt libs import salt.spm diff --git a/salt/client/__init__.py b/salt/client/__init__.py index 796d1eaaaef..50c9dee594c 100644 --- a/salt/client/__init__.py +++ b/salt/client/__init__.py @@ -31,7 +31,7 @@ import salt.config import salt.cache import salt.payload import salt.transport -import salt.loader +#import salt.loader import salt.utils import salt.utils.args import salt.utils.event From ec6901720a2453ac7b84acf36f274dab6b18ad63 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Thu, 22 Dec 2016 13:04:36 -0700 Subject: [PATCH 06/17] Remove debugging --- salt/client/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/client/__init__.py b/salt/client/__init__.py index 50c9dee594c..796d1eaaaef 100644 --- a/salt/client/__init__.py +++ b/salt/client/__init__.py @@ -31,7 +31,7 @@ import salt.config import salt.cache import salt.payload import salt.transport -#import salt.loader +import salt.loader import salt.utils import salt.utils.args import salt.utils.event From d79d682e8b038f30eb959e774f07e358518982b2 Mon Sep 17 00:00:00 2001 From: Gunther Stengl Date: Fri, 23 Dec 2016 14:09:38 +0100 Subject: [PATCH 07/17] fixed typo: lq command-line syntax At least for Ubuntu's and FreeBSD's version of lq the syntax is: lq --color-output --- salt/runners/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/runners/state.py b/salt/runners/state.py index 106a42bdb6b..bf32e7851c4 100644 --- a/salt/runners/state.py +++ b/salt/runners/state.py @@ -186,7 +186,7 @@ def event(tagmatch='*', # Watch the event bus forever in a shell while-loop. salt-run state.event | while read -r tag data; do echo $tag - echo $data | jq -colour-output . + echo $data | jq --color-output . done .. seealso:: From b2925ad7b7db58f5d748266d8eadb8b2d3ca4957 Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Mon, 26 Dec 2016 12:09:47 -0500 Subject: [PATCH 08/17] Adds new import required for `extract_hash` Fixes #38443 --- salt/modules/win_file.py | 1 + 1 file changed, 1 insertion(+) diff --git a/salt/modules/win_file.py b/salt/modules/win_file.py index 8ee019f3226..30c6a62cdbc 100644 --- a/salt/modules/win_file.py +++ b/salt/modules/win_file.py @@ -27,6 +27,7 @@ import hashlib # do not remove, used in imported file.py functions import errno # do not remove, used in imported file.py functions import shutil # do not remove, used in imported file.py functions import re # do not remove, used in imported file.py functions +import string # do not remove, used in imported file.py functions import sys # do not remove, used in imported file.py functions import fileinput # do not remove, used in imported file.py functions import fnmatch # do not remove, used in imported file.py functions From c3ab954c6e5a424d10ed414f9d0a3449a38300cb Mon Sep 17 00:00:00 2001 From: Andreas Lutro Date: Tue, 27 Dec 2016 13:04:48 +0100 Subject: [PATCH 09/17] improvements/fixes to kapacitor task change detection make sure to check for changes in db/rp/task type as well as the script itself --- salt/states/kapacitor.py | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/salt/states/kapacitor.py b/salt/states/kapacitor.py index 5f49ed0410b..06350ff20f9 100644 --- a/salt/states/kapacitor.py +++ b/salt/states/kapacitor.py @@ -72,16 +72,23 @@ def task_present(name, with salt.utils.fopen(script_path, 'r') as file: new_script = file.read().replace('\t', ' ') - if old_script == new_script: + is_up_to_date = old_script == new_script and task_type == task['type'] and \ + task['dbrps'] == [{'db': database, 'rp': retention_policy}] + + if is_up_to_date: comments.append('Task script is already up-to-date') else: if __opts__['test']: ret['result'] = None comments.append('Task would have been updated') else: - result = __salt__['kapacitor.define_task'](name, script_path, - task_type=task_type, database=database, - retention_policy=retention_policy) + result = __salt__['kapacitor.define_task']( + name, + script_path, + task_type=task_type, + database=database, + retention_policy=retention_policy + ) ret['result'] = result['success'] if not ret['result']: comments.append('Could not define task') @@ -89,11 +96,25 @@ def task_present(name, comments.append(result['stderr']) ret['comment'] = '\n'.join(comments) return ret - ret['changes']['TICKscript diff'] = '\n'.join(difflib.unified_diff( - old_script.splitlines(), - new_script.splitlines(), - )) - comments.append('Task script updated') + + if old_script != new_script: + ret['changes']['TICKscript diff'] = '\n'.join(difflib.unified_diff( + old_script.splitlines(), + new_script.splitlines(), + )) + comments.append('Task script updated') + + if not task or task['type'] != task_type: + ret['changes']['type'] = task_type + comments.append('Task type updated') + + if not task or task['dbrps'][0]['db'] != database: + ret['changes']['db'] = database + comments.append('Task database updated') + + if not task or task['dbrps'][0]['rp'] != retention_policy: + ret['changes']['rp'] = retention_policy + comments.append('Task retention policy updated') if enable: if task and task['enabled']: From c20111142f92e5acc6007a1e73b5ea00590d3b7c Mon Sep 17 00:00:00 2001 From: twangboy Date: Tue, 27 Dec 2016 16:56:09 -0700 Subject: [PATCH 10/17] Gate Windows Utils --- salt/utils/win_functions.py | 6 +++--- salt/utils/win_osinfo.py | 29 ++++++++++++++++++++++++----- salt/utils/win_runas.py | 14 +++++++------- salt/utils/winservice.py | 24 ++++++++++++++++++++---- 4 files changed, 54 insertions(+), 19 deletions(-) diff --git a/salt/utils/win_functions.py b/salt/utils/win_functions.py index df44ce63330..a3e758b4ceb 100644 --- a/salt/utils/win_functions.py +++ b/salt/utils/win_functions.py @@ -22,12 +22,12 @@ except ImportError: HAS_WIN32 = False +# Although utils are often directly imported, it is also possible to use the +# loader. def __virtual__(): ''' - Load only on Windows with necessary modules + Only load if Win32 Libraries are installed ''' - if not salt.utils.is_windows(): - return False, 'This utility only works on Windows' if not HAS_WIN32: return False, 'This utility requires pywin32' diff --git a/salt/utils/win_osinfo.py b/salt/utils/win_osinfo.py index 7ad789c2df5..bdaefb254a2 100644 --- a/salt/utils/win_osinfo.py +++ b/salt/utils/win_osinfo.py @@ -1,14 +1,32 @@ # -*- coding: utf-8 -*- ''' -Get Versioning information from Windows +Get Version information from Windows ''' # http://stackoverflow.com/questions/32300004/python-ctypes-getting-0-with-getversionex-function from __future__ import absolute_import +# Import Third Party Libs import ctypes -from ctypes.wintypes import BYTE, WORD, DWORD, WCHAR +try: + from ctypes.wintypes import BYTE, WORD, DWORD, WCHAR + HAS_WIN32 = True +except (ImportError, ValueError): + HAS_WIN32 = False -kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) +if HAS_WIN32: + kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) + + +# Although utils are often directly imported, it is also possible to use the +# loader. +def __virtual__(): + ''' + Only load if Win32 Libraries are installed + ''' + if not HAS_WIN32: + return False, 'This utility requires pywin32' + + return 'win_osinfo' class OSVERSIONINFO(ctypes.Structure): @@ -38,8 +56,9 @@ def errcheck_bool(result, func, args): raise ctypes.WinError(ctypes.get_last_error()) return args -kernel32.GetVersionExW.errcheck = errcheck_bool -kernel32.GetVersionExW.argtypes = (ctypes.POINTER(OSVERSIONINFO),) +if HAS_WIN32: + kernel32.GetVersionExW.errcheck = errcheck_bool + kernel32.GetVersionExW.argtypes = (ctypes.POINTER(OSVERSIONINFO),) def get_os_version_info(): diff --git a/salt/utils/win_runas.py b/salt/utils/win_runas.py index 17110e5128a..7d5b6fce012 100644 --- a/salt/utils/win_runas.py +++ b/salt/utils/win_runas.py @@ -27,20 +27,20 @@ try: except ImportError: HAS_WIN32 = False -# Import Salt Libs -import salt.utils - # Set up logging log = logging.getLogger(__name__) +# Although utils are often directly imported, it is also possible to use the +# loader. def __virtual__(): ''' - Load only on Windows + Only load if Win32 Libraries are installed ''' - if salt.utils.is_windows() and HAS_WIN32: - return 'win_runas' - return False + if not HAS_WIN32: + return False, 'This utility requires pywin32' + + return 'win_runas' if HAS_WIN32: diff --git a/salt/utils/winservice.py b/salt/utils/winservice.py index 3ad3ce5b9c4..64eff0ef586 100644 --- a/salt/utils/winservice.py +++ b/salt/utils/winservice.py @@ -8,10 +8,26 @@ from os.path import splitext, abspath from sys import modules # Import third party libs -import win32serviceutil -import win32service -import win32event -import win32api +try: + import win32serviceutil + import win32service + import win32event + import win32api + HAS_WIN32 = True +except ImportError: + HAS_WIN32 = False + + +# Although utils are often directly imported, it is also possible to use the +# loader. +def __virtual__(): + ''' + Only load if Win32 Libraries are installed + ''' + if not HAS_WIN32: + return False, 'This utility requires pywin32' + + return 'winservice' class Service(win32serviceutil.ServiceFramework): From d34d110a8462b2dc7e0f102939057160895431b1 Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 28 Dec 2016 10:06:40 -0700 Subject: [PATCH 11/17] Fix lint, fix boto module --- salt/modules/boto_kms.py | 2 +- salt/utils/win_functions.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/salt/modules/boto_kms.py b/salt/modules/boto_kms.py index 9c9ca940356..233c6bc9719 100644 --- a/salt/modules/boto_kms.py +++ b/salt/modules/boto_kms.py @@ -64,7 +64,7 @@ try: # pylint: enable=unused-import logging.getLogger('boto').setLevel(logging.CRITICAL) HAS_BOTO = True -except ImportError: +except (ImportError, AttributeError): HAS_BOTO = False diff --git a/salt/utils/win_functions.py b/salt/utils/win_functions.py index a3e758b4ceb..c8e52528c8e 100644 --- a/salt/utils/win_functions.py +++ b/salt/utils/win_functions.py @@ -6,9 +6,6 @@ missing functions in other modules from __future__ import absolute_import from salt.exceptions import CommandExecutionError -# Import Salt Libs -import salt.utils - # Import 3rd Party Libs try: import ntsecuritycon From 810471b9cd250c0757da931ab6116aca602fd73b Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 28 Dec 2016 13:34:28 -0700 Subject: [PATCH 12/17] Fix problem with some services getting access denied --- salt/modules/win_service.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/salt/modules/win_service.py b/salt/modules/win_service.py index 6d156ad9e3c..47e1e8441aa 100644 --- a/salt/modules/win_service.py +++ b/salt/modules/win_service.py @@ -92,9 +92,11 @@ def __virtual__(): Only works on Windows systems with PyWin32 installed ''' if not salt.utils.is_windows(): - return (False, 'Module win_service: module only works on Windows.') + return False, 'Module win_service: module only works on Windows.' + if not HAS_WIN32_MODS: - return (False, 'Module win_service: failed to load win32 modules') + return False, 'Module win_service: failed to load win32 modules' + return __virtualname__ @@ -654,13 +656,15 @@ def modify(name, ''' # https://msdn.microsoft.com/en-us/library/windows/desktop/ms681987(v=vs.85).aspx # https://msdn.microsoft.com/en-us/library/windows/desktop/ms681988(v-vs.85).aspx - handle_scm = win32service.OpenSCManager( None, None, win32service.SC_MANAGER_CONNECT) try: handle_svc = win32service.OpenService( - handle_scm, name, win32service.SERVICE_ALL_ACCESS) + handle_scm, + name, + win32service.SERVICE_CHANGE_CONFIG | + win32service.SERVICE_QUERY_CONFIG) except pywintypes.error as exc: raise CommandExecutionError( 'Failed To Open {0}: {1}'.format(name, exc[2])) From e96bfe8fa2bba7ecb825311c798bff6a2df4c1ae Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 28 Dec 2016 14:49:46 -0700 Subject: [PATCH 13/17] Change OSX/OS X to macOS where possible --- HACKING.rst | 8 ++-- doc/topics/beacons/index.rst | 2 +- doc/topics/cloud/install/index.rst | 2 +- doc/topics/development/hacking.rst | 8 ++-- doc/topics/development/tests/integration.rst | 6 +-- doc/topics/installation/osx.rst | 16 +++---- doc/topics/releases/0.17.0.rst | 6 +-- doc/topics/releases/0.17.2.rst | 2 +- doc/topics/releases/2016.3.0.rst | 2 +- doc/topics/troubleshooting/index.rst | 2 +- doc/topics/tutorials/index.rst | 2 +- doc/topics/tutorials/walkthrough_macosx.rst | 30 ++++++------ pkg/osx/README.md | 42 ++++++++-------- pkg/osx/build.sh | 6 +-- pkg/osx/build_env.sh | 6 +-- pkg/osx/build_pkg.sh | 6 +-- pkg/osx/build_sig.sh | 4 +- pkg/osx/pkg-scripts/postinstall | 2 +- pkg/osx/pkg-scripts/preinstall | 4 +- salt/beacons/inotify.py | 2 +- salt/grains/core.py | 2 +- salt/master.py | 4 +- salt/modules/launchctl.py | 2 +- salt/modules/mac_assistive.py | 5 +- salt/modules/mac_brew.py | 2 +- salt/modules/mac_desktop.py | 4 +- salt/modules/mac_package.py | 2 +- salt/modules/mac_pkgutil.py | 4 +- salt/modules/mac_ports.py | 2 +- salt/modules/mac_power.py | 8 ++-- salt/modules/mac_service.py | 12 ++--- salt/modules/mac_shadow.py | 18 +++---- salt/modules/mac_sysctl.py | 4 +- salt/modules/mac_system.py | 2 +- salt/modules/mac_timezone.py | 8 ++-- salt/modules/network.py | 2 +- salt/modules/npm.py | 2 +- salt/modules/osquery.py | 48 +++++++++---------- salt/modules/proxy.py | 24 ++++++---- salt/modules/rbenv.py | 2 +- salt/modules/system_profiler.py | 2 +- salt/modules/timezone.py | 2 +- salt/states/mac_assistive.py | 6 +-- salt/states/mac_defaults.py | 2 +- salt/states/mac_keychain.py | 6 +-- salt/states/mac_package.py | 4 +- salt/states/mac_xattr.py | 2 +- salt/states/proxy.py | 3 +- salt/utils/__init__.py | 2 +- tests/integration/__init__.py | 4 +- .../files/engines/runtests_engine.py | 2 +- tests/integration/modules/mac_brew.py | 2 +- tests/integration/modules/mac_pkgutil.py | 2 +- tests/integration/modules/mac_ports.py | 2 +- tests/integration/modules/mac_service.py | 2 +- tests/integration/modules/mac_shadow.py | 2 +- .../integration/modules/mac_softwareupdate.py | 2 +- tests/integration/modules/mac_timezone.py | 2 +- tests/integration/modules/mac_xattr.py | 2 +- tests/integration/modules/sysctl.py | 2 +- tests/unit/modules/mac_keychain_test.py | 6 +-- tests/unit/modules/proxy_test.py | 28 +++++------ tests/unit/states/mac_keychain_test.py | 18 ++++--- tests/unit/states/proxy_test.py | 8 ++-- 64 files changed, 219 insertions(+), 209 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index c31ce5ace69..090a9cd38c9 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -110,10 +110,10 @@ You can use it doing the following:: ./fedora_setup.sh install -Installing dependencies on OS X -``````````````````````````````` +Installing dependencies on macOS +```````````````````````````````` -One simple way to get all needed dependencies on OS X is to use homebrew, +One simple way to get all needed dependencies on macOS is to use homebrew, and install the following packages:: brew install swig @@ -212,7 +212,7 @@ Edit the master config file: ``/path/to/your/virtualenv/salt-master.pid``. 4. If you are also running a non-development version of Salt you will have to change the ``publish_port`` and ``ret_port`` values as well. -5. On OS X also set max_open_files to 2048. +5. On xxxOS X also set max_open_files to 2048. Edit the minion config file: diff --git a/doc/topics/beacons/index.rst b/doc/topics/beacons/index.rst index 54d0600d9d4..0fe50ba8a4c 100644 --- a/doc/topics/beacons/index.rst +++ b/doc/topics/beacons/index.rst @@ -48,7 +48,7 @@ minion pillar, grains, or local config file. .. note:: The `inotify` beacon only works on OSes that have `inotify` kernel support. - Currently this excludes FreeBSD, Mac OS X, and Windows. + Currently this excludes FreeBSD, macOS, and Windows. Beacon Monitoring Interval -------------------------- diff --git a/doc/topics/cloud/install/index.rst b/doc/topics/cloud/install/index.rst index 7bab0666266..f551aba5aeb 100644 --- a/doc/topics/cloud/install/index.rst +++ b/doc/topics/cloud/install/index.rst @@ -12,7 +12,7 @@ On Ubuntu, install Salt Cloud by using following command: sudo apt-get update sudo apt-get install salt-cloud -If using Salt Cloud on OS X, ``curl-ca-bundle`` must be installed. Presently, +If using Salt Cloud on macOS, ``curl-ca-bundle`` must be installed. Presently, this package is not available via ``brew``, but it is available using MacPorts: .. code-block:: bash diff --git a/doc/topics/development/hacking.rst b/doc/topics/development/hacking.rst index 2707480157d..ea25f44080f 100644 --- a/doc/topics/development/hacking.rst +++ b/doc/topics/development/hacking.rst @@ -109,10 +109,10 @@ Install Salt (and dependencies) into the virtualenv: .. _`Fedora Linux`: http://fedoraproject.org/ .. _`Amazon Linux`: https://aws.amazon.com/amazon-linux-ami/ -.. note:: Installing dependencies on OS X. +.. note:: Installing dependencies on macOS. - You can install needed dependencies on OS X using homebrew or macports. - See :ref:`OS X Installation ` + You can install needed dependencies on macOS using homebrew or macports. + See :ref:`macOS Installation ` .. warning:: Installing on RedHat-based Distros @@ -221,7 +221,7 @@ If you would like to log to the console instead of to the log file, remove the # use 'limit descriptors 2047' for c-shell ulimit -n 2047 - To set file descriptors on OSX, refer to the :ref:`OS X Installation + To set file descriptors on macOS, refer to the :ref:`macOS Installation ` instructions. diff --git a/doc/topics/development/tests/integration.rst b/doc/topics/development/tests/integration.rst index ecc37b36809..57c10e31f02 100644 --- a/doc/topics/development/tests/integration.rst +++ b/doc/topics/development/tests/integration.rst @@ -82,9 +82,9 @@ test suite illustrating the broad usefulness of each function. The ``setUp`` function is used to set up any repetitive or useful tasks that the tests in a test class need before running. For example, any of the ``mac_*`` -integration tests should only run on OSX machines. The ``setUp`` function can be -used to test for the presence of the ``Darwin`` kernel. If the ``Darwin`` kernel -is not present, then the test should be skipped. +integration tests should only run on macOS machines. The ``setUp`` function can +be used to test for the presence of the ``Darwin`` kernel. If the ``Darwin`` +kernel is not present, then the test should be skipped. .. code-block:: python diff --git a/doc/topics/installation/osx.rst b/doc/topics/installation/osx.rst index 676e8255268..399c597a250 100644 --- a/doc/topics/installation/osx.rst +++ b/doc/topics/installation/osx.rst @@ -1,8 +1,8 @@ .. _macos-installation: -==== -OS X -==== +===== +macOS +===== Installation from the Official SaltStack Repository =================================================== @@ -39,7 +39,7 @@ Installation from MacPorts Installation from Pip ===================== -When only using the OS X system's pip, install this way: +When only using the macOS system's pip, install this way: .. code-block:: bash @@ -48,15 +48,15 @@ When only using the OS X system's pip, install this way: Salt-Master Customizations ========================== .. note:: - Salt master on OS X is not tested or supported by SaltStack. See `SaltStack Platform Support `_ for more information. + Salt master on macOS is not tested or supported by SaltStack. See `SaltStack Platform Support `_ for more information. -To run salt-master on OS X, sudo add this configuration option to the /etc/salt/master file: +To run salt-master on macOS, sudo add this configuration option to the /etc/salt/master file: .. code-block:: bash max_open_files: 8192 -On versions previous to OS X 10.10 (Yosemite), increase the root user maxfiles limit: +On versions previous to macOS 10.10 (Yosemite), increase the root user maxfiles limit: .. code-block:: bash @@ -64,7 +64,7 @@ On versions previous to OS X 10.10 (Yosemite), increase the root user maxfiles l .. note:: - On OS X 10.10 (Yosemite) and higher, maxfiles should not be adjusted. The + On macOS 10.10 (Yosemite) and higher, maxfiles should not be adjusted. The default limits are sufficient in all but the most extreme scenarios. Overriding these values with the setting below will cause system instability! diff --git a/doc/topics/releases/0.17.0.rst b/doc/topics/releases/0.17.0.rst index e00948944ad..e819eadbe93 100644 --- a/doc/topics/releases/0.17.0.rst +++ b/doc/topics/releases/0.17.0.rst @@ -160,10 +160,10 @@ Extensive additions have been added to Salt for LXC support. This included the backend libs for managing LXC containers. Addition into the salt-virt system is still in the works. -Mac OS X User/Group Support ---------------------------- +macOS User/Group Support +------------------------ -Salt is now able to manage users and groups on Minions running Mac OS X. +Salt is now able to manage users and groups on Minions running macOS. However, at this time user passwords cannot be managed. Django ORM External Pillar diff --git a/doc/topics/releases/0.17.2.rst b/doc/topics/releases/0.17.2.rst index 4bcfb53d94c..0d6308da8d4 100644 --- a/doc/topics/releases/0.17.2.rst +++ b/doc/topics/releases/0.17.2.rst @@ -66,7 +66,7 @@ Version 0.17.2 is another bugfix release for :ref:`0.17.0 - Fix compound matcher for grains (:issue:`7944`) - Improve error reporting in ebuild module (related to :issue:`5393`) - Add ``dir_mode`` to ``file.managed`` (:issue:`7860`) -- Improve traceroute support for FreeBSD and OS X (:issue:`4927`) +- Improve traceroute support for FreeBSD and macOS (:issue:`4927`) - Fix for matching minions under syndics (:issue:`7671`) - Improve exception handling for missing ID (:issue:`8259`) - Fix grain mismatch for ScientificLinux (:issue:`8338`) diff --git a/doc/topics/releases/2016.3.0.rst b/doc/topics/releases/2016.3.0.rst index e8459a620a2..44e2b100cdf 100644 --- a/doc/topics/releases/2016.3.0.rst +++ b/doc/topics/releases/2016.3.0.rst @@ -107,7 +107,7 @@ Cloud Changes Platform Changes ================ -- Renamed modules related to OS X. The following module filenames were changed. +- Renamed modules related to macOS. The following module filenames were changed. The virtual name remained unchanged. - **PR** `#30558`_: renamed osxdesktop.py to mac_desktop.py diff --git a/doc/topics/troubleshooting/index.rst b/doc/topics/troubleshooting/index.rst index 86f932d4143..112ca070fb0 100644 --- a/doc/topics/troubleshooting/index.rst +++ b/doc/topics/troubleshooting/index.rst @@ -244,7 +244,7 @@ Then pass the signal to the master or minion when it seems to be unresponsive: killall -SIGUSR1 salt-master killall -SIGUSR1 salt-minion -Also under BSD and Mac OS X in addition to SIGUSR1 signal, debug subroutine set +Also under BSD and macOS in addition to SIGUSR1 signal, debug subroutine set up for SIGINFO which has an advantage of being sent by Ctrl+T shortcut. When filing an issue or sending questions to the mailing list for a problem diff --git a/doc/topics/tutorials/index.rst b/doc/topics/tutorials/index.rst index fd93b3cdb36..7bb26a60019 100644 --- a/doc/topics/tutorials/index.rst +++ b/doc/topics/tutorials/index.rst @@ -30,6 +30,6 @@ Tutorials Index * :ref:`How to Convert Jinja Logic to an Execution Module ` * :ref:`Using Salt with Stormpath ` * :ref:`Syslog-ng usage ` -* :ref:`The MacOS X (Maverick) Developer Step By Step Guide To Salt Installation ` +* :ref:`The macOS (Maverick) Developer Step By Step Guide To Salt Installation ` * :ref:`SaltStack Walk-through ` * :ref:`Writing Salt Tests ` diff --git a/doc/topics/tutorials/walkthrough_macosx.rst b/doc/topics/tutorials/walkthrough_macosx.rst index c5e9225ef99..af5a860d7c9 100644 --- a/doc/topics/tutorials/walkthrough_macosx.rst +++ b/doc/topics/tutorials/walkthrough_macosx.rst @@ -1,11 +1,11 @@ .. _tutorial-macos-walk-through: -======================================================================== -The MacOS X (Maverick) Developer Step By Step Guide To Salt Installation -======================================================================== +====================================================================== +The macOS (Maverick) Developer Step By Step Guide To Salt Installation +====================================================================== This document provides a step-by-step guide to installing a Salt cluster -consisting of one master, and one minion running on a local VM hosted on Mac OS X. +consisting of one master, and one minion running on a local VM hosted on macOS. .. note:: @@ -85,12 +85,12 @@ Step 1 - Configuring The Salt Master On Your Mac `official documentation `_ -Because Salt has a lot of dependencies that are not built in Mac OS X, we will -use Homebrew to install Salt. Homebrew is a package manager for Mac, it's -great, use it (for this tutorial at least!). Some people spend a lot of time -installing libs by hand to better understand dependencies, and then realize how -useful a package manager is once they're configuring a brand new machine and -have to do it all over again. It also lets you *uninstall* things easily. +Because Salt has a lot of dependencies that are not built in macOS, we will use +Homebrew to install Salt. Homebrew is a package manager for Mac, it's great, use +it (for this tutorial at least!). Some people spend a lot of time installing +libs by hand to better understand dependencies, and then realize how useful a +package manager is once they're configuring a brand new machine and have to do +it all over again. It also lets you *uninstall* things easily. .. note:: @@ -109,7 +109,7 @@ have to do it all over again. It also lets you *uninstall* things easily. .. tip:: - Use the keyboard shortcut ``cmd + shift + period`` in the "open" Mac OS X + Use the keyboard shortcut ``cmd + shift + period`` in the "open" macOS dialog box to display hidden files and folders, such as .profile. @@ -169,7 +169,7 @@ http://docs.saltstack.com/ref/configuration/examples.html#configuration-examples ``/etc/salt/master`` is a file, not a folder. Salt Master configuration changes. The Salt master needs a few customization -to be able to run on Mac OS X: +to be able to run on macOS: .. code-block:: bash @@ -216,7 +216,7 @@ Install VirtualBox ------------------ Go get it here: https://www.virtualBox.org/wiki/Downloads (click on VirtualBox -for OS X hosts => x86/amd64) +for macOS hosts => x86/amd64) Install Vagrant --------------- @@ -317,7 +317,7 @@ following: .. note:: - That ip is the ip of your VM host (the Mac OS X OS). The number is a + That ip is the ip of your VM host (the macOS host). The number is a VirtualBox default and is displayed in the log after the Vagrant ssh command. We'll use that IP to tell the minion where the Salt master is. Once you're done, end the ssh session by typing ``exit``. @@ -436,7 +436,7 @@ and then applied by running the :py:func:`state.apply ` function to have the Salt master order its minions to update their instructions and run the associated commands. -First Create an empty file on your Salt master (Mac OS X machine): +First Create an empty file on your Salt master (macOS machine): .. code-block:: bash diff --git a/pkg/osx/README.md b/pkg/osx/README.md index 3e91ca0fa88..2111f688b36 100644 --- a/pkg/osx/README.md +++ b/pkg/osx/README.md @@ -1,36 +1,34 @@ -=============================== -Building Native Packages on OSX -=============================== +================================= +Building Native Packages on macOS +================================= -Salt runs well on the Mac, but does have some limitations. +Salt runs well on the macOS, but does have some limitations. -In this directory you will find scripts and collateral to build an OSX -.pkg-style package that uses a custom-built Python. This process has -been tested on Mac OSX Lion (10.7) and following. +In this directory you will find scripts and collateral to build a macOS +.pkg-style package that uses a custom-built Python. This process has been +tested on macOS Lion (10.7) and later. -In addition, because of changes in launchd from version -to version of the OS, a simpler approach is taken for -the launchd plist files. +In addition, because of changes in launchd from version to version of the OS, a +simpler approach is taken for the launchd plist files. -This approach enables Salt users to potentially -add items to their Salt install via 'pip install' without -interfering with the rest of their system's Python packages. +This approach enables Salt users to potentially add items to their Salt install +via 'pip install' without interfering with the rest of their system's Python +packages. To build a native package you will need the following installed: - Xcode, or the Xcode Command Line Tools - git -The native package will install package files into /opt/salt. -Configuration files will be installed to /etc, but will have -'.dist' appended to them. +The native package will install package files into /opt/salt. Configuration +files will be installed to /etc, but will have '.dist' appended to them. -Launchd plists will be placed in /Library/LaunchDaemons. By default -salt-minion will NOT be enabled or started. +Launchd plists will be placed in /Library/LaunchDaemons. By default salt-minion +will NOT be enabled or started. -The process has been automated via the ``build.sh`` script -in the directory with this README file. Checkout the Salt repo from -GitHub, chdir into the base repo directory, and run +The process has been automated via the ``build.sh`` script in the directory with +this README file. Checkout the Salt repo from GitHub, chdir into the base repo +directory, and run ./build.sh @@ -39,5 +37,3 @@ References: http://crushbeercrushcode.org/2014/01/using-pkgbuild-and-productbuild-on-os-x-10-7/ http://stackoverflow.com/questions/11487596/making-os-x-installer-packages-like-a-pro-xcode-developer-id-ready-pkg - - diff --git a/pkg/osx/build.sh b/pkg/osx/build.sh index 213865c0aec..e304248328a 100755 --- a/pkg/osx/build.sh +++ b/pkg/osx/build.sh @@ -1,12 +1,12 @@ #!/bin/bash ############################################################################ # -# Title: Build Salt Script for OSX +# Title: Build Salt Script for macOS # Authors: CR Oldham, Shane Lee # Date: December 2015 # # Description: This script downloads and installs all dependencies and build -# tools required to create a .pkg file for installation on OSX. +# tools required to create a .pkg file for installation on macOS. # Salt and all dependencies will be installed to /opt/salt. A # .pkg file will then be created based on the contents of # /opt/salt @@ -57,7 +57,7 @@ PKGRESOURCES=$SRCDIR/pkg/osx ############################################################################ if [[ ! -e "$SRCDIR/.git" ]] && [[ ! -e "$SRCDIR/scripts/salt" ]]; then echo "This directory doesn't appear to be a git repository." - echo "The OS X build process needs some files from a Git checkout of Salt." + echo "The macOS build process needs some files from a Git checkout of Salt." echo "Run this script from the root of the Git checkout." exit -1 fi diff --git a/pkg/osx/build_env.sh b/pkg/osx/build_env.sh index d63a0c93ea8..2b236b8fc67 100755 --- a/pkg/osx/build_env.sh +++ b/pkg/osx/build_env.sh @@ -2,11 +2,11 @@ ############################################################################ # -# Title: Build Environment Script for OSX +# Title: Build Environment Script for macOS # Authors: CR Oldham, Shane Lee # Date: December 2015 # -# Description: This script sets up a build environment for salt on OSX. +# Description: This script sets up a build environment for salt on macOS. # # Requirements: # - XCode Command Line Tools (xcode-select --install) @@ -15,7 +15,7 @@ # This script is not passed any parameters # # Example: -# The following will set up a build environment for salt on OSX +# The following will set up a build environment for salt on macOS # # ./dev_env.sh # diff --git a/pkg/osx/build_pkg.sh b/pkg/osx/build_pkg.sh index ac1f64a12e5..86ad9aa450c 100755 --- a/pkg/osx/build_pkg.sh +++ b/pkg/osx/build_pkg.sh @@ -1,11 +1,11 @@ #!/bin/bash ############################################################################ # -# Title: Build Package Script for OSX +# Title: Build Package Script for macOS # Authors: CR Oldham, Shane Lee # Date: December 2015 # -# Description: This creates an OSX package for Salt from the contents of +# Description: This creates an macOS package for Salt from the contents of # /opt/salt # # Requirements: @@ -67,7 +67,7 @@ PKGRESOURCES=$SRCDIR/pkg/osx ############################################################################ if [[ ! -e "$SRCDIR/.git" ]] && [[ ! -e "$SRCDIR/scripts/salt" ]]; then echo "This directory doesn't appear to be a git repository." - echo "The OS X build process needs some files from a Git checkout of Salt." + echo "The macOS build process needs some files from a Git checkout of Salt." echo "Run this script from the 'pkg/osx' directory of the Git checkout." exit -1 fi diff --git a/pkg/osx/build_sig.sh b/pkg/osx/build_sig.sh index 6dc5373baca..a68c821d9b9 100755 --- a/pkg/osx/build_sig.sh +++ b/pkg/osx/build_sig.sh @@ -1,11 +1,11 @@ #!/bin/bash ############################################################################ # -# Title: Sign Package Script for OSX +# Title: Sign Package Script for macOS # Authors: Shane Lee # Date: December 2015 # -# Description: This signs an OSX Installer Package (.pkg) +# Description: This signs an macOS Installer Package (.pkg) # /opt/salt # # Requirements: diff --git a/pkg/osx/pkg-scripts/postinstall b/pkg/osx/pkg-scripts/postinstall index 1d31b31cd12..ed8ee7c1427 100755 --- a/pkg/osx/pkg-scripts/postinstall +++ b/pkg/osx/pkg-scripts/postinstall @@ -12,7 +12,7 @@ # - None # # Usage: -# This script is run as a part of the OSX Salt Installation +# This script is run as a part of the macOS Salt Installation # ############################################################################### echo "Post install started on:" > /tmp/postinstall.txt diff --git a/pkg/osx/pkg-scripts/preinstall b/pkg/osx/pkg-scripts/preinstall index a5f389b9db2..4112e07f5f4 100755 --- a/pkg/osx/pkg-scripts/preinstall +++ b/pkg/osx/pkg-scripts/preinstall @@ -6,13 +6,13 @@ # Date: December 2015 # # Description: This script stops the salt minion service before attempting to -# install Salt on Mac OSX +# install Salt on macOS # # Requirements: # - None # # Usage: -# This script is run as a part of the OSX Salt Installation +# This script is run as a part of the macOS Salt Installation # ############################################################################### echo "Preinstall started on:" > /tmp/preinstall.txt diff --git a/salt/beacons/inotify.py b/salt/beacons/inotify.py index b79547812b5..e6eec79b4f5 100644 --- a/salt/beacons/inotify.py +++ b/salt/beacons/inotify.py @@ -11,7 +11,7 @@ Watch files and translate the changes into salt events the beacon configuration. :note: The `inotify` beacon only works on OSes that have `inotify` kernel support. - Currently this excludes FreeBSD, Mac OS X, and Windows. + Currently this excludes FreeBSD, macOS, and Windows. ''' # Import Python libs diff --git a/salt/grains/core.py b/salt/grains/core.py index 7dc83ec6735..6a42cc734fd 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -987,7 +987,7 @@ def _windows_platform_data(): def _osx_platform_data(): ''' - Additional data for Mac OS X systems + Additional data for macOS systems Returns: A dictionary containing values for the following: - model_name - boot_rom_version diff --git a/salt/master.py b/salt/master.py index 569e3130e92..0df1f0f5275 100644 --- a/salt/master.py +++ b/salt/master.py @@ -400,7 +400,7 @@ class Master(SMaster): # Let's check to see how our max open files(ulimit -n) setting is mof_s, mof_h = resource.getrlimit(resource.RLIMIT_NOFILE) if mof_h == resource.RLIM_INFINITY: - # Unclear what to do with infinity... OSX reports RLIM_INFINITY as + # Unclear what to do with infinity... macOS reports RLIM_INFINITY as # hard limit,but raising to anything above soft limit fails... mof_h = mof_s log.info( @@ -433,7 +433,7 @@ class Master(SMaster): ) except ValueError: # https://github.com/saltstack/salt/issues/1991#issuecomment-13025595 - # A user under OSX reported that our 100000 default value is + # A user under macOS reported that our 100000 default value is # still too high. log.critical( 'Failed to raise max open files setting to {0}. If this ' diff --git a/salt/modules/launchctl.py b/salt/modules/launchctl.py index 7c9d9851779..142c98766d2 100644 --- a/salt/modules/launchctl.py +++ b/salt/modules/launchctl.py @@ -39,7 +39,7 @@ def __virtual__(): ''' if not salt.utils.is_darwin(): return (False, 'Failed to load the mac_service module:\n' - 'Only available on Mac OS X systems.') + 'Only available on macOS systems.') if not os.path.exists('/bin/launchctl'): return (False, 'Failed to load the mac_service module:\n' diff --git a/salt/modules/mac_assistive.py b/salt/modules/mac_assistive.py index 037ab00a7e6..47fc98a3481 100644 --- a/salt/modules/mac_assistive.py +++ b/salt/modules/mac_assistive.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -This module allows you to manage assistive access on OS X minions with 10.9+ +This module allows you to manage assistive access on macOS minions with 10.9+ .. versionadded:: 2016.3.0 @@ -30,7 +30,8 @@ def __virtual__(): ''' if salt.utils.is_darwin() and LooseVersion(__grains__['osrelease']) >= '10.9': return True - return False, 'The assistive module cannot be loaded: must be run on OSX 10.9 or newer.' + return False, 'The assistive module cannot be loaded: must be run on ' \ + 'macOS 10.9 or newer.' def install(app_id, enable=True): diff --git a/salt/modules/mac_brew.py b/salt/modules/mac_brew.py index f545dbd393f..8f5fa7b90e9 100644 --- a/salt/modules/mac_brew.py +++ b/salt/modules/mac_brew.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Homebrew for Mac OS X +Homebrew for macOS .. important:: If you feel that Salt should be using this module to manage packages on a diff --git a/salt/modules/mac_desktop.py b/salt/modules/mac_desktop.py index f84061e9243..d9c77845c6c 100644 --- a/salt/modules/mac_desktop.py +++ b/salt/modules/mac_desktop.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Mac OS X implementations of various commands in the "desktop" interface +macOS implementations of various commands in the "desktop" interface ''' from __future__ import absolute_import @@ -18,7 +18,7 @@ def __virtual__(): ''' if salt.utils.is_darwin(): return __virtualname__ - return False, 'Cannot load OSX desktop module: This is not an OSX host.' + return False, 'Cannot load macOS desktop module: This is not a macOS host.' def get_output_volume(): diff --git a/salt/modules/mac_package.py b/salt/modules/mac_package.py index f1f1ef00d82..ec67c5b2504 100644 --- a/salt/modules/mac_package.py +++ b/salt/modules/mac_package.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Install pkg, dmg and .app applications on Mac OS X minions. +Install pkg, dmg and .app applications on macOS minions. ''' diff --git a/salt/modules/mac_pkgutil.py b/salt/modules/mac_pkgutil.py index fc0828bba7c..1626e73644f 100644 --- a/salt/modules/mac_pkgutil.py +++ b/salt/modules/mac_pkgutil.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- ''' -Installer support for OS X. +Installer support for macOS. -Installer is the native .pkg/.mpkg package manager for OS X. +Installer is the native .pkg/.mpkg package manager for macOS. ''' # Import Python libs diff --git a/salt/modules/mac_ports.py b/salt/modules/mac_ports.py index fbe32882692..ed450b3c567 100644 --- a/salt/modules/mac_ports.py +++ b/salt/modules/mac_ports.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Support for MacPorts under Mac OSX. +Support for MacPorts under macOS. This module has some caveats. diff --git a/salt/modules/mac_power.py b/salt/modules/mac_power.py index d8cf7943561..d7e09dce19c 100644 --- a/salt/modules/mac_power.py +++ b/salt/modules/mac_power.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Module for editing power settings on Mac OS X +Module for editing power settings on macOS .. versionadded:: 2016.3.0 ''' @@ -18,11 +18,11 @@ __virtualname__ = 'power' def __virtual__(): ''' - Only for Mac OS X + Only for macOS ''' if not salt.utils.is_darwin(): return (False, 'The mac_power module could not be loaded: ' - 'module only works on Mac OS X systems.') + 'module only works on macOS systems.') return __virtualname__ @@ -423,7 +423,7 @@ def set_restart_freeze(enabled): ''' Specifies whether the server restarts automatically after a system freeze. This setting doesn't seem to be editable. The command completes successfully - but the setting isn't actually updated. This is probably an OS X bug. The + but the setting isn't actually updated. This is probably a macOS. The functions remains in case they ever fix the bug. :param bool enabled: True to enable, False to disable. "On" and "Off" are diff --git a/salt/modules/mac_service.py b/salt/modules/mac_service.py index 723ed9e3d2d..cd92a688a29 100644 --- a/salt/modules/mac_service.py +++ b/salt/modules/mac_service.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -The service module for Mac OS X +The service module for macOS .. versionadded:: 2016.3.0 ''' from __future__ import absolute_import @@ -29,11 +29,11 @@ __func_alias__ = { def __virtual__(): ''' - Only for Mac OS X with launchctl + Only for macOS with launchctl ''' if not salt.utils.is_darwin(): return (False, 'Failed to load the mac_service module:\n' - 'Only available on Mac OS X systems.') + 'Only available on macOS systems.') if not salt.utils.which('launchctl'): return (False, 'Failed to load the mac_service module:\n' @@ -45,7 +45,7 @@ def __virtual__(): if LooseVersion(__grains__['osrelease']) < LooseVersion('10.11'): return (False, 'Failed to load the mac_service module:\n' - 'Requires OS X 10.11 or newer') + 'Requires macOS 10.11 or newer') return __virtualname__ @@ -308,7 +308,7 @@ def start(name, runas=None): Start a launchd service. Raises an error if the service fails to start .. note:: - To start a service in Mac OS X the service must be enabled first. Use + To start a service in macOS the service must be enabled first. Use ``service.enable`` to enable the service. :param str name: Service label, file name, or full path @@ -337,7 +337,7 @@ def stop(name, runas=None): Stop a launchd service. Raises an error if the service fails to stop .. note:: - Though ``service.stop`` will unload a service in Mac OS X, the service + Though ``service.stop`` will unload a service in macOS, the service will start on next boot unless it is disabled. Use ``service.disable`` to disable the service diff --git a/salt/modules/mac_shadow.py b/salt/modules/mac_shadow.py index 0e40004fefa..d434f87e09f 100644 --- a/salt/modules/mac_shadow.py +++ b/salt/modules/mac_shadow.py @@ -2,7 +2,7 @@ ''' .. versionadded:: 2016.3.0 -Manage Mac OSX local directory passwords and policies. +Manage macOS local directory passwords and policies. Note that it is usually better to apply password policies through the creation of a configuration profile. @@ -32,9 +32,9 @@ __virtualname__ = 'shadow' def __virtual__(): - # Is this os x? + # Is this macOS? if not salt.utils.is_darwin(): - return False, 'Not Darwin' + return False, 'Not macOS' if HAS_PWD: return __virtualname__ @@ -339,13 +339,13 @@ def get_maxdays(name): def set_mindays(name, days): ''' - Set the minimum password age in days. Not available in OS X. + Set the minimum password age in days. Not available in macOS. :param str name: The user name :param int days: The number of days - :return: Will always return False until OSX supports this feature. + :return: Will always return False until macOS supports this feature. :rtype: bool CLI Example: @@ -360,13 +360,13 @@ def set_mindays(name, days): def set_inactdays(name, days): ''' Set the number if inactive days before the account is locked. Not available - in OS X + in macOS :param str name: The user name :param int days: The number of days - :return: Will always return False until OSX supports this feature. + :return: Will always return False until macOS supports this feature. :rtype: bool CLI Example: @@ -381,13 +381,13 @@ def set_inactdays(name, days): def set_warndays(name, days): ''' Set the number of days before the password expires that the user will start - to see a warning. Not available in OS X + to see a warning. Not available in macOS :param str name: The user name :param int days: The number of days - :return: Will always return False until OSX supports this feature. + :return: Will always return False until macOS supports this feature. :rtype: bool CLI Example: diff --git a/salt/modules/mac_sysctl.py b/salt/modules/mac_sysctl.py index fe9166647ad..1075dcc46d9 100644 --- a/salt/modules/mac_sysctl.py +++ b/salt/modules/mac_sysctl.py @@ -17,12 +17,12 @@ __virtualname__ = 'sysctl' def __virtual__(): ''' - Only run on Darwin (OS X) systems + Only run on Darwin (macOS) systems ''' if __grains__['os'] == 'MacOS': return __virtualname__ return (False, 'The darwin_sysctl execution module cannot be loaded: ' - 'only available on MacOS systems.') + 'Only available on macOS systems.') def show(config_file=False): diff --git a/salt/modules/mac_system.py b/salt/modules/mac_system.py index 3d9a991fb6f..1b4e22c645a 100644 --- a/salt/modules/mac_system.py +++ b/salt/modules/mac_system.py @@ -603,7 +603,7 @@ def set_boot_arch(arch='default'): The setting is not updated. This is either an apple bug, not available on the test system, or a result of system files now being locked down in - OS X (SIP Protection). + macOS (SIP Protection). :param str arch: A string representing the desired architecture. If no value is passed, default is assumed. Valid values include: diff --git a/salt/modules/mac_timezone.py b/salt/modules/mac_timezone.py index 3f2ef3c5746..ab5528a1206 100644 --- a/salt/modules/mac_timezone.py +++ b/salt/modules/mac_timezone.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Module for editing date/time settings on Mac OS X +Module for editing date/time settings on macOS .. versionadded:: 2016.3.0 ''' @@ -19,11 +19,11 @@ __virtualname__ = 'timezone' def __virtual__(): ''' - Only for Mac OS X + Only for macOS ''' if not salt.utils.is_darwin(): return (False, 'The mac_timezone module could not be loaded: ' - 'module only works on Mac OS X systems.') + 'module only works on macOS systems.') return __virtualname__ @@ -333,7 +333,7 @@ def set_time_server(time_server='time.apple.com'): network time server. :param time_server: IP or DNS name of the network time server. If nothing is - passed the time server will be set to the OS X default of 'time.apple.com' + passed the time server will be set to the macOS default of 'time.apple.com' :type: str :return: True if successful, False if not diff --git a/salt/modules/network.py b/salt/modules/network.py index fd4de3dfa12..f879d1ee3df 100644 --- a/salt/modules/network.py +++ b/salt/modules/network.py @@ -378,7 +378,7 @@ def _netstat_route_linux(): def _netstat_route_freebsd(): ''' - Return netstat routing information for FreeBSD and OS X + Return netstat routing information for FreeBSD and macOS ''' ret = [] cmd = 'netstat -f inet -rn | tail -n+5' diff --git a/salt/modules/npm.py b/salt/modules/npm.py index 09660a10c45..f4454c3357c 100644 --- a/salt/modules/npm.py +++ b/salt/modules/npm.py @@ -185,7 +185,7 @@ def _extract_json(npm_output): lines = lines[1:] while lines and not lines[-1].startswith('}') and not lines[-1].startswith(']'): lines = lines[:-1] - # Mac OSX with fsevents includes the following line in the return + # macOS with fsevents includes the following line in the return # when a new module is installed which is invalid JSON: # [fsevents] Success: "..." while lines and lines[0].startswith('[fsevents]'): diff --git a/salt/modules/osquery.py b/salt/modules/osquery.py index 9fb74cc8d96..137125f070f 100644 --- a/salt/modules/osquery.py +++ b/salt/modules/osquery.py @@ -29,7 +29,7 @@ def __virtual__(): if salt.utils.which('osqueryi'): return __virtualname__ return (False, 'The osquery execution module cannot be loaded: ' - 'osqueryi binary is not in the path.') + 'osqueryi binary is not in the path.') def _table_attrs(table): @@ -659,7 +659,7 @@ def alf(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='alf', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def alf_exceptions(attrs=None, where=None): @@ -674,7 +674,7 @@ def alf_exceptions(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='alf_exceptions', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def alf_explicit_auths(attrs=None, where=None): @@ -689,7 +689,7 @@ def alf_explicit_auths(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='alf_explicit_auths', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def alf_services(attrs=None, where=None): @@ -704,7 +704,7 @@ def alf_services(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='alf_services', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def apps(attrs=None, where=None): @@ -719,7 +719,7 @@ def apps(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='apps', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def certificates(attrs=None, where=None): @@ -734,7 +734,7 @@ def certificates(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='certificates', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def chrome_extensions(attrs=None, where=None): @@ -749,7 +749,7 @@ def chrome_extensions(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='chrome_extensions', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def firefox_addons(attrs=None, where=None): @@ -764,7 +764,7 @@ def firefox_addons(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='firefox_addons', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def homebrew_packages(attrs=None, where=None): @@ -779,7 +779,7 @@ def homebrew_packages(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='homebrew_packages', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def iokit_devicetree(attrs=None, where=None): @@ -794,7 +794,7 @@ def iokit_devicetree(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='iokit_devicetree', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def iokit_registry(attrs=None, where=None): @@ -809,7 +809,7 @@ def iokit_registry(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='iokit_registry', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def kernel_extensions(attrs=None, where=None): @@ -824,7 +824,7 @@ def kernel_extensions(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='kernel_extensions', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def keychain_items(attrs=None, where=None): @@ -839,7 +839,7 @@ def keychain_items(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='keychain_items', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def launchd(attrs=None, where=None): @@ -854,7 +854,7 @@ def launchd(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='launchd', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def nfs_shares(attrs=None, where=None): @@ -869,7 +869,7 @@ def nfs_shares(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='nfs_shares', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def nvram(attrs=None, where=None): @@ -884,7 +884,7 @@ def nvram(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='nvram', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def preferences(attrs=None, where=None): @@ -899,7 +899,7 @@ def preferences(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='preferences', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def quarantine(attrs=None, where=None): @@ -914,7 +914,7 @@ def quarantine(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='quarantine', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def safari_extensions(attrs=None, where=None): @@ -929,7 +929,7 @@ def safari_extensions(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='safari_extensions', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def startup_items(attrs=None, where=None): @@ -944,7 +944,7 @@ def startup_items(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='startup_items', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def xattr_where_from(attrs=None, where=None): @@ -959,7 +959,7 @@ def xattr_where_from(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='xattr_where_from', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def xprotect_entries(attrs=None, where=None): @@ -974,7 +974,7 @@ def xprotect_entries(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='xprotect_entries', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def xprotect_reports(attrs=None, where=None): @@ -989,7 +989,7 @@ def xprotect_reports(attrs=None, where=None): ''' if salt.utils.is_darwin(): return _osquery_cmd(table='xprotect_reports', attrs=attrs, where=where) - return {'result': False, 'comment': 'Only available on OS X systems.'} + return {'result': False, 'comment': 'Only available on macOS systems.'} def file_(attrs=None, where=None): diff --git a/salt/modules/proxy.py b/salt/modules/proxy.py index 6fe2bdca19f..cc0c28abb3a 100644 --- a/salt/modules/proxy.py +++ b/salt/modules/proxy.py @@ -128,7 +128,8 @@ def get_http_proxy(network_service="Ethernet"): Returns the current http proxy settings network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS CLI Example: @@ -160,7 +161,8 @@ def set_http_proxy(server, port, user=None, password=None, network_service="Ethe The password to use if required by the server network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS bypass_hosts The hosts that are allowed to by pass the proxy. Only used on Windows for other OS's use @@ -183,7 +185,8 @@ def get_https_proxy(network_service="Ethernet"): Returns the current https proxy settings network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS CLI Example: @@ -215,7 +218,8 @@ def set_https_proxy(server, port, user=None, password=None, network_service="Eth The password to use if required by the server network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS bypass_hosts The hosts that are allowed to by pass the proxy. Only used on Windows for other OS's use @@ -238,7 +242,8 @@ def get_ftp_proxy(network_service="Ethernet"): Returns the current ftp proxy settings network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS CLI Example: @@ -269,7 +274,8 @@ def set_ftp_proxy(server, port, user=None, password=None, network_service="Ether The password to use if required by the server network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS bypass_hosts The hosts that are allowed to by pass the proxy. Only used on Windows for other OS's use @@ -292,7 +298,8 @@ def get_proxy_bypass(network_service="Ethernet"): Returns the current domains that can bypass the proxy network_service - The network service to get the bypass domains from, this is only necessary on OSX + The network service to get the bypass domains from, this is only + necessary on macOS CLI Example: @@ -322,7 +329,8 @@ def set_proxy_bypass(domains, network_service="Ethernet"): An array of domains allowed to bypass the proxy network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS CLI Example: diff --git a/salt/modules/rbenv.py b/salt/modules/rbenv.py index 5125479355d..cdae6e9d9af 100644 --- a/salt/modules/rbenv.py +++ b/salt/modules/rbenv.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Manage ruby installations with rbenv. rbenv is supported on Linux and Mac OS X. +Manage ruby installations with rbenv. rbenv is supported on Linux and macOS. rbenv doesn't work on Windows (and isn't really necessary on Windows as there is no system Ruby on Windows). On Windows, the RubyInstaller and/or Pik are both good alternatives to work with multiple versions of Ruby on the same box. diff --git a/salt/modules/system_profiler.py b/salt/modules/system_profiler.py index 7c2da3bef7b..31e0b8efe36 100644 --- a/salt/modules/system_profiler.py +++ b/salt/modules/system_profiler.py @@ -2,7 +2,7 @@ ''' System Profiler Module -Interface with Mac OSX's command-line System Profiler utility to get +Interface with macOS's command-line System Profiler utility to get information about package receipts and installed applications. .. versionadded:: 2015.5.0 diff --git a/salt/modules/timezone.py b/salt/modules/timezone.py index 33da7160a38..dc87989f8b4 100644 --- a/salt/modules/timezone.py +++ b/salt/modules/timezone.py @@ -32,7 +32,7 @@ def __virtual__(): if salt.utils.is_darwin(): return (False, 'The timezone execution module failed to load: ' - 'mac_timezone.py should replace this module on OS X.' + 'mac_timezone.py should replace this module on macOS.' 'There was a problem loading mac_timezone.py.') return __virtualname__ diff --git a/salt/states/mac_assistive.py b/salt/states/mac_assistive.py index a2e59a0d4d2..d5375deb8b9 100644 --- a/salt/states/mac_assistive.py +++ b/salt/states/mac_assistive.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- ''' -Allows you to manage assistive access on OS X minions with 10.9+ -================================================================ +Allows you to manage assistive access on macOS minions with 10.9+ +================================================================= -Install, enable and disable assitive access on OS X minions +Install, enable and disable assistive access on macOS minions .. code-block:: yaml diff --git a/salt/states/mac_defaults.py b/salt/states/mac_defaults.py index 394865d5091..0eee644753f 100644 --- a/salt/states/mac_defaults.py +++ b/salt/states/mac_defaults.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ''' -Writing/reading defaults from an OS X minion +Writing/reading defaults from a macOS minion ============================================ ''' diff --git a/salt/states/mac_keychain.py b/salt/states/mac_keychain.py index 6c748b61428..e67a99a4035 100644 --- a/salt/states/mac_keychain.py +++ b/salt/states/mac_keychain.py @@ -3,7 +3,7 @@ Installing of certificates to the keychain ========================================== -Install certificats to the OS X keychain +Install certificats to the macOS keychain .. code-block:: yaml @@ -35,7 +35,7 @@ def __virtual__(): def installed(name, password, keychain="/Library/Keychains/System.keychain", **kwargs): ''' - Install a p12 certificate file into the OS X keychain + Install a p12 certificate file into the macOS keychain name The certificate to install @@ -100,7 +100,7 @@ def installed(name, password, keychain="/Library/Keychains/System.keychain", **k def uninstalled(name, password, keychain="/Library/Keychains/System.keychain", keychain_password=None): ''' - Uninstall a p12 certificate file from the OS X keychain + Uninstall a p12 certificate file from the macOS keychain name The certificate to uninstall, this can be a path for a .p12 or the friendly diff --git a/salt/states/mac_package.py b/salt/states/mac_package.py index 8aa702abb9c..ed7dae04037 100644 --- a/salt/states/mac_package.py +++ b/salt/states/mac_package.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- ''' Installing of mac pkg files -======================= +=========================== -Install any kind of pkg, dmg or app file on Mac OS X: +Install any kind of pkg, dmg or app file on macOS: .. code-block:: yaml diff --git a/salt/states/mac_xattr.py b/salt/states/mac_xattr.py index bdedbf22362..10960e8daa2 100644 --- a/salt/states/mac_xattr.py +++ b/salt/states/mac_xattr.py @@ -3,7 +3,7 @@ Allows you to manage extended attributes on files or directories ================================================================ -Install, enable and disable assitive access on OS X minions +Install, enable and disable assistive access on macOS minions .. code-block:: yaml diff --git a/salt/states/proxy.py b/salt/states/proxy.py index cbdd1eb221d..f284d4e5ee3 100644 --- a/salt/states/proxy.py +++ b/salt/states/proxy.py @@ -59,7 +59,8 @@ def managed(name, port, services=None, user=None, password=None, bypass_domains= An array of the domains that should bypass the proxy network_service - The network service to apply the changes to, this only necessary on OSX + The network service to apply the changes to, this only necessary on + macOS ''' ret = {'name': name, 'result': True, diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py index a77eac931c7..931779411db 100644 --- a/salt/utils/__init__.py +++ b/salt/utils/__init__.py @@ -1661,7 +1661,7 @@ def is_linux(): @real_memoize def is_darwin(): ''' - Simple function to return if a host is Darwin (OS X) or not + Simple function to return if a host is Darwin (macOS) or not ''' return sys.platform.startswith('darwin') diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index 5c066d9d3aa..a37ad61d2e9 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -128,7 +128,7 @@ except ImportError: try: cmdline = process.cmdline() except psutil.AccessDenied: - # OSX denies us access to the above information + # macOS denies us access to the above information cmdline = None if not cmdline: try: @@ -614,7 +614,7 @@ class SaltDaemonScriptBase(SaltScriptBase, ShellTestCase): if exc.errno != errno.ENOTCONN: raise except AttributeError: - # This is not OSX !? + # This is not macOS !? pass del sock elif isinstance(port, str): diff --git a/tests/integration/files/engines/runtests_engine.py b/tests/integration/files/engines/runtests_engine.py index 9353371c4d8..572b72c6abd 100644 --- a/tests/integration/files/engines/runtests_engine.py +++ b/tests/integration/files/engines/runtests_engine.py @@ -84,7 +84,7 @@ class PyTestEngine(object): if exc.errno != errno.ENOTCONN: raise except AttributeError: - # This is not OSX !? + # This is not macOS !? pass @gen.coroutine diff --git a/tests/integration/modules/mac_brew.py b/tests/integration/modules/mac_brew.py index d84c4434710..a5f8e659608 100644 --- a/tests/integration/modules/mac_brew.py +++ b/tests/integration/modules/mac_brew.py @@ -30,7 +30,7 @@ DEL_PKG = 'acme' @destructiveTest -@skipIf(not salt.utils.is_darwin(), 'Test only applies to OS X') +@skipIf(not salt.utils.is_darwin(), 'Test only applies to macOS') @skipIf(os.geteuid() != 0, 'You must be logged in as root to run this test') @skipIf(not salt.utils.which('brew'), 'This test requires the brew binary') class BrewModuleTest(integration.ModuleCase): diff --git a/tests/integration/modules/mac_pkgutil.py b/tests/integration/modules/mac_pkgutil.py index 5fbdf9d2e55..8ee15698a71 100644 --- a/tests/integration/modules/mac_pkgutil.py +++ b/tests/integration/modules/mac_pkgutil.py @@ -30,7 +30,7 @@ class MacPkgutilModuleTest(integration.ModuleCase): Get current settings ''' if not salt.utils.is_darwin(): - self.skipTest('Test only available on Mac OS X') + self.skipTest('Test only available on macOS') if not salt.utils.which('pkgutil'): self.skipTest('Test requires pkgutil binary') diff --git a/tests/integration/modules/mac_ports.py b/tests/integration/modules/mac_ports.py index 2a0bbdb21ac..786ca00874f 100644 --- a/tests/integration/modules/mac_ports.py +++ b/tests/integration/modules/mac_ports.py @@ -26,7 +26,7 @@ class MacPortsModuleTest(integration.ModuleCase): Get current settings ''' if not salt.utils.is_darwin(): - self.skipTest('Test only available on Mac OS X') + self.skipTest('Test only available on macOS') if not salt.utils.which('port'): self.skipTest('Test requires port binary') diff --git a/tests/integration/modules/mac_service.py b/tests/integration/modules/mac_service.py index 242fe276073..f3cc35ae1d1 100644 --- a/tests/integration/modules/mac_service.py +++ b/tests/integration/modules/mac_service.py @@ -16,7 +16,7 @@ import integration import salt.utils -@skipIf(not salt.utils.is_darwin(), 'Test only available on Mac OS X') +@skipIf(not salt.utils.is_darwin(), 'Test only available on macOS') @skipIf(not salt.utils.which('launchctl'), 'Test requires launchctl binary') @skipIf(not salt.utils.which('plutil'), 'Test requires plutil binary') @skipIf(salt.utils.get_uid(salt.utils.get_user()) != 0, diff --git a/tests/integration/modules/mac_shadow.py b/tests/integration/modules/mac_shadow.py index 754e34a6037..c3bca54c00b 100644 --- a/tests/integration/modules/mac_shadow.py +++ b/tests/integration/modules/mac_shadow.py @@ -43,7 +43,7 @@ class MacShadowModuleTest(integration.ModuleCase): Get current settings ''' if not salt.utils.is_darwin(): - self.skipTest('Test only available on Mac OS X') + self.skipTest('Test only available on macOS') if not salt.utils.which('dscl'): self.skipTest('Test requires dscl binary') diff --git a/tests/integration/modules/mac_softwareupdate.py b/tests/integration/modules/mac_softwareupdate.py index d4669995b31..51978328c3d 100644 --- a/tests/integration/modules/mac_softwareupdate.py +++ b/tests/integration/modules/mac_softwareupdate.py @@ -28,7 +28,7 @@ class MacSoftwareUpdateModuleTest(integration.ModuleCase): Get current settings ''' if not salt.utils.is_darwin(): - self.skipTest('Test only available on Mac OS X') + self.skipTest('Test only available on macOS') if not salt.utils.which('softwareupdate'): self.skipTest('Test requires softwareupdate binary') diff --git a/tests/integration/modules/mac_timezone.py b/tests/integration/modules/mac_timezone.py index 0615c215790..e9a0a3b896b 100644 --- a/tests/integration/modules/mac_timezone.py +++ b/tests/integration/modules/mac_timezone.py @@ -39,7 +39,7 @@ class MacTimezoneModuleTest(integration.ModuleCase): Get current settings ''' if not salt.utils.is_darwin(): - self.skipTest('Test only available on Mac OS X') + self.skipTest('Test only available on macOS') if not salt.utils.which('systemsetup'): self.skipTest('Test requires systemsetup binary') diff --git a/tests/integration/modules/mac_xattr.py b/tests/integration/modules/mac_xattr.py index ff3f364c5be..8b13203e302 100644 --- a/tests/integration/modules/mac_xattr.py +++ b/tests/integration/modules/mac_xattr.py @@ -29,7 +29,7 @@ class MacXattrModuleTest(integration.ModuleCase): Create test file for testing extended attributes ''' if not salt.utils.is_darwin(): - self.skipTest('Test only available on Mac OS X') + self.skipTest('Test only available on macOS') if not salt.utils.which('xattr'): self.skipTest('Test requires xattr binary') diff --git a/tests/integration/modules/sysctl.py b/tests/integration/modules/sysctl.py index ddf4833451a..728dd10d15e 100644 --- a/tests/integration/modules/sysctl.py +++ b/tests/integration/modules/sysctl.py @@ -46,7 +46,7 @@ class SysctlModuleTest(integration.ModuleCase): ret.get('kern.ostype'), 'OpenBSD', 'Incorrect kern.ostype' ) - @skipIf(not sys.platform.startswith('darwin'), 'Darwin (OS X) specific') + @skipIf(not sys.platform.startswith('darwin'), 'Darwin (macOS) specific') def test_show_darwin(self): ret = self.run_function('sysctl.show') self.assertIn('kern.ostype', ret, 'kern.ostype absent') diff --git a/tests/unit/modules/mac_keychain_test.py b/tests/unit/modules/mac_keychain_test.py index d83aaf85d0c..428b7c66f77 100644 --- a/tests/unit/modules/mac_keychain_test.py +++ b/tests/unit/modules/mac_keychain_test.py @@ -23,7 +23,7 @@ class KeychainTestCase(TestCase): def test_install_cert(self): ''' - Test installing a certificate into the OSX keychain + Test installing a certificate into the macOS keychain ''' mock = MagicMock() with patch.dict(keychain.__salt__, {'cmd.run': mock}): @@ -34,7 +34,7 @@ class KeychainTestCase(TestCase): @patch('salt.modules.mac_keychain.unlock_keychain') def test_install_cert_extras(self, unlock_mock): ''' - Test installing a certificate into the OSX keychain with extras + Test installing a certificate into the macOS keychain with extras ''' mock = MagicMock() with patch.dict(keychain.__salt__, {'cmd.run': mock}): @@ -45,7 +45,7 @@ class KeychainTestCase(TestCase): def test_uninstall_cert(self): ''' - Test uninstalling a certificate from the OSX keychain + Test uninstalling a certificate from the macOS keychain ''' mock = MagicMock() with patch.dict(keychain.__salt__, {'cmd.run': mock}): diff --git a/tests/unit/modules/proxy_test.py b/tests/unit/modules/proxy_test.py index 76a210672a0..3338861fa32 100644 --- a/tests/unit/modules/proxy_test.py +++ b/tests/unit/modules/proxy_test.py @@ -29,10 +29,10 @@ class ProxyTestCase(TestCase): Test cases for salt.modules.proxy ''' - def test_get_http_proxy_osx(self): + def test_get_http_proxy_macos(self): ''' Test to make sure that we correctly get the current proxy info - on OSX + on macOS ''' proxy.__grains__['os'] = 'Darwin' mock = MagicMock(return_value='Enabled: Yes\nServer: 192.168.0.1\nPort: 3128\nAuthenticated Proxy Enabled: 0') @@ -47,10 +47,10 @@ class ProxyTestCase(TestCase): mock.assert_called_once_with('networksetup -getwebproxy Ethernet') self.assertEqual(expected, out) - def test_get_https_proxy_osx(self): + def test_get_https_proxy_macos(self): ''' Test to make sure that we correctly get the current proxy info - on OSX + on macOS ''' proxy.__grains__['os'] = 'Darwin' mock = MagicMock(return_value='Enabled: Yes\nServer: 192.168.0.1\nPort: 3128\nAuthenticated Proxy Enabled: 0') @@ -65,10 +65,10 @@ class ProxyTestCase(TestCase): mock.assert_called_once_with('networksetup -getsecurewebproxy Ethernet') self.assertEqual(expected, out) - def test_get_ftp_proxy_osx(self): + def test_get_ftp_proxy_macos(self): ''' Test to make sure that we correctly get the current proxy info - on OSX + on macOS ''' proxy.__grains__['os'] = 'Darwin' mock = MagicMock(return_value='Enabled: Yes\nServer: 192.168.0.1\nPort: 3128\nAuthenticated Proxy Enabled: 0') @@ -83,7 +83,7 @@ class ProxyTestCase(TestCase): mock.assert_called_once_with('networksetup -getftpproxy Ethernet') self.assertEqual(expected, out) - def test_get_http_proxy_osx_none(self): + def test_get_http_proxy_macos_none(self): ''' Test to make sure that we correctly return when theres no proxy set ''' @@ -95,10 +95,10 @@ class ProxyTestCase(TestCase): mock.assert_called_once_with('networksetup -getwebproxy Ethernet') self.assertEqual({}, out) - def test_set_http_proxy_osx(self): + def test_set_http_proxy_macos(self): ''' Test to make sure that we correctly set the proxy info - on OSX + on macOS ''' proxy.__grains__['os'] = 'Darwin' mock = MagicMock() @@ -108,10 +108,10 @@ class ProxyTestCase(TestCase): mock.assert_called_once_with('networksetup -setwebproxy Ethernet 192.168.0.1 3128 On frank badpassw0rd') self.assertTrue(out) - def test_set_https_proxy_osx(self): + def test_set_https_proxy_macos(self): ''' Test to make sure that we correctly set the proxy info - on OSX + on macOS ''' proxy.__grains__['os'] = 'Darwin' mock = MagicMock() @@ -121,10 +121,10 @@ class ProxyTestCase(TestCase): mock.assert_called_once_with('networksetup -setsecurewebproxy Ethernet 192.168.0.1 3128 On frank passw0rd') self.assertTrue(out) - def test_set_ftp_proxy_osx(self): + def test_set_ftp_proxy_macos(self): ''' Test to make sure that we correctly set the proxy info - on OSX + on macOS ''' proxy.__grains__['os'] = 'Darwin' mock = MagicMock() @@ -197,7 +197,7 @@ class ProxyTestCase(TestCase): 'ProxyServer') self.assertEqual(expected, out) - def test_get_all_proxies_osx_fails(self): + def test_get_all_proxies_macos_fails(self): proxy.__grains__['os'] = 'Darwin' mock = MagicMock() with patch.dict(proxy.__salt__, {'reg.read_value': mock}): diff --git a/tests/unit/states/mac_keychain_test.py b/tests/unit/states/mac_keychain_test.py index 2fb4859a61a..600040f523b 100644 --- a/tests/unit/states/mac_keychain_test.py +++ b/tests/unit/states/mac_keychain_test.py @@ -24,7 +24,7 @@ class KeychainTestCase(TestCase): def test_install_cert(self): ''' - Test installing a certificate into the OSX keychain + Test installing a certificate into the macOS keychain ''' expected = { 'changes': {'installed': 'Friendly Name'}, @@ -47,7 +47,8 @@ class KeychainTestCase(TestCase): def test_installed_cert(self): ''' - Test installing a certificate into the OSX keychain when it's already installed + Test installing a certificate into the macOS keychain when it's + already installed ''' expected = { 'changes': {}, @@ -72,7 +73,8 @@ class KeychainTestCase(TestCase): def test_uninstall_cert(self): ''' - Test uninstalling a certificate into the OSX keychain when it's already installed + Test uninstalling a certificate into the macOS keychain when it's + already installed ''' expected = { 'changes': {'uninstalled': 'Friendly Name'}, @@ -95,7 +97,8 @@ class KeychainTestCase(TestCase): def test_uninstalled_cert(self): ''' - Test uninstalling a certificate into the OSX keychain when it's not installed + Test uninstalling a certificate into the macOS keychain when it's + not installed ''' expected = { 'changes': {}, @@ -178,7 +181,8 @@ class KeychainTestCase(TestCase): def test_install_cert_salt_fileserver(self): ''' - Test installing a certificate into the OSX keychain from the salt fileserver + Test installing a certificate into the macOS keychain from the salt + fileserver ''' expected = { 'changes': {'installed': 'Friendly Name'}, @@ -203,8 +207,8 @@ class KeychainTestCase(TestCase): def test_installed_cert_hash_different(self): ''' - Test installing a certificate into the OSX keychain when it's already installed but - the certificate has changed + Test installing a certificate into the macOS keychain when it's + already installed but the certificate has changed ''' expected = { 'changes': {'installed': 'Friendly Name', 'uninstalled': 'Friendly Name'}, diff --git a/tests/unit/states/proxy_test.py b/tests/unit/states/proxy_test.py index a12747b849f..f1734239f72 100644 --- a/tests/unit/states/proxy_test.py +++ b/tests/unit/states/proxy_test.py @@ -28,9 +28,9 @@ class ProxyTestCase(TestCase): ''' Validate the proxy state ''' - def test_set_proxy_osx(self): + def test_set_proxy_macos(self): ''' - Test to make sure we can set the proxy settings on OSX + Test to make sure we can set the proxy settings on macOS ''' proxy.__grains__['os'] = 'Darwin' expected = {'changes': { @@ -80,9 +80,9 @@ class ProxyTestCase(TestCase): set_proxy_mock.assert_has_calls(calls) self.assertEqual(out, expected) - def test_set_proxy_osx_same(self): + def test_set_proxy_macos_same(self): ''' - Test to make sure we can set the proxy settings on OSX + Test to make sure we can set the proxy settings on macOS ''' proxy.__grains__['os'] = 'Darwin' expected = {'changes': { From 8648775c2ad182364987a4ad4ce3b4caff26530f Mon Sep 17 00:00:00 2001 From: Andreas Lutro Date: Thu, 29 Dec 2016 11:14:08 +0100 Subject: [PATCH 14/17] if task is not defined, it's not up to date --- salt/states/kapacitor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/states/kapacitor.py b/salt/states/kapacitor.py index 06350ff20f9..0cb66ea0265 100644 --- a/salt/states/kapacitor.py +++ b/salt/states/kapacitor.py @@ -72,8 +72,11 @@ def task_present(name, with salt.utils.fopen(script_path, 'r') as file: new_script = file.read().replace('\t', ' ') - is_up_to_date = old_script == new_script and task_type == task['type'] and \ + is_up_to_date = task and ( + old_script == new_script and + task_type == task['type'] and task['dbrps'] == [{'db': database, 'rp': retention_policy}] + ) if is_up_to_date: comments.append('Task script is already up-to-date') From 52721e97d60f0f363abba456f3e2bfc6f6851faf Mon Sep 17 00:00:00 2001 From: Andreas Lutro Date: Thu, 29 Dec 2016 11:14:24 +0100 Subject: [PATCH 15/17] clean up and fix tests --- tests/unit/states/kapacitor_test.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/unit/states/kapacitor_test.py b/tests/unit/states/kapacitor_test.py index c5da273ea99..390e06ac7da 100644 --- a/tests/unit/states/kapacitor_test.py +++ b/tests/unit/states/kapacitor_test.py @@ -25,7 +25,7 @@ def _present(name='testname', define_result=True, enable_result=True, disable_result=True, - script='test'): + script='testscript'): ''' Run a "kapacitor.present" state after setting up mocks, and return the state return value as well as the mocks to make assertions. @@ -57,6 +57,15 @@ def _present(name='testname', return retval, get_mock, define_mock, enable_mock, disable_mock +def _task(script='testscript', enabled=True, task_type='stream', db='testdb', rp='default'): + return { + 'script': script, + 'enabled': enabled, + 'type': task_type, + 'dbrps': [{'db': db, 'rp': rp}], + } + + class KapacitorTestCase(TestCase): def test_task_present_new_task(self): ret, get_mock, define_mock, enable_mock, _ = _present() @@ -68,9 +77,8 @@ class KapacitorTestCase(TestCase): self.assertIn('enabled', ret['changes']) self.assertEqual(True, ret['changes']['enabled']['new']) - def test_task_present_existing_task(self): - old_task = {'script': 'old_task', 'enabled': True} - ret, get_mock, define_mock, enable_mock, _ = _present(task=old_task) + def test_task_present_existing_task_updated_script(self): + ret, get_mock, define_mock, enable_mock, _ = _present(task=_task(script='oldscript')) get_mock.assert_called_once_with('testname') define_mock.assert_called_once_with('testname', '/tmp/script.tick', database='testdb', retention_policy='default', task_type='stream') @@ -79,8 +87,7 @@ class KapacitorTestCase(TestCase): self.assertNotIn('enabled', ret['changes']) def test_task_present_existing_task_not_enabled(self): - old_task = {'script': 'test', 'enabled': False} - ret, get_mock, define_mock, enable_mock, _ = _present(task=old_task) + ret, get_mock, define_mock, enable_mock, _ = _present(task=_task(enabled=False)) get_mock.assert_called_once_with('testname') self.assertEqual(False, define_mock.called) enable_mock.assert_called_once_with('testname') @@ -89,8 +96,7 @@ class KapacitorTestCase(TestCase): self.assertEqual(True, ret['changes']['enabled']['new']) def test_task_present_disable_existing_task(self): - old_task = {'script': 'test', 'enabled': True} - ret, get_mock, define_mock, _, disable_mock = _present(task=old_task, enable=False) + ret, get_mock, define_mock, _, disable_mock = _present(task=_task(), enable=False) get_mock.assert_called_once_with('testname') self.assertEqual(False, define_mock.called) disable_mock.assert_called_once_with('testname') From 18018139f3b2b9a8a5c1b694e563f77956c5353a Mon Sep 17 00:00:00 2001 From: Mircea Ulinic Date: Fri, 30 Dec 2016 11:19:34 +0000 Subject: [PATCH 16/17] Fix #38485 --- salt/proxy/napalm.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/salt/proxy/napalm.py b/salt/proxy/napalm.py index e6337761cfe..18ee9afced3 100644 --- a/salt/proxy/napalm.py +++ b/salt/proxy/napalm.py @@ -81,6 +81,8 @@ try: except ImportError: HAS_NAPALM = False +from salt.ext import six as six + # ---------------------------------------------------------------------------------------------------------------------- # proxy properties # ---------------------------------------------------------------------------------------------------------------------- @@ -281,6 +283,14 @@ def call(method, **params): if not NETWORK_DEVICE.get('UP', False): raise Exception('not connected') # if connected will try to execute desired command + # but lets clean the kwargs first + params_copy = {} + params_copy.update(params) + for karg, warg in six.iteritems(params_copy): + # will remove None values + # thus the NAPALM methods will be called with their defaults + if warg is None: + params.pop(karg) out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params) # calls the method with the specified parameters result = True except Exception as error: From bd7dee9a106ed98cca20f415ffaf4316f259bb73 Mon Sep 17 00:00:00 2001 From: Mark van der Walle Date: Fri, 30 Dec 2016 14:22:49 +0100 Subject: [PATCH 17/17] Do not assume every object is a server --- salt/cloud/clouds/gogrid.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/salt/cloud/clouds/gogrid.py b/salt/cloud/clouds/gogrid.py index 0a5fc167e3f..7f0543db519 100644 --- a/salt/cloud/clouds/gogrid.py +++ b/salt/cloud/clouds/gogrid.py @@ -326,10 +326,11 @@ def list_passwords(kwargs=None, call=None): ret = {} for item in response['list']: - server = item['server']['name'] - if server not in ret: - ret[server] = [] - ret[server].append(item) + if 'server' in item: + server = item['server']['name'] + if server not in ret: + ret[server] = [] + ret[server].append(item) return ret