mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 01:30:20 +00:00
Merge branch '2016.11' into 'develop'
Conflicts: - salt/states/kapacitor.py
This commit is contained in:
commit
9ad362fbde
79 changed files with 377 additions and 276 deletions
|
@ -94,10 +94,10 @@ virtualenv using the ``--system-site-packages`` option so that these modules
|
|||
are available in the virtualenv.
|
||||
|
||||
|
||||
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 zmq
|
||||
|
@ -187,7 +187,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:
|
||||
|
||||
|
|
|
@ -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
|
||||
--------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -83,10 +83,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 <macos-installation>`
|
||||
You can install needed dependencies on macOS using homebrew or macports.
|
||||
See :ref:`macOS Installation <macos-installation>`
|
||||
|
||||
.. warning:: Installing on RedHat-based Distros
|
||||
|
||||
|
@ -195,7 +195,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
|
||||
<macos-installation>` instructions.
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <https://saltstack.com/product-support-lifecycle/>`_ for more information.
|
||||
Salt master on macOS is not tested or supported by SaltStack. See `SaltStack Platform Support <https://saltstack.com/product-support-lifecycle/>`_ 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!
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -30,6 +30,6 @@ Tutorials Index
|
|||
* :ref:`How to Convert Jinja Logic to an Execution Module <tutorial-jinja_to_execution-module>`
|
||||
* :ref:`Using Salt with Stormpath <tutorial-stormpath>`
|
||||
* :ref:`Syslog-ng usage <syslog-ng-sate-usage>`
|
||||
* :ref:`The MacOS X (Maverick) Developer Step By Step Guide To Salt Installation <tutorial-macos-walk-through>`
|
||||
* :ref:`The macOS (Maverick) Developer Step By Step Guide To Salt Installation <tutorial-macos-walk-through>`
|
||||
* :ref:`SaltStack Walk-through <tutorial-salt-walk-through>`
|
||||
* :ref:`Writing Salt Tests <tutorial-salt-testing>`
|
||||
|
|
|
@ -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
|
||||
<http://docs.saltstack.com/topics/installation/osx.html>`_
|
||||
|
||||
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
|
|||
<salt.modules.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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
from salt.utils import parsers
|
||||
from salt.utils.verify import check_user, verify_log
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -321,10 +321,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
|
||||
|
||||
|
|
|
@ -1045,7 +1045,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
|
||||
|
|
|
@ -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 '
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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.
|
||||
|
||||
'''
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Support for MacPorts under Mac OSX.
|
||||
Support for MacPorts under macOS.
|
||||
|
||||
This module has some caveats.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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]'):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -33,7 +33,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__
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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 <https://docs.python.org/2/library/glob.html>`.
|
||||
|
||||
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
|
||||
from jinja2 import FileSystemLoader, Environment
|
||||
|
||||
# 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,30 @@ 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
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -203,7 +203,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::
|
||||
|
|
|
@ -72,16 +72,26 @@ 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 = 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')
|
||||
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,12 +99,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(),
|
||||
lineterm=''
|
||||
))
|
||||
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']:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Writing/reading defaults from an OS X minion
|
||||
Writing/reading defaults from a macOS minion
|
||||
============================================
|
||||
|
||||
'''
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1662,7 +1662,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')
|
||||
|
||||
|
|
|
@ -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 psutil
|
||||
|
@ -21,12 +18,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'
|
||||
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -121,7 +121,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:
|
||||
|
@ -597,7 +597,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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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}):
|
||||
|
|
|
@ -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}):
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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'},
|
||||
|
|
|
@ -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': {
|
||||
|
|
Loading…
Add table
Reference in a new issue