Merge branch 'master' into win_task_repeat

This commit is contained in:
Charles McMarrow 2020-01-17 09:53:49 -08:00 committed by GitHub
commit 6e923f75fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
188 changed files with 22789 additions and 7575 deletions

View file

@ -10,7 +10,7 @@ runTestSuite(
nox_env_name: 'runtests-zeromq',
nox_passthrough_opts: '--ssh-tests',
python_version: 'py2',
testrun_timeout: 6,
use_spot_instances: true)
testrun_timeout: 7,
use_spot_instances: false)
// vim: ft=groovy

View file

@ -10,7 +10,7 @@ runTestSuite(
nox_env_name: 'runtests-zeromq',
nox_passthrough_opts: '--unit',
python_version: 'py3',
testrun_timeout: 8,
testrun_timeout: 9,
use_spot_instances: false)
// vim: ft=groovy

View file

@ -10,7 +10,7 @@ runTestSuite(
nox_env_name: 'runtests-zeromq',
nox_passthrough_opts: '--unit',
python_version: 'py3',
testrun_timeout: 8,
testrun_timeout: 9,
use_spot_instances: false)
// vim: ft=groovy

0
.git-blame-ignore-revs Normal file
View file

11
.github/stale.yml vendored
View file

@ -2,15 +2,18 @@
# Number of days of inactivity before an issue becomes stale
# 600 is approximately 1 year and 8 months
daysUntilStale: 600
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
#exemptLabels:
# - pinned
# - security
exemptLabels:
- Confirmed
- Blocker
- Critical
- P1
- P2
# Label to use when marking an issue as stale
staleLabel: stale

3
.gitignore vendored
View file

@ -104,6 +104,9 @@ tests/integration/cloud/providers/pki/minions
# Ignore nox virtualenvs
/.nox/
# Ignore pyenv files
.python-version
# Kitchen tests files
.kitchen.local.yml
kitchen.local.yml

View file

@ -25,3 +25,14 @@
# script: Fedora
# minion:
# cheese: edam
#tencentcloud-guangzhou-s1sm1:
# provider: my-tencentcloud-config
# availability_zone: ap-guangzhou-3
# image: img-31tjrtph
# size: S1.SMALL1
# allocate_public_ip: True
# internet_max_bandwidth_out: 1
# password: '153e41ec96140152'
# securitygroups:
# - sg-5e90804b

View file

@ -0,0 +1,10 @@
#tencentcloud-guangzhou-s1sm1:
# provider: my-tencentcloud-config
# availability_zone: ap-guangzhou-3
# image: img-31tjrtph
# size: S1.SMALL1
# allocate_public_ip: True
# internet_max_bandwidth_out: 1
# password: '153e41ec96140152'
# securitygroups:
# - sg-5e90804b

View file

@ -87,3 +87,12 @@
#my-scaleway-config:
# driver: scaleway
#my-tencentcloud-config:
# driver: tencentcloud
# Tencent Cloud Secret Id
# id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
# key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
# location: ap-guangzhou

View file

@ -0,0 +1,8 @@
#my-tencentcloud-config:
# driver: tencentcloud
# Tencent Cloud Secret Id
# id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
# key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
# location: ap-guangzhou

View file

@ -350,7 +350,7 @@
# the autosign_file and the auto_accept setting.
#autoreject_file: /etc/salt/autoreject.conf
# If the autosign_grains_dir is specified, incoming keys from minons with grain
# If the autosign_grains_dir is specified, incoming keys from minions with grain
# values matching those defined in files in this directory will be accepted
# automatically. This is insecure. Minions need to be configured to send the grains.
#autosign_grains_dir: /etc/salt/autosign_grains
@ -1299,3 +1299,9 @@
# use OS defaults, typically 75 seconds on Linux, see
# /proc/sys/net/ipv4/tcp_keepalive_intvl.
#tcp_keepalive_intvl: -1
##### NetAPI settings #####
############################################
# Allow the raw_shell parameter to be used when calling Salt SSH client via API
#netapi_allow_raw_shell: True

View file

@ -548,6 +548,11 @@
# - edit.vim
# - hyper
#
# List of grains to pass in start event when minion starts up:
#start_event_grains:
# - machine_id
# - uuid
#
# Top file to execute if startup_states is 'top':
#top_file: ''

View file

@ -302,7 +302,7 @@ syndic_user: salt
# the autosign_file and the auto_accept setting.
#autoreject_file: /etc/salt/autoreject.conf
# If the autosign_grains_dir is specified, incoming keys from minons with grain
# If the autosign_grains_dir is specified, incoming keys from minions with grain
# values matching those defined in files in this directory will be accepted
# automatically. This is insecure. Minions need to be configured to send the grains.
#autosign_grains_dir: /etc/salt/autosign_grains

View file

@ -255,8 +255,8 @@ on_saltstack = 'SALT_ON_SALTSTACK' in os.environ
project = 'Salt'
repo_primary_branch = 'master' # This is the default branch on GitHub for the Salt project
version = salt.version.__version__
latest_release = '2019.2.2' # latest release
previous_release = '2018.3.4' # latest release from previous branch
latest_release = '2019.2.3' # latest release
previous_release = '2018.3.5' # latest release from previous branch
previous_release_dir = '2018.3' # path on web server for previous branch
next_release = '' # next release
next_release_dir = '' # path on web server for next release branch

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-API" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-API" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-api \- salt-api Command
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-CALL" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-CALL" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-call \- salt-call Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-CLOUD" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-CLOUD" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-cloud \- Salt Cloud Command
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-CP" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-CP" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-cp \- salt-cp Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-KEY" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-KEY" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-key \- salt-key Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-MASTER" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-MASTER" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-master \- salt-master Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-MINION" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-MINION" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-minion \- salt-minion Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-PROXY" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-PROXY" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-proxy \- salt-proxy Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-RUN" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-RUN" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-run \- salt-run Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-SSH" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-SSH" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-ssh \- salt-ssh Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-SYNDIC" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-SYNDIC" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-syndic \- salt-syndic Documentation
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT-UNITY" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT-UNITY" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt-unity \- salt-unity Command
.

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SALT" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SALT" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
salt \- salt
.

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "SPM" "1" "Oct 02, 2019" "2019.2.2" "Salt"
.TH "SPM" "1" "Jan 15, 2020" "3000" "Salt"
.SH NAME
spm \- Salt Package Manager Command
.

View file

@ -34,6 +34,7 @@ cloud modules
scaleway
softlayer
softlayer_hw
tencentcloud
vagrant
virtualbox
vmware

View file

@ -0,0 +1,6 @@
==============================
salt.cloud.clouds.tencentcloud
==============================
.. automodule:: salt.cloud.clouds.tencentcloud
:members:

View file

@ -4266,7 +4266,7 @@ explanation <git-pillar-multiple-remotes>` from the git_pillar documentation.
``git_pillar_update_interval``
******************************
.. versionadded:: neon
.. versionadded:: 3000
Default: ``60``

View file

@ -657,7 +657,7 @@ FQDN (for instance, Solaris).
``minion_id_remove_domain``
---------------------------
.. versionadded:: Neon
.. versionadded:: 3000
Default: ``False``
@ -813,7 +813,7 @@ matches, and regular expressions are supported.
Some states and execution modules depend on grains. Filtering may cause
them to be unavailable or run unreliably.
.. versionadded:: Neon
.. versionadded:: 3000
.. code-block:: yaml
@ -2081,6 +2081,21 @@ List of states to run when the minion starts up if ``startup_states`` is set to
- edit.vim
- hyper
.. conf_minion:: start_event_grains
``start_event_grains``
----------------------
Default: ``[]``
List of grains to pass in start event when minion starts up.
.. code-block:: yaml
start_event_grains:
- machine_id
- uuid
.. conf_minion:: top_file
``top_file``

View file

@ -938,7 +938,7 @@ For example:
In the above case, ``some_check`` will be run prior to _each_ name -- once for
``first_deploy_cmd`` and a second time for ``second_deploy_cmd``.
.. versionchanged:: Neon
.. versionchanged:: 3000
The ``unless`` requisite can take a module as a dictionary field in unless.
The dictionary must contain an argument ``fun`` which is the module that is
being run, and everything else must be passed in under the args key or will
@ -1006,7 +1006,7 @@ concept of ``True`` and ``False``.
The above example ensures that the stop_volume and delete modules only run
if the gluster commands return a 0 ret value.
.. versionchanged:: Neon
.. versionchanged:: 3000
The ``onlyif`` requisite can take a module as a dictionary field in onlyif.
The dictionary must contain an argument ``fun`` which is the module that is
being run, and everything else must be passed in under the args key or will

View file

@ -38,26 +38,26 @@ These are features that are available for almost every cloud host.
.. container:: scrollable
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
| |AWS |CloudStack|Digital|EC2|GoGrid|JoyEnt|Linode|OpenStack|Parallels|Rackspace|Saltify|Vagrant|Softlayer|Softlayer|Aliyun|
| |(Legacy)| |Ocean | | | | | | |(Legacy) | | | |Hardware | |
+=======================+========+==========+=======+===+======+======+======+=========+=========+=========+=======+=======+=========+=========+======+
|Query |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|Full Query |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|Selective Query |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|List Sizes |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[2] |[2] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|List Images |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|List Locations |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[2] |[2] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|create |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |[1] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
|destroy |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
| |AWS |CloudStack|Digital|EC2|GoGrid|JoyEnt|Linode|OpenStack|Parallels|Rackspace|Saltify|Vagrant|Softlayer|Softlayer|Aliyun|Tencent|
| |(Legacy)| |Ocean | | | | | | |(Legacy) | | | |Hardware | |Cloud |
+=======================+========+==========+=======+===+======+======+======+=========+=========+=========+=======+=======+=========+=========+======+=======+
|Query |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|Full Query |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|Selective Query |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|List Sizes |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[2] |[2] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|List Images |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|List Locations |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[2] |[2] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|create |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |[1] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
|destroy |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |[1] |[1] |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+-------+-------+---------+---------+------+-------+
[1] Yes, if salt-api is enabled.
@ -74,46 +74,46 @@ instance name to be passed in. For example:
.. container:: scrollable
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|Actions |AWS |CloudStack|Digital|EC2|GoGrid|JoyEnt|Linode|OpenStack|Parallels|Rackspace|Saltify&|Softlayer|Softlayer|Aliyun|
| |(Legacy)| |Ocean | | | | | | |(Legacy) | Vagrant| |Hardware | |
+=======================+========+==========+=======+===+======+======+======+=========+=========+=========+========+=========+=========+======+
|attach_volume | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|create_attach_volumes |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|del_tags |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|delvol_on_destroy | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|detach_volume | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|disable_term_protect |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|enable_term_protect |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_tags |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|keepvol_on_destroy | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_keypairs | | |Yes | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|rename |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|set_tags |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_delvol_on_destroy | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_instance | | |Yes |Yes| | |Yes | |Yes | | |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_term_protect | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|start |Yes | | |Yes| |Yes |Yes | |Yes | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|stop |Yes | | |Yes| |Yes |Yes | |Yes | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|take_action | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|Actions |AWS |CloudStack|Digital|EC2|GoGrid|JoyEnt|Linode|OpenStack|Parallels|Rackspace|Saltify&|Softlayer|Softlayer|Aliyun|Tencent|
| |(Legacy)| |Ocean | | | | | | |(Legacy) | Vagrant| |Hardware | |Cloud |
+=======================+========+==========+=======+===+======+======+======+=========+=========+=========+========+=========+=========+======+=======+
|attach_volume | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|create_attach_volumes |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|del_tags |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|delvol_on_destroy | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|detach_volume | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|disable_term_protect |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|enable_term_protect |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_tags |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|keepvol_on_destroy | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_keypairs | | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|rename |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|set_tags |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_delvol_on_destroy | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_instance | | |Yes |Yes| | |Yes | |Yes | | |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_term_protect | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|start |Yes | | |Yes| |Yes |Yes | |Yes | | | | |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|stop |Yes | | |Yes| |Yes |Yes | |Yes | | | | |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|take_action | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
Functions
=========
@ -126,83 +126,83 @@ require the name of the provider to be passed in. For example:
.. container:: scrollable
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|Functions |AWS |CloudStack|Digital|EC2|GoGrid|JoyEnt|Linode|OpenStack|Parallels|Rackspace|Saltify&|Softlayer|Softlayer|Aliyun|
| |(Legacy)| |Ocean | | | | | | |(Legacy) | Vagrant| |Hardware | |
+=======================+========+==========+=======+===+======+======+======+=========+=========+=========+========+=========+=========+======+
|block_device_mappings |Yes | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|create_keypair | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|create_volume | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|delete_key | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|delete_keypair | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|delete_volume | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_image | | |Yes | | |Yes | | |Yes | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_ip | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_key | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_keyid | | |Yes | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_keypair | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_networkid | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_node | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_password | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_size | | |Yes | | |Yes | | | | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_spot_config | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|get_subnetid | | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|iam_profile |Yes | | |Yes| | | | | | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|import_key | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|key_list | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|keyname |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_availability_zones| | | |Yes| | | | | | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_custom_images | | | | | | | | | | | |Yes | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_keys | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_nodes |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_nodes_full |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_nodes_select |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|list_vlans | | | | | | | | | | | |Yes |Yes | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|rackconnect | | | | | | | |Yes | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|reboot | | | |Yes| |Yes | | | | |[1] | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|reformat_node | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|securitygroup |Yes | | |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|securitygroupid | | | |Yes| | | | | | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_image | | | |Yes| | | | |Yes | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_key | | | | | |Yes | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_keypair | | |Yes |Yes| | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
|show_volume | | | |Yes| | | | | | | | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|Functions |AWS |CloudStack|Digital|EC2|GoGrid|JoyEnt|Linode|OpenStack|Parallels|Rackspace|Saltify&|Softlayer|Softlayer|Aliyun|Tencent|
| |(Legacy)| |Ocean | | | | | | |(Legacy) | Vagrant| |Hardware | |Cloud |
+=======================+========+==========+=======+===+======+======+======+=========+=========+=========+========+=========+=========+======+=======+
|block_device_mappings |Yes | | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|create_keypair | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|create_volume | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|delete_key | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|delete_keypair | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|delete_volume | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_image | | |Yes | | |Yes | | |Yes | | | | |Yes | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_ip | |Yes | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_key | |Yes | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_keyid | | |Yes | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_keypair | |Yes | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_networkid | |Yes | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_node | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_password | |Yes | | | | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_size | | |Yes | | |Yes | | | | | | | |Yes | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_spot_config | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|get_subnetid | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|iam_profile |Yes | | |Yes| | | | | | | | | |Yes | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|import_key | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|key_list | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|keyname |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_availability_zones| | | |Yes| | | | | | | | | |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_custom_images | | | | | | | | | | | |Yes | | |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_keys | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_nodes |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_nodes_full |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_nodes_select |Yes |Yes |Yes |Yes|Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|list_vlans | | | | | | | | | | | |Yes |Yes | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|rackconnect | | | | | | | |Yes | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|reboot | | | |Yes| |Yes | | | | |[1] | | |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|reformat_node | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|securitygroup |Yes | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|securitygroupid | | | |Yes| | | | | | | | | |Yes | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_image | | | |Yes| | | | |Yes | | | | |Yes |Yes |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_key | | | | | |Yes | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_keypair | | |Yes |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
|show_volume | | | |Yes| | | | | | | | | | | |
+-----------------------+--------+----------+-------+---+------+------+------+---------+---------+---------+--------+---------+---------+------+-------+
[1] Yes, if salt-api is enabled.

View file

@ -128,6 +128,7 @@ Cloud Provider Specifics
Getting Started With Scaleway <scaleway>
Getting Started With Saltify <saltify>
Getting Started With SoftLayer <softlayer>
Getting Started With Tencent Cloud <tencentcloud>
Getting Started With Vagrant <vagrant>
Getting Started With Vexxhost <vexxhost>
Getting Started With Virtualbox <virtualbox>

View file

@ -0,0 +1,309 @@
==================================
Getting Started With Tencent Cloud
==================================
Tencent Cloud is a secure, reliable and high-performance cloud compute service
provided by Tencent. It is the 2nd largest Cloud Provider in China.
Dependencies
============
The Tencent Cloud driver for Salt Cloud requires the ``tencentcloud-sdk-python`` package,
which is available at PyPI:
https://pypi.org/project/tencentcloud-sdk-python/
This package can be installed using ``pip`` or ``easy_install``:
.. code-block:: bash
# pip install tencentcloud-sdk-python
# easy_install tencentcloud-sdk-python
Provider Configuration
======================
To use this module, set up the cloud configuration at
``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/*.conf``:
.. code-block:: yaml
my-tencentcloud-config:
driver: tencentcloud
# Tencent Cloud Secret Id
id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
location: ap-guangzhou
Configuration Parameters
~~~~~~~~~~~~~~~~~~~~~~~~
driver
------
**Required**. ``tencentcloud`` to use this module.
id
--
**Required**. Your Tencent Cloud secret id.
key
---
**Required**. Your Tencent Cloud secret key.
location
--------
**Optional**. If this value is not specified, the default is ``ap-guangzhou``.
Available locations can be found using the ``--list-locations`` option:
.. code-block:: bash
# salt-cloud --list-location my-tencentcloud-config
Profile Configuration
=====================
Tencent Cloud profiles require a ``provider``, ``availability_zone``, ``image`` and ``size``.
Set up an initial profile at ``/etc/salt/cloud.profiles`` or ``/etc/salt/cloud.profiles.d/*.conf``:
.. code-block:: yaml
tencentcloud-guangzhou-s1sm1:
provider: my-tencentcloud-config
availability_zone: ap-guangzhou-3
image: img-31tjrtph
size: S1.SMALL1
allocate_public_ip: True
internet_max_bandwidth_out: 1
password: '153e41ec96140152'
securitygroups:
- sg-5e90804b
Configuration Parameters
~~~~~~~~~~~~~~~~~~~~~~~~
provider
--------
**Required**. Name of entry in ``salt/cloud.providers.d/???`` file.
availability_zone
-----------------
**Required**. The availability zone that the instance is located in.
Available zones can be found using the ``list_availability_zones`` function:
.. code-block:: bash
# salt-cloud -f list_availability_zones my-tencentcloud-config
image
-----
**Required**. The image id to use for the instance.
Available images can be found using the ``--list-images`` option:
.. code-block:: bash
# salt-cloud --list-images my-tencentcloud-config
size
----
**Required**. Instance type for instance can be found using the ``--list-sizes`` option.
.. code-block:: bash
# salt-cloud --list-sizes my-tencentcloud-config
securitygroups
--------------
**Optional**. A list of security group ids to associate with.
Available security group ids can be found using the ``list_securitygroups`` function:
.. code-block:: bash
# salt-cloud -f list_securitygroups my-tencentcloud-config
Multiple security groups are supported:
.. code-block:: yaml
tencentcloud-guangzhou-s1sm1:
securitygroups:
- sg-5e90804b
- sg-8kpynf2t
hostname
--------
**Optional**. The hostname of the instance.
instance_charge_type
--------------------
**Optional**. The charge type of the instance. Valid values are ``PREPAID``,
``POSTPAID_BY_HOUR`` and ``SPOTPAID``. The default is ``POSTPAID_BY_HOUR``.
instance_charge_type_prepaid_renew_flag
---------------------------------------
**Optional**. When enabled, the instance will be renew automatically
when it reaches the end of the prepaid tenancy.
Valid values are ``NOTIFY_AND_AUTO_RENEW``, ``NOTIFY_AND_MANUAL_RENEW`` and ``DISABLE_NOTIFY_AND_MANUAL_RENEW``.
.. note::
This value is only used when ``instance_charge_type`` is set to ``PREPAID``.
instance_charge_type_prepaid_period
-----------------------------------
**Optional**. The tenancy time in months of the prepaid instance,
Valid values are ``1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36``.
.. note::
This value is only used when ``instance_charge_type`` is set to ``PREPAID``.
allocate_public_ip
------------------
**Optional**. Associate a public ip address with an instance
in a VPC or Classic. Boolean value, default is ``false``.
internet_max_bandwidth_out
--------------------------
**Optional**. Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bits per second).
Value range: ``[0, 100]``. If this value is not specified, the default is ``0`` Mbps.
internet_charge_type
--------------------
**Optional**. Internet charge type of the instance. Valid values are ``BANDWIDTH_PREPAID``,
``TRAFFIC_POSTPAID_BY_HOUR``, ``BANDWIDTH_POSTPAID_BY_HOUR`` and ``BANDWIDTH_PACKAGE``.
The default is ``TRAFFIC_POSTPAID_BY_HOUR``.
key_name
--------
**Optional**. The key pair to use for the instance, for example ``skey-16jig7tx``.
password
--------
**Optional**. Login password for the instance.
private_ip
----------
**Optional**. The private ip to be assigned to this instance,
must be in the provided subnet and available.
project_id
----------
**Optional**. The project this instance belongs to, defaults to ``0``.
vpc_id
------
**Optional**. The id of a VPC network.
If you want to create instances in a VPC network, this parameter must be set.
subnet_id
---------
**Optional**. The id of a VPC subnet.
If you want to create instances in VPC network, this parameter must be set.
system_disk_size
----------------
**Optional**. Size of the system disk.
Value range: ``[50, 1000]``, and unit is ``GB``. Default is ``50`` GB.
system_disk_type
----------------
**Optional**. Type of the system disk.
Valid values are ``CLOUD_BASIC``, ``CLOUD_SSD`` and ``CLOUD_PREMIUM``, default value is ``CLOUD_BASIC``.
Actions
=======
The following actions are supported by the Tencent Cloud Salt Cloud driver.
show_instance
~~~~~~~~~~~~~
This action is a thin wrapper around ``--full-query``, which displays details on a
single instance only. In an environment with several machines, this will save a
user from having to sort through all instance data, just to examine a single
instance.
.. code-block:: bash
$ salt-cloud -a show_instance myinstance
show_disk
~~~~~~~~~
Return disk details about a specific instance.
.. code-block:: bash
$ salt-cloud -a show_disk myinstance
destroy
~~~~~~~
Destroy a Tencent Cloud instance.
.. code-block:: bash
$ salt-cloud -a destroy myinstance
start
~~~~~
Start a Tencent Cloud instance.
.. code-block:: bash
$ salt-cloud -a start myinstance
stop
~~~~
Stop a Tencent Cloud instance.
.. code-block:: bash
$ salt-cloud -a stop myinstance
reboot
~~~~~~
Reboot a Tencent Cloud instance.
.. code-block:: bash
$ salt-cloud -a reboot myinstance
Functions
=========
The following functions are currently supported by the Tencent Cloud Salt Cloud driver.
list_securitygroups
~~~~~~~~~~~~~~~~~~~
Lists all Tencent Cloud security groups in current region.
.. code-block:: bash
$ salt-cloud -f list_securitygroups my-tencentcloud-config
list_availability_zones
~~~~~~~~~~~~~~~~~~~~~~~
Lists all Tencent Cloud availability zones in current region.
.. code-block:: bash
$ salt-cloud -f list_availability_zones my-tencentcloud-config
list_custom_images
~~~~~~~~~~~~~~~~~~
Lists any custom images associated with the account. These images can
be used to create a new instance.
.. code-block:: bash
$ salt-cloud -f list_custom_images my-tencentcloud-config
show_image
~~~~~~~~~~
Return details about a specific image. This image can be used
to create a new instance.
.. code-block:: bash
$ salt-cloud -f show_image tencentcloud image=img-31tjrtph

View file

@ -4,39 +4,83 @@
Contributing
============
There is a great need for contributions to Salt and patches are welcome! The goal
here is to make contributions clear, make sure there is a trail for where the code
has come from, and most importantly, to give credit where credit is due!
There is a great need for contributions to Salt and patches are welcome! The
goal here is to make contributions clear, make sure there is a trail for where
the code has come from, and most importantly, to give credit where credit is
due!
There are a number of ways to contribute to Salt development.
There are a number of ways to contribute to Salt development, including (but
not limited to):
For details on how to contribute documentation improvements please review
:ref:`Writing Salt Documentation <salt-docs>`.
* filing well-written bug reports
* enhancing the documentation
* providing workarounds, patches, and other code without tests
* engaging in constructive discussion
* helping out in `#salt on Freenode <#salt on freenode_>`_,
the `Community Slack <SaltStack Community Slack_>`_,
the `salt-users <salt-users_>`_ mailing list,
a `SaltStack meetup <saltstack meetup_>`_,
or `Server Fault <saltstack on serverfault_>`_.
* telling others about problems you solved with Salt
If this or other Salt documentation is unclear, please review :ref:`Writing
Salt Documentation <salt-docs>`. PRs are welcome!
Quickstart
----------
If you just want to get started before reading the rest of this guide, you can
get the process started by running the following:
.. code-block:: bash
python3 -m pip install --user pre-commit
git clone --origin upstream https://github.com/saltstack/salt.git
cd salt
pre-commit install
While those commands are running, finish reading the rest of this guide.
Pre-commit
----------
To reduce friction during the development process, SaltStack uses `pre-commit
<pre-commit_>`_. This tool adds pre-commit hooks to git to automate several
processes that used to be manual. Rather than having to remember to run several
different tools before you commit, you only have to run ``git commit``, and you
will be notified about style and lint issues before you ever open a PR.
Salt Coding Style
-----------------
SaltStack has its own coding style guide that informs contributors on various coding
approaches. Please review the :ref:`Salt Coding Style <coding-style>` documentation
for information about Salt's particular coding patterns.
After the 3000 release, SaltStack is `joining the ranks <SEP 15_>`_ of projects
in adopting the `Black code formatter <Black_>`_ in order to ease the adoption
of a unified code formatting style.
Where Black is silent, SaltStack has its own coding style guide that informs
contributors on various style points. Please review the :ref:`Salt Coding Style
<coding-style>` documentation for information about Salt's particular coding
patterns.
Within the :ref:`Salt Coding Style <coding-style>` documentation, there is a
section about running Salt's ``.testing.pylintrc`` file. SaltStack recommends
running the ``.testing.pylintrc`` file on any files you are changing with your
code contribution before submitting a pull request to Salt's repository. Please
see the :ref:`Linting<pylint-instructions>` documentation for more information.
code contribution before submitting a pull request to Salt's repository.
.. note::
If you've installed ``pre-commit``, this will automatically happen before each
commit. Otherwise, see the :ref:`Linting<pylint-instructions>` documentation
for more information.
There are two pylint files in the ``salt`` directory. One is the
``.pylintrc`` file and the other is the ``.testing.pylintrc`` file. The
tests that run in Jenkins against GitHub Pull Requests use
``.testing.pylintrc``. The ``testing.pylintrc`` file is a little less
strict than the ``.pylintrc`` and is used to make it easier for contributors
to submit changes. The ``.pylintrc`` file can be used for linting, but the
``testing.pylintrc`` is the source of truth when submitting pull requests.
Copyright Headers
-----------------
Copyright headers are not needed for files in the Salt project. Files that have
existing copyright headers should be considered legacy and not an example to
follow.
.. _github-pull-request:
@ -48,7 +92,8 @@ contributions. The workflow advice below mirrors `GitHub's own guide <GitHub
Fork a Repo Guide_>`_ and is well worth reading.
#. `Fork saltstack/salt`_ on GitHub.
#. Make a local clone of your fork.
#. Make a local clone of your fork. (Skip this step if you followed
the Quickstart)
.. code-block:: bash
@ -61,6 +106,12 @@ Fork a Repo Guide_>`_ and is well worth reading.
git remote add upstream https://github.com/saltstack/salt.git
If you followed the Quickstart, you'll add your own remote instead
.. code-block:: bash
git remote add my-account git@github.com:my-account/salt.git
#. Create a new branch in your clone.
.. note::
@ -69,47 +120,34 @@ Fork a Repo Guide_>`_ and is well worth reading.
feature Y". Multiple unrelated fixes and/or features should be
isolated into separate branches.
If you're working on a bug or documentation fix, create your branch from
the oldest **supported** main release branch that contains the bug or requires the documentation
update. See :ref:`Which Salt Branch? <which-salt-branch>`.
.. code-block:: bash
git fetch upstream
git checkout -b fix-broken-thing upstream/2016.11
If you're working on a feature, create your branch from the |repo_primary_branch| branch.
.. code-block:: bash
git fetch upstream
git checkout -b add-cool-feature upstream/|repo_primary_branch|
git checkout -b fix-broken-thing upstream/master
#. Edit and commit changes to your branch.
.. code-block:: bash
vim path/to/file1 path/to/file2
vim path/to/file1 path/to/file2 tests/test_file1.py tests/test_file2.py
git diff
git add path/to/file1 path/to/file2
git commit
Write a short, descriptive commit title and a longer commit message if
necessary.
necessary. Use an imperative style for the title.
.. note::
GOOD
If your change fixes a bug or implements a feature already filed in the
`issue tracker`_, be sure to
`reference the issue <https://help.github.com/en/articles/closing-issues-using-keywords>`_
number in the commit message body.
.. code-block:: bash
.. code-block::
Fix broken things in file1 and file2
Fixes #31337
We needed to make this change because the underlying dependency
changed. Now this uses the up-to-date API.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch fix-broken-thing
@ -117,6 +155,30 @@ Fork a Repo Guide_>`_ and is well worth reading.
# modified: path/to/file1
# modified: path/to/file2
BAD
.. code-block::
Fixes broken things
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch fix-broken-thing
# Changes to be committed:
# modified: path/to/file1
# modified: path/to/file2
Taking a few moments to explain *why* you made a change will save time
and effort in the future when others come to investigate a change. A
clear explanation of why something changed can help future developers
avoid introducing bugs, or breaking an edge case.
.. note::
If your change fixes a bug or implements a feature already filed in the
`issue tracker`_, be sure to
`reference the issue <https://help.github.com/en/articles/closing-issues-using-keywords>`_
number in the commit message body.
If you get stuck, there are many introductory Git resources on
http://help.github.com.
@ -141,17 +203,9 @@ Fork a Repo Guide_>`_ and is well worth reading.
.. code-block:: bash
git fetch upstream
git rebase upstream/2016.11 fix-broken-thing
git rebase upstream/master fix-broken-thing
git push -u origin fix-broken-thing
or
.. code-block:: bash
git fetch upstream
git rebase upstream/|repo_primary_branch| add-cool-feature
git push -u origin add-cool-feature
If you do rebase, and the push is rejected with a
``(non-fast-forward)`` comment, then run ``git status``. You will
likely see a message about the branches diverging:
@ -180,18 +234,11 @@ Fork a Repo Guide_>`_ and is well worth reading.
https://github.com/my-account/salt/pull/new/fix-broken-thing
#. If your branch is a fix for a release branch, choose that as the base
branch (e.g. ``2016.11``),
https://github.com/my-account/salt/compare/saltstack:2016.11...fix-broken-thing
If your branch is a feature, choose ``|repo_primary_branch|`` as the base branch,
https://github.com/my-account/salt/compare/saltstack:|repo_primary_branch|...add-cool-feature
#. Choose ``master`` as the base Salt branch.
#. Review that the proposed changes are what you expect.
#. Write a descriptive comment. Include links to related issues (e.g.
'Fixes #31337.') in the comment field.
#. Write a descriptive comment. If you added good information to your git
commit message, they will already be present here. Include links to
related issues (e.g. 'Fixes #31337.') in the comment field.
#. Click ``Create pull request``.
#. Salt project members will review your pull request and automated tests will
@ -209,8 +256,8 @@ Fork a Repo Guide_>`_ and is well worth reading.
Pull request against `saltstack/salt`_ are automatically tested on a
variety of operating systems and configurations. On average these tests
take 30 minutes. Depending on your GitHub notification settings you may
also receive an email message about the test results.
take a couple of hours. Depending on your GitHub notification settings
you may also receive an email message about the test results.
Test progress and results can be found at http://jenkins.saltstack.com/.
@ -219,209 +266,65 @@ Fork a Repo Guide_>`_ and is well worth reading.
Salt's Branch Topology
----------------------
There are three different kinds of branches in use: |repo_primary_branch|, main release
branches, and dot release branches.
Salt will only have one active branch - ``master``.
This will include bug fixes, features and CVE “Common Vulnerabilities and Exposures”.
- All feature work should go into the ``|repo_primary_branch|`` branch.
- Bug fixes and documentation changes should go into the oldest **supported
main** release branch affected by the the bug or documentation change (you
can use the blame button in github to figure out when the bug was introduced).
Supported releases are the last 2 releases. For example, if the latest release
is 2018.3, the last two release are 2018.3 and 2017.7.
Main release branches are named after a year and month, such as
``2016.11`` and ``2017.7``.
- Hot fixes, as determined by SaltStack's release team, should be submitted
against **dot** release branches. Dot release branches are named after a
year, month, and version. Examples include ``2016.11.8`` and ``2017.7.2``.
The release will be cut from the master when the time comes for a new release,
which should be every 3 to 4 months.
.. note::
To be able to merge code:
GitHub will open pull requests against Salt's main branch, ``|repo_primary_branch|``,
by default. Be sure to check which branch is selected when creating the
pull request.
#. The code must have a well-written test.
Note that you are only expected to write tests for what you did, not the whole modules or function.
The |repo_primary_branch| Branch
================================
#. All tests must pass.
The ``|repo_primary_branch|`` branch is unstable and bleeding-edge. Pull requests containing
feature additions or non-bug-fix changes should be made against the ``|repo_primary_branch|``
branch.
The SaltStack employee that reviews your pull request might request changes or deny the pull request for various reasons.
.. note::
If you have a bug fix or documentation change and have already forked your
working branch from ``|repo_primary_branch|`` and do not know how to rebase your commits
against another branch, then submit it to ``|repo_primary_branch|`` anyway. SaltStack's
development team will be happy to back-port it to the correct branch.
**Please make sure you let the maintainers know that the pull request needs
to be back-ported.**
Main Release Branches
=====================
The current release branch is the most recent stable release. Pull requests
containing bug fixes or documentation changes should be made against the oldest supported main
release branch that is affected.
The branch name will be a date-based name such as ``2016.11``.
Bug fixes are made on this branch so that dot release branches can be cut from
the main release branch without introducing surprises and new features. This
approach maximizes stability.
Dot Release Branches
====================
Prior to tagging an official release, a branch will be created when the SaltStack
release team is ready to tag. The dot release branch is created from a main release
branch. The dot release branch will be the same name as the tag minus the ``v``.
For example, the ``2017.7.1`` dot release branch was created from the ``2017.7``
main release branch. The ``v2017.7.1`` release was tagged at the ``HEAD`` of the
``2017.7.1`` branch.
This branching strategy will allow for more stability when there is a need for
a re-tag during the testing phase of the release process and further increases
stability.
Once the dot release branch is created, the fixes required for a given release,
as determined by the SaltStack release team, will be added to this branch. All
commits in this branch will be merged forward into the main release branch as
well.
Merge Forward Process
=====================
The Salt repository follows a "Merge Forward" policy. The merge-forward
behavior means that changes submitted to older main release branches will
automatically be "merged-forward" into the newer branches.
For example, a pull request is merged into ``2017.7``. Then, the entire
``2017.7`` branch is merged-forward into the ``2018.3`` branch, and the
``2018.3`` branch is merged-forward into the ``|repo_primary_branch|`` branch.
This process makes is easy for contributors to make only one pull-request
against an older branch, but allows the change to propagate to all **main**
release branches.
The merge-forward work-flow applies to all main release branches and the
operation runs continuously.
Merge-Forwards for Dot Release Branches
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The merge-forward policy applies to dot release branches as well, but has a
slightly different behavior. If a change is submitted to a **dot** release
branch, the dot release branch will be merged into its parent **main**
release branch.
For example, a pull request is merged into the ``2017.7.2`` release branch.
Then, the entire ``2017.7.2`` branch is merged-forward into the ``2017.7``
branch. From there, the merge forward process continues as normal.
The only way in which dot release branches differ from main release branches
in regard to merge-forwards, is that once a dot release branch is created
from the main release branch, the dot release branch does not receive merge
forwards.
.. note::
The merge forward process for dot release branches is one-way:
dot release branch --> main release branch.
Salt uses a typical branch strategy - ``master`` is the next expected release.
Code should only make it to ``master`` once it's production ready. This means
that typical changes (fixes, features) should have accompanying tests.\
Closing GitHub issues from commits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This "merge-forward" strategy requires that `the magic keywords to close a
GitHub issue <Closing issues via commit message_>`_ appear in the commit
message text directly. Only including the text in a pull request will not
close the issue.
SaltStack encourages using `the magic keywords to close a GitHub issue <Closing
issues via commit message_>`_. These should appear in the commit message text
directly.
GitHub will close the referenced issue once the *commit* containing the
magic text is merged into the default branch (``|repo_primary_branch|``). Any magic text
input only into the pull request description will not be seen at the
Git-level when those commits are merged-forward. In other words, only the
commits are merged-forward and not the pull request text.
Release Naming Convention
-------------------------
A new convention will start when Salt releases Salt 3000.
Every new release name will increment by one Salt last_release_number + 1.
This naming convention is very different from past releases, which was 'YYYY.MM.PATCH'.
Handling CVE
--------------
If a CVE is discovered, Salt will create a new release that **only** contains the tests and patch for the CVE.
This method should improve the upgrade process by reducing the chances of breaking something.
.. _backporting-pull-requests:
Backporting Pull Requests
=========================
-------------------------
If a bug is fixed on ``|repo_primary_branch|`` and the bug is also present on a
currently-supported release branch, it will need to be back-ported to an
applicable branch.
.. note:: Most Salt contributors can skip these instructions
These instructions do not need to be read in order to contribute to the
Salt project! The SaltStack team will back-port fixes on behalf of
contributors in order to keep the contribution process easy.
These instructions are intended for frequent Salt contributors, advanced
Git users, SaltStack employees, or independent souls who wish to back-port
changes themselves.
It is often easiest to fix a bug on the oldest supported release branch and
then merge that branch forward into ``|repo_primary_branch|`` (as described earlier in this
document). When that is not possible the fix must be back-ported, or copied,
into any other affected branches.
These steps assume a pull request ``#1234`` has been merged into ``|repo_primary_branch|``.
And ``upstream`` is the name of the remote pointing to the main Salt repo.
#. Identify the oldest supported release branch that is affected by the bug.
#. Create a new branch for the back-port by reusing the same branch from the
original pull request.
Name the branch ``bp-<NNNN>`` and use the number of the original pull
request.
.. code-block:: bash
git fetch upstream refs/pull/1234/head:bp-1234
git checkout bp-1234
#. Find the parent commit of the original pull request.
The parent commit of the original pull request must be known in order to
rebase onto a release branch. The easiest way to find this is on GitHub.
Open the original pull request on GitHub and find the first commit in the
list of commits. Select and copy the SHA for that commit. The parent of
that commit can be specified by appending ``~1`` to the end.
#. Rebase the new branch on top of the release branch.
* ``<release-branch>`` is the branch identified in step #1.
* ``<orig-base>`` is the SHA identified in step #3 -- don't forget to add
``~1`` to the end!
.. code-block:: bash
git rebase --onto <release-branch> <orig-base> bp-1234
Note, release branches prior to ``2016.11`` will not be able to make use of
rebase and must use cherry-picking instead.
#. Push the back-port branch to GitHub and open a new pull request.
Opening a pull request for the back-port allows for the test suite and
normal code-review process.
.. code-block:: bash
git push -u origin bp-1234
On rare occasions, a serious bug will be found in the middle of a release
cycle. These bugs will require a point release. Contributors should still
submit fixes directly to ``master``, but they should also call attention to the
fact that it addresses a critical issue and will need to be back-ported.
Keeping Salt Forks in Sync
--------------------------
Salt advances quickly. It is therefore critical to pull upstream changes
from upstream into your fork on a regular basis. Nothing is worse than putting
hard work into a pull request only to see bunches of merge conflicts because it
has diverged too far from upstream.
Salt advances quickly. It is therefore critical to pull upstream changes from
upstream into your fork on a regular basis. Nothing is worse than putting hard
work into a pull request only to see bunches of merge conflicts because it has
diverged too far from upstream.
.. seealso:: `GitHub Fork a Repo Guide`_
@ -450,20 +353,20 @@ the name of the main `saltstack/salt`_ repository.
git fetch upstream
#. Update your copy of the ``|repo_primary_branch|`` branch.
#. Update your copy of the ``master`` branch.
.. code-block:: bash
git checkout |repo_primary_branch|
git merge --ff-only upstream/|repo_primary_branch|
git checkout master
git merge --ff-only upstream/master
If Git complains that a fast-forward merge is not possible, you have local
commits.
* Run ``git pull --rebase origin |repo_primary_branch|`` to rebase your changes on top of
* Run ``git pull --rebase origin master`` to rebase your changes on top of
the upstream changes.
* Or, run ``git branch <branch-name>`` to create a new branch with your
commits. You will then need to reset your ``|repo_primary_branch|`` branch before
commits. You will then need to reset your ``master`` branch before
updating it with the changes from upstream.
If Git complains that local files will be overwritten, you have changes to
@ -474,7 +377,7 @@ the name of the main `saltstack/salt`_ repository.
.. code-block:: bash
git push origin |repo_primary_branch|
git push origin master
#. Repeat the previous two steps for any other branches you work with, such as
the current release branch.
@ -505,28 +408,6 @@ If you do not wish to receive these notifications, please add your GitHub
handle to the blacklist line in the ``.mention-bot`` file located in the
root of the Salt repository.
.. _probot-gpg-verification:
GPG Verification
----------------
SaltStack has enabled `GPG Probot`_ to enforce GPG signatures for all
commits included in a Pull Request.
In order for the GPG verification status check to pass, *every* contributor in
the pull request must:
- Set up a GPG key on local machine
- Sign all commits in the pull request with key
- Link key with GitHub account
This applies to all commits in the pull request.
GitHub hosts a number of `help articles`_ for creating a GPG key, using the
GPG key with ``git`` locally, and linking the GPG key to your GitHub account.
Once these steps are completed, the commit signing verification will look like
the example in GitHub's `GPG Signature Verification feature announcement`_.
Bootstrap Script Changes
------------------------
@ -551,6 +432,13 @@ Script, see the Bootstrap Script's `Contributing Guidelines`_.
.. _GPG Probot: https://probot.github.io/apps/gpg/
.. _help articles: https://help.github.com/articles/signing-commits-with-gpg/
.. _GPG Signature Verification feature announcement: https://github.com/blog/2144-gpg-signature-verification
.. _bootstrap-salt.sh: https://github.com/saltstack/salt/blob/|repo_primary_branch|/salt/cloud/deploy/bootstrap-salt.sh
.. _bootstrap-salt.sh: https://github.com/saltstack/salt/blob/master/salt/cloud/deploy/bootstrap-salt.sh
.. _salt-bootstrap repo: https://github.com/saltstack/salt-bootstrap
.. _Contributing Guidelines: https://github.com/saltstack/salt-bootstrap/blob/develop/CONTRIBUTING.md
.. _`Black`: https://pypi.org/project/black/
.. _`SEP 15`: https://github.com/saltstack/salt-enhancement-proposals/pull/21
.. _`pre-commit`: https://pre-commit.com/
.. _`SaltStack Community Slack`: https://saltstackcommunity.herokuapp.com/
.. _`#salt on freenode`: http://webchat.freenode.net/?channels=salt&uio=Mj10cnVlJjk9dHJ1ZSYxMD10cnVl83
.. _`saltstack meetup`: https://www.meetup.com/pro/saltstack/
.. _`saltstack on serverfault`: https://serverfault.com/questions/tagged/saltstack

View file

@ -4,17 +4,13 @@
Salt Coding Style
=================
Salt is developed with a certain coding style, while the style is dominantly
PEP 8 it is not completely PEP 8. It is also noteworthy that a few
development techniques are also employed which should be adhered to. In the
end, the code is made to be "Salty".
To make it easier to contribute and read Salt code, SaltStack has `adopted
Black <SEP 15_>`_ as its code formatter. There are a few places where Black is
silent, and this guide should be used in those cases.
Most importantly though, we will accept code that violates the coding style and
KINDLY ask the contributor to fix it, or go ahead and fix the code on behalf of
the contributor. Coding style is NEVER grounds to reject code contributions,
and is never grounds to talk down to another member of the community (There are
no grounds to treat others without respect, especially people working to
improve Salt)!!
Coding style is NEVER grounds to reject code contributions, and is never
grounds to talk down to another member of the community (There are no grounds
to treat others without respect, especially people working to improve Salt)!
.. _pylint-instructions:
@ -65,27 +61,6 @@ Multi-word variables should be separated by an underscore.
Variables which are two-letter words should have an underscore appended
to them to pad them to three characters.
Strings
=======
Salt follows a few rules when formatting strings:
Single Quotes
-------------
In Salt, all strings use single quotes unless there is a good reason not to.
This means that docstrings use single quotes, standard strings use single
quotes etc.:
.. code-block:: python
def foo():
'''
A function that does things
'''
name = 'A name'
return name
Formatting Strings
------------------
@ -104,31 +79,8 @@ Please do NOT use printf formatting.
Docstring Conventions
---------------------
Docstrings should always add a newline, docutils takes care of the new line and
it makes the code cleaner and more vertical:
`GOOD`:
.. code-block:: python
def bar():
'''
Here lies a docstring with a newline after the quotes and is the salty
way to handle it! Vertical code is the way to go!
'''
return
`BAD`:
.. code-block:: python
def baz():
'''This is not ok!'''
return
When adding a new function or state, where possible try to use a
``versionadded`` directive to denote when the function or state was added.
``versionadded`` directive to denote when the function, state, or parameter was added.
.. code-block:: python
@ -141,16 +93,13 @@ When adding a new function or state, where possible try to use a
msg : None
The string to be printed.
'''
print msg
print(msg)
If you are uncertain what version should be used, either consult a core
developer in IRC or bring this up when opening your
:ref:`pull request <installing-for-development>` and a core developer will add the proper
version once your pull request has been merged. Bugfixes will be available in a
bugfix release (i.e. 0.17.1, the first bugfix release for 0.17.0), while new
features are held for feature releases, and this will affect what version
number should be used in the ``versionadded`` directive.
developer in IRC or bring this up when opening your :ref:`pull request
<installing-for-development>` and a core developer will let you know what
version to add. Typically this will be the next element in the `periodic table
<https://en.wikipedia.org/wiki/List_of_chemical_elements>`_.
Similar to the above, when an existing function or state is modified (for
example, when an argument is added), then under the explanation of that new
@ -176,7 +125,7 @@ significantly, the ``versionchanged`` directive can be used to clarify this:
.. versionadded 0.17.0
'''
print 'Greetings! {0}\n\n{1}'.format(msg, signature)
print('Greetings! {0}\n\n{1}'.format(msg, signature))
Dictionaries
@ -257,130 +206,16 @@ avoided.
.. _`absolute imports`: http://legacy.python.org/dev/peps/pep-0328/#rationale-for-absolute-imports
Vertical is Better
==================
When writing Salt code, vertical code is generally preferred. This is not a hard
rule but more of a guideline. As PEP 8 specifies, Salt code should not exceed 79
characters on a line, but it is preferred to separate code out into more
newlines in some cases for better readability:
.. code-block:: python
import os
os.chmod(
os.path.join(self.opts['sock_dir'],
'minion_event_pub.ipc'),
448
)
Where there are more line breaks, this is also apparent when constructing a
function with many arguments, something very common in state functions for
instance:
.. code-block:: python
def managed(name,
source=None,
source_hash='',
user=None,
group=None,
mode=None,
template=None,
makedirs=False,
context=None,
replace=True,
defaults=None,
saltenv=None,
backup='',
**kwargs):
.. note::
Making function and class definitions vertical is only required if the
arguments are longer then 80 characters. Otherwise, the formatting is
optional and both are acceptable.
Line Length
-----------
For function definitions and function calls, Salt adheres to the PEP-8
specification of at most 80 characters per line.
Non function definitions or function calls, please adopt a soft limit of 120
characters per line. If breaking the line reduces the code readability, don't
break it. Still, try to avoid passing that 120 characters limit and remember,
**vertical is better... unless it isn't**
Indenting
=========
Some confusion exists in the python world about indenting things like function
calls, the above examples use 8 spaces when indenting comma-delimited
constructs.
The confusion arises because the pep8 program INCORRECTLY flags this as wrong,
where PEP 8, the document, cites only using 4 spaces here as wrong, as it
doesn't differentiate from a new indent level.
Right:
.. code-block:: python
def managed(name,
source=None,
source_hash='',
user=None)
WRONG:
.. code-block:: python
def managed(name,
source=None,
source_hash='',
user=None)
Lining up the indent is also correct:
.. code-block:: python
def managed(name,
source=None,
source_hash='',
user=None)
This also applies to function calls and other hanging indents.
pep8 and Flake8 (and, by extension, the vim plugin Syntastic) will complain
about the double indent for hanging indents. This is a `known conflict
<https://github.com/jcrocholl/pep8/issues/167#issuecomment-15936564>`_ between
pep8 (the script) and the actual PEP 8 standard. It is recommended that this
particular warning be ignored with the following lines in
``~/.config/flake8``:
.. code-block:: ini
[flake8]
ignore = E226,E241,E242,E126
Make sure your Flake8/pep8 are up to date. The first three errors are ignored
by default and are present here to keep the behavior the same. This will also
work for pep8 without the Flake8 wrapper -- just replace all instances of
'flake8' with 'pep8', including the filename.
Code Churn
==========
Many pull requests have been submitted that only churn code in the name of
PEP 8. Code churn is a leading source of bugs and is strongly discouraged.
PEP 8. Code churn is a leading source of bugs and is **strongly discouraged**.
While style fixes are encouraged they should be isolated to a single file per
commit, and the changes should be legitimate, if there are any questions about
whether a style change is legitimate please reference this document and the
official PEP 8 (http://legacy.python.org/dev/peps/pep-0008/) document before
changing code. Many claims that a change is PEP 8 have been invalid, please
double check before committing fixes.
.. _`SEP 15`: https://github.com/saltstack/salt-enhancement-proposals/pull/21

View file

@ -27,6 +27,24 @@ Salt engines are configured under an ``engines`` top-level section in your Salt
port: 5959
proto: tcp
.. versionadded:: 3000
Multiple copies of a particular Salt engine can be configured by including the ``engine_module`` parameter in the engine configuration.
.. code-block:: yaml
engines:
- production_logstash:
host: production_log.my_network.com
port: 5959
proto: tcp
engine_module: logstash
- develop_logstash:
host: develop_log.my_network.com
port: 5959
proto: tcp
engine_module: logstash
Salt engines must be in the Salt path, or you can add the ``engines_dirs`` option in your Salt master configuration with a list of directories under which Salt attempts to find Salt engines. This option should be formatted as a list of directories to search, such as:
.. code-block:: yaml

View file

@ -1024,7 +1024,7 @@ Returns:
``set_dict_key_value``
----------------------
..versionadded:: Neon
..versionadded:: 3000
Allows you to set a value in a nested dictionary without having to worry if all the nested keys actually exist.
Missing keys will be automatically created if they do not exist.
@ -1057,7 +1057,7 @@ Example 2:
``append_dict_key_value``
-------------------------
..versionadded:: Neon
..versionadded:: 3000
Allows you to append to a list nested (deep) in a dictionary without having to worry if all the nested keys (or the list itself) actually exist.
Missing keys will automatically be created if they do not exist.
@ -1091,7 +1091,7 @@ Example 2:
``extend_dict_key_value``
-------------------------
..versionadded:: Neon
..versionadded:: 3000
Allows you to extend a list nested (deep) in a dictionary without having to worry if all the nested keys (or the list itself) actually exist.
Missing keys will automatically be created if they do not exist.
@ -1124,7 +1124,7 @@ Example 2:
``update_dict_key_value``
-------------------------
..versionadded:: Neon
..versionadded:: 3000
Allows you to update a dictionary nested (deep) in another dictionary without having to worry if all the nested keys actually exist.
Missing keys will automatically be created if they do not exist.
@ -1349,7 +1349,7 @@ Returns:
``json_query``
--------------
.. versionadded:: Neon
.. versionadded:: 3000
A port of Ansible ``json_query`` Jinja filter to make queries against JSON data using `JMESPath language`_.
Could be used to filter ``pillar`` data, ``yaml`` maps, and together with :jinja_ref:`http_query`.
@ -1395,7 +1395,7 @@ Returns:
``to_snake_case``
-----------------
.. versionadded:: Neon
.. versionadded:: 3000
Converts a string from camelCase (or CamelCase) to snake_case.
@ -1415,7 +1415,7 @@ Returns:
``to_camelcase``
----------------
.. versionadded:: Neon
.. versionadded:: 3000
Converts a string from snake_case to camelCase (or UpperCamelCase if so indicated).

View file

@ -4,10 +4,10 @@
Matchers
========
.. versionadded:: Neon
.. versionadded:: 3000
Matchers are modules that provide Salt's targeting abilities. As of the
Neon release, matchers can be dynamically loaded. Currently new matchers
3000 release, matchers can be dynamically loaded. Currently new matchers
cannot be created because the required plumbing for the CLI does not exist yet.
Existing matchers may have their functionality altered or extended.
@ -22,7 +22,7 @@ take a ``delimiter`` argument and should default to ``DEFAULT_TARGET_DELIM``.
Like other Salt loadable modules, modules that override built-in functionality
can be placed in ``file_roots`` in a special directory and then copied to the
minion through the normal sync process. :py:func:`saltutil.sync_all <salt.modules.saltutil.sync_all>`
will transfer all loadable modules, and the Neon release introduces
will transfer all loadable modules, and the 3000 release introduces
:py:func:`saltutil.sync_matchers <salt.modules.saltutil.sync_matchers>`. For matchers, the directory is
``/srv/salt/_matchers`` (assuming your ``file_roots`` is set to the default
``/srv/salt``).

View file

@ -42,13 +42,56 @@ the example below:
test.ping: []
network.ip_addrs:
interface: eth0
cidr: '10.0.0.0/8'
cidr: 10.0.0.0/8
In the example above :py:mod:`salt.modules.network.ip_addrs` has additional
filters to help narrow down the results. In the above example IP addresses
are only returned if they are on a eth0 interface and in the 10.0.0.0/8 IP
range.
.. versionchanged:: 3000
The format to define mine_functions has been changed to allow the same format
as used for module.run. The old format (above) will still be supported.
.. code-block:: yaml
mine_functions:
test.ping: []
network.ip_addrs:
- interface: eth0
- cidr: 10.0.0.0/8
test.arg:
- isn't
- this
- fun
- this: that
- salt: stack
.. _mine_minion-side-acl:
Minion-side Access Control
--------------------------
.. versionadded:: 3000
Mine functions can be targeted to only be available to specific minions. This
uses the same targeting parameters as :ref:`targeting` but with keywords ``allow_tgt``
and ``allow_tgt_type``. When a minion requests a function from the salt mine that
is not allowed to be requested by that minion (i.e. when looking up the combination
of ``allow_tgt`` and ``allow_tgt_type`` and the requesting minion is not in the list)
it will get no data, just as if the requested function is not present in the salt mine.
.. code-block:: yaml
mine_functions:
network.ip_addrs:
- interface: eth0
- cidr: 10.0.0.0/8
- allow_tgt: 'G@role:master'
- allow_tgt_type: 'compound'
Mine Functions Aliases
----------------------
@ -71,6 +114,25 @@ positional and key-value arguments is not supported.
- mine_function: grains.get
- ip_interfaces
.. versionchanged:: 3000
With the addition of the module.run-like format for defining mine_functions, the
method of adding aliases remains similar. Just add a ``mine_function`` kwarg with
the name of the real function to call, making the key below ``mine_functions``
the alias:
.. code-block:: yaml
mine_functions:
alias_name:
- mine_function: network.ip_addrs
- eth0
internal_ip_addrs:
- mine_function: network.ip_addrs
- cidr: 192.168.0.0/16
ip_list:
- mine_function: grains.get
- ip_interfaces
.. _mine_interval:
@ -123,6 +185,7 @@ stored in a different location. Here is an example of a flat roster containing
of the Minion in question. This results in a non-trivial delay in
retrieving the requested data.
Minions Targeting with Mine
===========================

View file

@ -197,7 +197,7 @@ Several Jinja Filters Renamed
The following Jinja filters (originally added in 2017.7.0) have been renamed
due to the fact that they were inaccurately named when initially added. The
original names will be supported until the Neon release of Salt.
original names will be supported until the 3000 release of Salt.
- :jinja_ref:`rand_str` renamed to :jinja_ref:`random_hash`
- :jinja_ref:`jinja_decode_dict` renamed to :jinja_ref:`jinja_encode_dict`
@ -1624,7 +1624,7 @@ NaCL Module and Runner changes
==============================
In addition to argument changes in both the NaCL module and runner for future
removal in the Neon release, the default "box_type" has changed from
removal in the 3000 release, the default "box_type" has changed from
``secretbox`` to ``sealedbox``. SecretBox is data encrypted using private key
``sk`` and Sealedbox is encrypted using public key ``pk``.
@ -1634,7 +1634,7 @@ removal in the Neon release, the default "box_type" has changed from
The Salt utility functions from ``salt.utils`` (typically used by those
developing extension modules for Salt) have been moved into different modules,
grouped logically based on their functionality. The old function names will
continue to work until the ``Neon`` release of Salt (due around Q1 2019).
continue to work until the ``3000`` release of Salt (due around Q1 2019).
The renamed functions are:
@ -1919,7 +1919,7 @@ Grain Deprecations
------------------
- For ``smartos``, some grains have been deprecated. These grains will be
removed in Neon:
removed in 3000:
- The ``hypervisor_uuid`` grain has been replaced with
``mdata:sdc:server_uuid``
@ -1974,5 +1974,5 @@ RAET transport
We haven't been doing development on RAET for quite some time and decided that
2018.3.0 is the time to announce the deprecation. RAET support will be removed
in Neon. Please consider to move to ``zeromq`` or ``tcp`` transport instead of
in 3000. Please consider to move to ``zeromq`` or ``tcp`` transport instead of
``raet``.

View file

@ -77,7 +77,7 @@ This test case has also been tested with the ``yaml`` and ``json`` filters succe
The :jinja_ref:`json_encode_dict` and :jinja_ref:`json_encode_list` filters
do not actually dump the results to JSON. Since ``tojson`` accomplishes
what those filters were designed to do, they are now deprecated and will be
removed in the Neon release. The ``tojson`` filter should be used in all
removed in the 3000 release. The ``tojson`` filter should be used in all
cases where :jinja_ref:`json_encode_dict` and :jinja_ref:`json_encode_list`
would have been used.

View file

@ -1,8 +1,9 @@
:orphan:
.. _release-3000:
==================================
Salt Release Notes - Codename Neon
==================================
=======================================
Salt 3000 Release Notes - Codename Neon
=======================================
Saltcheck Updates
=================
@ -369,12 +370,122 @@ Also, slot parsing is now supported inside of nested state data structures (dict
- "DO NOT OVERRIDE"
ignore_if_missing: True
- The :py:func:`file.symlink <salt.states.file.symlink>` state was
fixed to remove existing file system entries other than files,
directories and symbolic links properly.
- The ``onchanges`` and ``prereq`` :ref:`requisites <requisites>` now behave
properly in test mode.
State Changes
=============
- Added new :py:func:`ssh_auth.manage <salt.states.ssh_auth.manage>` state to
ensure only the specified ssh keys are present for the specified user.
- Added new :py:func:`saltutil <salt.states.saltutil>` state to use instead of
``module.run`` to more easily handle change.
- Added new `onfail_all` requisite form to allow for AND logic when adding
onfail states.
Module Changes
==============
- The :py:func:`debian_ip <salt.modules.debian_ip>` module used by the
:py:func:`network.managed <salt.states.network.managed>` state has been
heavily refactored. The order that options appear in inet/inet6 blocks may
produce cosmetic changes. Many options without an 'ipvX' prefix will now be
shared between inet and inet6 blocks. The options ``enable_ipv4`` and
``enabled_ipv6`` will now fully remove relevant inet/inet6 blocks. Overriding
options by prefixing them with 'ipvX' will now work with most options (i.e.
``dns`` can be overriden by ``ipv4dns`` or ``ipv6dns``). The ``proto`` option
is now required.
- Added new :py:func:`boto_ssm <salt.modules.boto_ssm>` module to set and query
secrets in AWS SSM parameters.
- Added new :py:func:`flatpak <salt.modules.flatpak>` module to work with flatpak packages.
- The :py:func:`file.set_selinux_context <salt.modules.file.set_selinux_context>`
module now supports perstant changes with ``persist=True`` by calling the
:py:func:`selinux.fcontext_add_policy <salt.modules.selinux.fcontext_add_policy>` module.
- The :py:func:`file.remove <salt.modules.file.remove>` module was
fixed to remove file system entries other than files, directories
and symbolic links properly.
- The :py:func:`yumpkg <salt.modules.yumpkg>` module has been updated to support
VMWare's Photon OS, which uses tdnf (a C implementation of dnf).
- The :py:func:`chocolatey.bootstrap <salt.modules.chocolatey.bootstrap>` function
has been updated to support offline installation.
- The :py:func:`chocolatey.unbootstrap <salt.modules.chocolatey.unbootstrap>` function
has been added to uninstall Chocolatey.
Enhancements to Engines
=======================
Multiple copies of a particular Salt engine can be configured by including
the ``engine_module`` parameter in the engine configuration.
.. code-block:: yaml
engines:
- production_logstash:
host: production_log.my_network.com
port: 5959
proto: tcp
engine_module: logstash
- develop_logstash:
host: develop_log.my_network.com
port: 5959
proto: tcp
engine_module: logstash
Runner Changes
==============
- The :py:func:`saltutil.sync_auth <salt.runners.saltutil.sync_auth>` function
has been added to sync loadable auth modules. :py:func:`saltutil.sync_all <salt.runners.saltutil.sync_all>`
will also include these modules.
Util Changes
============
- The :py:func:`win_dotnet <salt.utils.win_dotnet>` Salt util has been added to
make it easier to detect the versions of .NET installed on the system. It includes
the following functions:
- :py:func:`versions <salt.utils.win_dotnet.versions>`
- :py:func:`versions_list <salt.utils.win_dotnet.versions_list>`
- :py:func:`versions_details <salt.utils.win_dotnet.versions_details>`
- :py:func:`version_at_least <salt.utils.win_dotnet.version_at_least>`
Serializer Changes
==================
- The configparser serializer and deserializer functions can now be made to preserve
case of item names by passing 'preserve_case=True' in the options parameter of the function.
.. note::
This is a parameter consumed only by the salt.serializer.configparser serialize and
deserialize functions and not the low-level configparser python object.
For example, in a file.serialze state:
.. code-block:: yaml
some.ini:
- file.serialize:
- formatter: configparser
- merge_if_exists: True
- deserializer_opts:
- preserve_case: True
- serializer_opts:
- preserve_case: True
Enhancements to Engines
=======================
@ -408,6 +519,11 @@ Module Changes
Deprecations
============
Raet Deprecated
---------------
- The Raet transport has been deprecated. Please use the supported
transport protocols tcp or zeromq.
Module Deprecations
-------------------

View file

@ -20,6 +20,7 @@ Previous Releases
:maxdepth: 1
:glob:
3000*
2019.2.*
2018.3.*
2017.7.*

View file

@ -6,15 +6,16 @@
Installing/Testing a Salt Release Candidate
===========================================
It's time for a new feature release of Salt! Follow the instructions below to
install the latest release candidate of Salt, and try :ref:`all the shiny new
features <release-2019-2-0>`! Be sure to report any bugs you find on `Github
When it's time for a new feature release of Salt, follow the instructions below to
install the latest release candidate of Salt, and try all the shiny new
features! Be sure to report any bugs you find on `Github
<https://github.com/saltstack/salt/issues/new/>`_.
Installing Using Packages
=========================
Builds for a few platforms are available as part of the RC at https://repo.saltstack.com/salt_rc/.
The builds should include the latest version of the OS that is currently available.
.. note::
@ -34,37 +35,32 @@ Builds for a few platforms are available as part of the RC at https://repo.salts
baseurl=https://repo.saltstack.com/salt_rc/py3/redhat/$releasever/$basearch/
For Ubuntu Python 2
For Ubuntu Python 2 (replace os_version, with ubuntu version. For example 18.04)
.. code-block:: none
deb http://repo.saltstack.com/salt_rc/apt/ubuntu/18.04/amd64 bionic main
deb http://repo.saltstack.com/salt_rc/apt/ubuntu/<os_version>/amd64 bionic main
For Ubuntu Python 3
For Ubuntu Python 3 (replace os_version, with ubuntu version. For example 18.04)
.. code-block:: none
deb http://repo.saltstack.com/salt_rc/py3/ubuntu/18.04/amd64 bionic main
deb http://repo.saltstack.com/salt_rc/py3/ubuntu/<os_version>/amd64 bionic main
For Debian Python 2
For Debian Python 2 (replace os_version, with debian version. For example 9)
.. code-block:: none
deb http://repo.saltstack.com/salt_rc/apt/debian/9/amd64 stretch main
deb http://repo.saltstack.com/salt_rc/apt/debian/<os_version>/amd64 stretch main
For Debian Python 3
For Debian Python 3 (replace os_version, with debian version. For example 9)
.. code-block:: none
deb http://repo.saltstack.com/salt_rc/py3/debian/9/amd64 stretch main
deb http://repo.saltstack.com/salt_rc/py3/debian/<os_version>/amd64 stretch main
The OSs that will be built for each RC release are the latest version of each OS on https://repo.saltstack.com
Available builds:
- Ubuntu 18
- Debian 9
- Redhat 7
- Windows
.. FreeBSD
@ -97,9 +93,8 @@ the ``-M`` and ``-N`` flags:
Installing Using PyPI
=====================
Installing from the `source archive
<https://pypi.python.org/pypi?:action=display&name=salt&version=2019.2.0rc1>`_ on
`PyPI <https://pypi.python.org/pypi>`_ is fairly straightforward.
Installing from the source archive on `PyPI <https://pypi.python.org/pypi>`_
is fairly straightforward.
.. note::
@ -134,6 +129,12 @@ First install the build dependencies.
Then install salt using the following command:
.. code-block:: bash
sudo pip install salt==<rc tag version>
For example for the 2019.2.0rc1 release:
.. code-block:: bash
sudo pip install salt==2019.2.0rc1

View file

@ -0,0 +1,29 @@
:orphan:
====================================
Salt Release Notes - Codename Sodium
====================================
Salt mine updates
=================
Syntax update
-------------
The syntax for defining salt functions in config or pillar files has changed to
also support the syntax used in :py:mod:`module.run <salt.states.module.run>`.
The old syntax for the mine_function - as a dict, or as a list with dicts that
contain more than exactly one key - is still supported but discouraged in favor
of the more uniform syntax of module.run.
Minion-side ACL
---------------
Salt has had master-side ACL for the salt mine for some time, where the master
configuration contained `mine_get` that specified which minions could request
which functions. However, now you can specify which minions can access a function
in the salt mine function definition itself (or when calling :py:func:`mine.send <salt.modules.mine.send>`).
This targeting works the same as the generic minion targeting as specified
:ref:`here <targeting>`. The parameters used are ``allow_tgt`` and ``allow_tgt_type``.
See also :ref:`the documentation of the Salt Mine <mine_minion-side-acl>`.

View file

@ -36,7 +36,7 @@ Assigned codenames:
- Nitrogen: ``2017.7.0``
- Oxygen: ``2018.3.0``
- Fluorine: ``2019.2.0``
- Neon: ``TBD``
- Neon: ``3000``
- Sodium: ``TBD``
Example

View file

@ -5,7 +5,7 @@ Slots
=====
.. versionadded:: 2018.3.0
.. versionchanged:: Neon
.. versionchanged:: 3000
.. note:: This functionality is under development and could be changed in the
future releases
@ -34,7 +34,7 @@ Slot syntax looks close to the simple python function call.
__slot__:salt:<module>.<function>(<args>, ..., <kwargs...>, ...)
For the Neon release, this syntax has been updated to support parsing functions
For the 3000 release, this syntax has been updated to support parsing functions
which return dictionaries and for appending text to the slot result.
.. code-block:: text

View file

@ -27,7 +27,7 @@ High level differences to yum and apt are:
- The repository metadata (SLS files) is hosted through either salt or
git.
- Packages can be downloaded from within the salt repository, a git
repository or from http(s) or ftp urls.
repository or from HTTP(S) or FTP URLs.
- No dependencies are managed. Dependencies between packages needs to
be managed manually.
@ -264,7 +264,7 @@ in the master config file:
Creating a Package Definition SLS File
======================================
The package definition file is a yaml file that contains all the information
The package definition file is a YAML file that contains all the information
needed to install a piece of software using salt. It defines information about
the package to include version, full name, flags required for the installer and
uninstaller, whether or not to use the Windows task scheduler to install the
@ -315,17 +315,17 @@ The version line is the version for the package to be installed. It is used when
you need to install a specific version of a piece of software.
.. warning::
The version must be enclosed in quotes, otherwise the yaml parser will
The version must be enclosed in quotes, otherwise the YAML parser will
remove trailing zeros.
.. note::
There are unique situations where previous versions are unavailable. Take
Google Chrome for example. There is only one url provided for a standalone
Google Chrome for example. There is only one URL provided for a standalone
installation of Google Chrome.
(https://dl.google.com/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi)
When a new version is released, the url just points to the new version. To
When a new version is released, the URL just points to the new version. To
handle situations such as these, set the version to `latest`. Salt will
install the version of Chrome at the URL and report that version. Here's an
example:
@ -579,7 +579,7 @@ Available parameters are as follows:
:param bool reboot: Not implemented
:param str local: Not implemented
:param str locale: Not implemented
Examples can be found at https://github.com/saltstack/salt-winrepo-ng

View file

@ -475,7 +475,7 @@ def _runtests(session, coverage, cmd_args):
@nox.parametrize('crypto', [None, 'm2crypto', 'pycryptodomex'])
def runtests_parametrized(session, coverage, transport, crypto):
# Install requirements
_install_requirements(session, transport, 'unittest-xml-reporting==2.2.1')
_install_requirements(session, transport, 'unittest-xml-reporting==2.5.2')
if crypto:
if crypto == 'm2crypto':

View file

@ -1,3 +1,4 @@
mock >= 3.0.0
# PyTest
pytest >=4.6.6,<4.7 # PyTest 4.6.x are the last Py2 and Py3 releases
pytest-salt >= 2019.12.27

View file

@ -17,6 +17,7 @@ jxmlease
kazoo
keyring==5.7.1
kubernetes<4.0
libnacl==1.6.0
mock>=3.0.5; python_version < '3.6'
more-itertools==5.0.0
moto

View file

@ -60,6 +60,7 @@ jxmlease==1.0.1
kazoo==2.6.1
keyring==5.7.1
kubernetes==3.0.0
libnacl==1.6.0
lxml==4.3.3 # via junos-eznc, ncclient
mako==1.1.0
markupsafe==1.1.1

View file

@ -52,6 +52,7 @@ jxmlease==1.0.1
kazoo==2.6.1
keyring==5.7.1
kubernetes==3.0.0
libnacl==1.6.0
lxml==4.3.3 # via junos-eznc, ncclient
mako==1.1.0
markupsafe==1.1.1

View file

@ -52,6 +52,7 @@ jxmlease==1.0.1
kazoo==2.6.1
keyring==5.7.1
kubernetes==3.0.0
libnacl==1.6.0
lxml==4.3.3 # via junos-eznc, ncclient
mako==1.1.0
markupsafe==1.1.1

View file

@ -52,6 +52,7 @@ jxmlease==1.0.1
kazoo==2.6.1
keyring==5.7.1
kubernetes==3.0.0
libnacl==1.6.0
lxml==4.3.3 # via junos-eznc, ncclient
mako==1.1.0
markupsafe==1.1.1

View file

@ -52,6 +52,7 @@ jxmlease==1.0.1
kazoo==2.6.1
keyring==5.7.1
kubernetes==3.0.0
libnacl==1.6.0
lxml==4.3.3 # via junos-eznc, ncclient
mako==1.1.0
markupsafe==1.1.1

View file

@ -11,6 +11,7 @@ jmespath
jsonschema
keyring==5.7.1
kubernetes<4.0
libnacl
mock>=3.0.5; python_version < '3.6'
more-itertools==5.0.0
moto<=1.3.7

View file

@ -2,7 +2,7 @@
'''
Beacon to monitor certificate expiration dates from files on the filesystem.
.. versionadded:: Sodium
.. versionadded:: 3000
:maintainer: <devops@eitr.tech>
:maturity: new

View file

@ -492,6 +492,71 @@ def list_nodes_select(call=None):
)
def _stringlist_to_dictionary(input_string):
'''
Convert a stringlist (comma separated settings) to a dictionary
The result of the string setting1=value1,setting2=value2 will be a python dictionary:
{'setting1':'value1','setting2':'value2'}
'''
return dict(item.strip().split("=") for item in input_string.split(",") if item)
def _dictionary_to_stringlist(input_dict):
'''
Convert a dictionary to a stringlist (comma separated settings)
The result of the dictionary {'setting1':'value1','setting2':'value2'} will be:
setting1=value1,setting2=value2
'''
return ','.join('{}={}'.format(k, input_dict[k]) for k in sorted(input_dict.keys()))
def _reconfigure_clone(vm_, vmid):
'''
If we cloned a machine, see if we need to reconfigure any of the options such as net0,
ide2, etc. This enables us to have a different cloud-init ISO mounted for each VM that's brought up
:param vm_:
:return:
'''
if not vm_.get('technology') == 'qemu':
log.warning('Reconfiguring clones is only available under `qemu`')
return
# TODO: Support other settings here too as these are not the only ones that can be modified after a clone operation
log.info('Configuring cloned VM')
# Modify the settings for the VM one at a time so we can see any problems with the values
# as quickly as possible
for setting in vm_:
if re.match(r'^(ide|sata|scsi)(\d+)$', setting):
postParams = {setting: vm_[setting]}
query('post', 'nodes/{0}/qemu/{1}/config'.format(vm_['host'], vmid), postParams)
elif re.match(r'^net(\d+)$', setting):
# net strings are a list of comma seperated settings. We need to merge the settings so that
# the setting in the profile only changes the settings it touches and the other settings
# are left alone. An example of why this is necessary is because the MAC address is set
# in here and generally you don't want to alter or have to know the MAC address of the new
# instance, but you may want to set the VLAN bridge
data = query('get', 'nodes/{0}/qemu/{1}/config'.format(vm_['host'], vmid))
# Generate a dictionary of settings from the existing string
new_setting = {}
if setting in data:
new_setting.update(_stringlist_to_dictionary(data[setting]))
# Merge the new settings (as a dictionary) into the existing dictionary to get the
# new merged settings
new_setting.update(_stringlist_to_dictionary(vm_[setting]))
# Convert the dictionary back into a string list
postParams = {setting: _dictionary_to_stringlist(new_setting)}
query('post', 'nodes/{0}/qemu/{1}/config'.format(vm_['host'], vmid), postParams)
def create(vm_):
'''
Create a single VM from a data dict
@ -575,6 +640,9 @@ def create(vm_):
if not wait_for_created(data['upid'], timeout=300):
return {'Error': 'Unable to create {0}, command timed out'.format(name)}
if vm_.get('clone') is True:
_reconfigure_clone(vm_, vmid)
# VM has been created. Starting..
if not start(name, vmid, call='action'):
log.error('Node %s (%s) failed to start!', name, vmid)

File diff suppressed because it is too large Load diff

View file

@ -1186,6 +1186,10 @@ VALID_OPTS = immutabletypes.freeze({
# Thorium top file location
'thorium_top': six.string_types,
# Allow raw_shell option when using the ssh
# client via the Salt API
'netapi_allow_raw_shell': bool,
})
# default configurations
@ -1249,6 +1253,7 @@ DEFAULT_MINION_OPTS = immutabletypes.freeze({
'state_top_saltenv': None,
'startup_states': '',
'sls_list': [],
'start_event_grains': [],
'top_file': '',
'thoriumenv': None,
'thorium_top': 'top.sls',
@ -1798,6 +1803,7 @@ DEFAULT_MASTER_OPTS = immutabletypes.freeze({
'auth_events': True,
'minion_data_cache_events': True,
'enable_ssh_minions': False,
'netapi_allow_raw_shell': False,
})

View file

@ -35,6 +35,7 @@ import salt.utils.event
import salt.utils.files
import salt.utils.gitfs
import salt.utils.verify
import salt.utils.mine
import salt.utils.minions
import salt.utils.gzip_util
import salt.utils.jid
@ -548,6 +549,18 @@ class RemoteFuncs(object):
if not skip_verify:
if any(key not in load for key in ('id', 'tgt', 'fun')):
return {}
if isinstance(load['fun'], six.string_types):
functions = list(set(load['fun'].split(',')))
_ret_dict = len(functions) > 1
elif isinstance(load['fun'], list):
functions = load['fun']
_ret_dict = True
else:
return {}
functions_allowed = []
if 'mine_get' in self.opts:
# If master side acl defined.
if not isinstance(self.opts['mine_get'], dict):
@ -557,11 +570,18 @@ class RemoteFuncs(object):
if re.match(match, load['id']):
if isinstance(self.opts['mine_get'][match], list):
perms.update(self.opts['mine_get'][match])
if not any(re.match(perm, load['fun']) for perm in perms):
for fun in functions:
if any(re.match(perm, fun) for perm in perms):
functions_allowed.append(fun)
if not functions_allowed:
return {}
else:
functions_allowed = functions
ret = {}
if not salt.utils.verify.valid_id(self.opts, load['id']):
return ret
expr_form = load.get('expr_form')
# keep both expr_form and tgt_type to ensure
# comptability between old versions of salt
@ -580,17 +600,43 @@ class RemoteFuncs(object):
greedy=False
)
minions = _res['minions']
minion_side_acl = {} # Cache minion-side ACL
for minion in minions:
fdata = self.cache.fetch('minions/{0}'.format(minion), 'mine')
if isinstance(fdata, dict):
fdata = fdata.get(load['fun'])
if fdata:
ret[minion] = fdata
mine_data = self.cache.fetch('minions/{0}'.format(minion), 'mine')
if not isinstance(mine_data, dict):
continue
for function in functions_allowed:
if function not in mine_data:
continue
mine_entry = mine_data[function]
mine_result = mine_data[function]
if isinstance(mine_entry, dict) and salt.utils.mine.MINE_ITEM_ACL_ID in mine_entry:
mine_result = mine_entry[salt.utils.mine.MINE_ITEM_ACL_DATA]
# Check and fill minion-side ACL cache
if function not in minion_side_acl.get(minion, {}):
if 'allow_tgt' in mine_entry:
# Only determine allowed targets if any have been specified.
# This prevents having to add a list of all minions as allowed targets.
salt.utils.dictupdate.set_dict_key_value(
minion_side_acl,
'{}:{}'.format(minion, function),
checker.check_minions(
mine_entry['allow_tgt'],
mine_entry.get('allow_tgt_type', 'glob')
)['minions']
)
if salt.utils.mine.minion_side_acl_denied(minion_side_acl, minion, function, load['id']):
continue
if _ret_dict:
ret.setdefault(function, {})[minion] = mine_result
else:
# There is only one function in functions_allowed.
ret[minion] = mine_result
return ret
def _mine(self, load, skip_verify=False):
'''
Return the mine data
Store/update the mine data in cache.
'''
if not skip_verify:
if 'id' not in load or 'data' not in load:
@ -598,12 +644,12 @@ class RemoteFuncs(object):
if self.opts.get('minion_data_cache', False) or self.opts.get('enforce_mine_cache', False):
cbank = 'minions/{0}'.format(load['id'])
ckey = 'mine'
new_data = load['data']
if not load.get('clear', False):
data = self.cache.fetch(cbank, ckey)
if isinstance(data, dict):
data.update(load['data'])
load['data'] = data
self.cache.store(cbank, ckey, load['data'])
data.update(new_data)
self.cache.store(cbank, ckey, data)
return True
def _mine_delete(self, load):
@ -703,7 +749,6 @@ class RemoteFuncs(object):
'''
if any(key not in load for key in ('id', 'grains')):
return False
# pillar = salt.pillar.Pillar(
log.debug('Master _pillar using ext: %s', load.get('ext'))
pillar = salt.pillar.get_pillar(
self.opts,

View file

@ -46,10 +46,22 @@ def start_engines(opts, proc_mgr, proxy=None):
engine, engine_opts = next(iter(engine.items()))
else:
engine_opts = None
fun = '{0}.start'.format(engine)
engine_name = None
if engine_opts is not None and 'engine_module' in engine_opts:
fun = '{0}.start'.format(engine_opts['engine_module'])
engine_name = engine
del engine_opts['engine_module']
else:
fun = '{0}.start'.format(engine)
if fun in engines:
start_func = engines[fun]
name = '{0}.Engine({1})'.format(__name__, start_func.__module__)
if engine_name:
name = '{0}.Engine({1}-{2})'.format(__name__,
start_func.__module__,
engine_name)
else:
name = '{0}.Engine({1})'.format(__name__,
start_func.__module__)
log.info('Starting Engine %s', name)
proc_mgr.add_process(
Engine,

View file

@ -3,7 +3,7 @@
An engine that reads messages from the salt event bus and pushes
them onto a fluent endpoint.
.. versionadded:: neon
.. versionadded:: 3000
:Configuration:

View file

@ -2058,6 +2058,7 @@ def os_data():
else:
grains['os'] = grains['kernel']
if grains['kernel'] == 'FreeBSD':
grains['osfullname'] = grains['os']
try:
grains['osrelease'] = __salt__['cmd.run']('freebsd-version -u').split('-')[0]
except salt.exceptions.CommandExecutionError:

View file

@ -2,7 +2,7 @@
'''
Grains for NVMe Qualified Names (NQN).
.. versionadded:: Flourine
.. versionadded:: 3000
To enable these grains set `nvme_grains: True`.

View file

@ -688,6 +688,17 @@ def grain_funcs(opts, proxy=None):
return ret
def _format_cached_grains(cached_grains):
"""
Returns cached grains with fixed types, like tuples.
"""
if cached_grains.get('osrelease_info'):
osrelease_info = cached_grains['osrelease_info']
if isinstance(osrelease_info, list):
cached_grains['osrelease_info'] = tuple(osrelease_info)
return cached_grains
def _load_cached_grains(opts, cfn):
'''
Returns the grains cached in cfn, or None if the cache is too old or is
@ -720,7 +731,7 @@ def _load_cached_grains(opts, cfn):
log.debug('Cached grains are empty, cache might be corrupted. Refreshing.')
return None
return cached_grains
return _format_cached_grains(cached_grains)
except (IOError, OSError):
return None

View file

@ -167,6 +167,7 @@ from salt.log.setup import LOG_LEVELS
from salt.log.mixins import NewStyleClassMixIn
import salt.utils.json
import salt.utils.network
import salt.utils.stringutils
# Import Third party libs
from salt.ext import six
@ -378,7 +379,7 @@ class DatagramLogstashHandler(logging.handlers.DatagramHandler):
'''
def makePickle(self, record):
return self.format(record)
return salt.utils.stringutils.to_bytes(self.format(record))
class ZMQLogstashHander(logging.Handler, NewStyleClassMixIn):
@ -416,7 +417,7 @@ class ZMQLogstashHander(logging.Handler, NewStyleClassMixIn):
return self._publisher
def emit(self, record):
formatted_object = self.format(record)
formatted_object = salt.utils.stringutils.to_bytes(self.format(record))
self.publisher.send(formatted_object)
def close(self):

View file

@ -484,6 +484,9 @@ def get_multiprocessing_logging_queue():
global __MP_LOGGING_QUEUE
from salt.utils.platform import is_darwin
if __MP_LOGGING_QUEUE is not None:
return __MP_LOGGING_QUEUE
if __MP_IN_MAINPROCESS is False:
# We're not in the MainProcess, return! No Queue shall be instantiated
return __MP_LOGGING_QUEUE

View file

@ -30,6 +30,7 @@ from salt.ext.six.moves import range
from salt.utils.zeromq import zmq, ZMQDefaultLoop, install_zmq, ZMQ_VERSION_INFO
import salt.transport.client
import salt.defaults.exitcodes
import salt.utils.crypt
from salt.utils.ctx import RequestContext
@ -1449,6 +1450,11 @@ class Minion(MinionBase):
else:
return
if self.opts['start_event_grains']:
grains_to_add = dict(
[(k, v) for k, v in six.iteritems(self.opts.get('grains', {})) if k in self.opts['start_event_grains']])
load['grains'] = grains_to_add
if sync:
try:
self._send_req_sync(load, timeout)
@ -1531,6 +1537,7 @@ class Minion(MinionBase):
name='ProcessPayload',
args=(instance, self.opts, data, self.connected)
)
process._after_fork_methods.append((salt.utils.crypt.reinit_crypto, [], {}))
else:
process = threading.Thread(
target=self._target,

View file

@ -76,6 +76,7 @@ except ImportError:
# pylint: enable=import-error
APT_LISTS_PATH = "/var/lib/apt/lists"
PKG_ARCH_SEPARATOR = ':'
# Source format for urllib fallback on PPA handling
LP_SRC_FORMAT = 'deb http://ppa.launchpad.net/{0}/{1}/ubuntu {2} main'
@ -188,6 +189,43 @@ def _warn_software_properties(repo):
log.warning('Best guess at ppa format: %s', repo)
def normalize_name(name):
'''
Strips the architecture from the specified package name, if necessary.
CLI Example:
.. code-block:: bash
salt '*' pkg.normalize_name zsh:amd64
'''
try:
name, arch = name.rsplit(PKG_ARCH_SEPARATOR, 1)
except ValueError:
return name
return name
def parse_arch(name):
'''
Parse name and architecture from the specified package name.
CLI Example:
.. code-block:: bash
salt '*' pkg.parse_arch zsh:amd64
'''
try:
_name, _arch = name.rsplit(PKG_ARCH_SEPARATOR, 1)
except ValueError:
_name, _arch = name, None
return {
'name': _name,
'arch': _arch
}
def latest_version(*names, **kwargs):
'''
Return the latest version of the named package available for upgrade or
@ -2294,6 +2332,8 @@ def mod_repo(repo, saltenv='base', **kwargs):
if 'disabled' in kwargs:
kwargs['disabled'] = salt.utils.data.is_true(kwargs['disabled'])
elif 'enabled' in kwargs:
kwargs['disabled'] = not salt.utils.data.is_true(kwargs['enabled'])
kw_type = kwargs.get('type')
kw_dist = kwargs.get('dist')

View file

@ -2,7 +2,7 @@
'''
Azure (ARM) DNS Execution Module
.. versionadded:: Sodium
.. versionadded:: 3000
:maintainer: <devops@eitr.tech>
:maturity: new
@ -80,7 +80,7 @@ def __virtual__():
def record_set_create_or_update(name, zone_name, resource_group, record_type, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Creates or updates a record set within a DNS zone.
@ -132,7 +132,7 @@ def record_set_create_or_update(name, zone_name, resource_group, record_type, **
def record_set_delete(name, zone_name, resource_group, record_type, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Deletes a record set from a DNS zone. This operation cannot be undone.
@ -172,7 +172,7 @@ def record_set_delete(name, zone_name, resource_group, record_type, **kwargs):
def record_set_get(name, zone_name, resource_group, record_type, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Get a dictionary representing a record set's properties.
@ -211,7 +211,7 @@ def record_set_get(name, zone_name, resource_group, record_type, **kwargs):
def record_sets_list_by_type(zone_name, resource_group, record_type, top=None, recordsetnamesuffix=None, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Lists the record sets of a specified type in a DNS zone.
@ -259,7 +259,7 @@ def record_sets_list_by_type(zone_name, resource_group, record_type, top=None, r
def record_sets_list_by_dns_zone(zone_name, resource_group, top=None, recordsetnamesuffix=None, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Lists all record sets in a DNS zone.
@ -303,7 +303,7 @@ def record_sets_list_by_dns_zone(zone_name, resource_group, top=None, recordsetn
def zone_create_or_update(name, resource_group, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Creates or updates a DNS zone. Does not modify DNS records within the zone.
@ -356,7 +356,7 @@ def zone_create_or_update(name, resource_group, **kwargs):
def zone_delete(name, resource_group, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Delete a DNS zone within a resource group.
@ -389,7 +389,7 @@ def zone_delete(name, resource_group, **kwargs):
def zone_get(name, resource_group, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Get a dictionary representing a DNS zone's properties, but not the
record sets within the zone.
@ -422,7 +422,7 @@ def zone_get(name, resource_group, **kwargs):
def zones_list_by_resource_group(resource_group, top=None, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Lists the DNS zones in a resource group.
@ -459,7 +459,7 @@ def zones_list_by_resource_group(resource_group, top=None, **kwargs):
def zones_list(top=None, **kwargs):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Lists the DNS zones in all resource groups in a subscription.

View file

@ -38,7 +38,7 @@ def get_parameter(name, withdecryption=False, resp_json=False, region=None, key=
'''
Retrives a parameter from SSM Parameter Store
.. versionadded:: Neon
.. versionadded:: 3000
.. code-block:: text
@ -71,7 +71,7 @@ def put_parameter(Name,
'''
Sets a parameter in the SSM parameter store
.. versionadded:: Neon
.. versionadded:: 3000
.. code-block:: text
@ -104,7 +104,7 @@ def delete_parameter(Name, region=None, key=None, keyid=None, profile=None):
'''
Removes a parameter from the SSM parameter store
.. versionadded:: Neon
.. versionadded:: 3000
.. code-block:: text
salt-call boto_ssm.delete_parameter test-param

View file

@ -2980,7 +2980,7 @@ def run_chroot(root,
:param list binds: List of directories that will be exported inside
the chroot with the bind option.
.. versionadded:: Sodium
.. versionadded:: 3000
:param dict env: Environment variables to be set prior to execution.

View file

@ -176,7 +176,7 @@ def option(
Shorthand to omit all of the above and return matches only from the
"sane defaults".
.. versionadded:: Neon
.. versionadded:: 3000
wildcard : False
If used, this will perform pattern matching on keys. Note that this
@ -189,7 +189,7 @@ def option(
{'foo.bar': True, 'foo.baz': False}
.. versionadded:: Neon
.. versionadded:: 3000
CLI Example:

View file

@ -253,7 +253,7 @@ def _create_pbuilders(env, runas='root'):
idiosyncrasies can be found :ref:`here <yaml-idiosyncrasies>`.
runas : root
.. versionadded:: fluorine
.. versionadded:: 2019.2.1
User to create the files and directories
@ -364,7 +364,7 @@ def make_src_pkg(dest_dir, spec, sources, env=None, saltenv='base', runas='root'
runas : root
.. versionadded:: fluorine
.. versionadded:: 2019.2.1
User to create the files and directories

View file

@ -129,7 +129,7 @@ def migrate(settings_module,
Execute the Django-Admin migrate command (requires Django 1.7 or higher).
.. versionadded:: Neon
.. versionadded:: 3000
settings_module
Specifies the settings module to use.

View file

@ -59,7 +59,7 @@ any of the following locations:
in Minion config file in order to work)
.. important::
Versions prior to Neon require that Docker credentials are configured in
Versions prior to 3000 require that Docker credentials are configured in
Pillar data. Be advised that Pillar data is still recommended though,
because this keeps the configuration from being stored on the Minion.
@ -1054,7 +1054,7 @@ def compare_container_networks(first, second):
than waiting for a new Salt release one can just set
:conf_minion:`docker.compare_container_networks`.
.. versionchanged:: Neon
.. versionchanged:: 3000
This config option can now also be set in pillar data and grains.
Additionally, it can be set in the master config file, provided that
:conf_minion:`pillar_opts` is enabled on the minion.

View file

@ -267,7 +267,7 @@ def cluster_stats(nodes=None, hosts=None, profile=None):
def cluster_get_settings(flat_settings=False, include_defaults=False, hosts=None, profile=None):
'''
.. versionadded:: Neon
.. versionadded:: 3000
Return Elasticsearch cluster settings.
@ -291,7 +291,7 @@ def cluster_get_settings(flat_settings=False, include_defaults=False, hosts=None
def cluster_put_settings(body=None, flat_settings=False, hosts=None, profile=None):
'''
.. versionadded:: Neon
.. versionadded:: 3000
Set Elasticsearch cluster settings.
@ -693,7 +693,7 @@ def index_close(index, allow_no_indices=True, expand_wildcards='open', ignore_un
def index_get_settings(hosts=None, profile=None, **kwargs):
'''
.. versionadded:: Neon
.. versionadded:: 3000
Check for the existence of an index and if it exists, return its settings
http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html
@ -742,7 +742,7 @@ def index_get_settings(hosts=None, profile=None, **kwargs):
def index_put_settings(body=None, hosts=None, profile=None, source=None, **kwargs):
'''
.. versionadded:: Neon
.. versionadded:: 3000
Update existing index settings
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html
@ -1383,7 +1383,7 @@ def snapshot_delete(repository, snapshot, hosts=None, profile=None):
def flush_synced(hosts=None, profile=None, **kwargs):
'''
.. versionadded:: Neon
.. versionadded:: 3000
Perform a normal flush, then add a generated unique marker (sync_id) to all shards.
http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html

View file

@ -788,7 +788,7 @@ def get_source_sum(file_name='',
Specific file name to look for when ``source_hash`` refers to a remote
file, used to disambiguate ambiguous matches.
saltenv : base
saltenv: base
Salt fileserver environment from which to retrieve the source_hash. This
value will only be used when ``source_hash`` refers to a file on the
Salt fileserver (i.e. one beginning with ``salt://``).
@ -1121,18 +1121,18 @@ def sed(path,
A pattern to find in order to replace with ``after``
after
Text that will replace ``before``
limit : ``''``
limit: ``''``
An initial pattern to search for before searching for ``before``
backup : ``.bak``
backup: ``.bak``
The file will be backed up before edit with this file extension;
**WARNING:** each time ``sed``/``comment``/``uncomment`` is called will
overwrite this backup
options : ``-r -e``
options: ``-r -e``
Options to pass to sed
flags : ``g``
flags: ``g``
Flags to modify the sed search; e.g., ``i`` for case-insensitive pattern
matching
negate_match : False
negate_match: False
Negate the search command (``!``)
.. versionadded:: 0.17.0
@ -1253,13 +1253,13 @@ def psed(path,
A pattern to find in order to replace with ``after``
after
Text that will replace ``before``
limit : ``''``
limit: ``''``
An initial pattern to search for before searching for ``before``
backup : ``.bak``
backup: ``.bak``
The file will be backed up before edit with this file extension;
**WARNING:** each time ``sed``/``comment``/``uncomment`` is called will
overwrite this backup
flags : ``gMS``
flags: ``gMS``
Flags to modify the search. Valid values are:
- ``g``: Replace all occurrences of the pattern, not just the first.
- ``I``: Ignore case.
@ -1382,9 +1382,9 @@ def uncomment(path,
This regex should not include the comment character. A leading ``^``
character will be stripped for convenience (for easily switching
between comment() and uncomment()).
char : ``#``
char: ``#``
The character to remove in order to uncomment a line
backup : ``.bak``
backup: ``.bak``
The file will be backed up before edit with this file extension;
**WARNING:** each time ``sed``/``comment``/``uncomment`` is called will
overwrite this backup
@ -1419,10 +1419,10 @@ def comment(path,
this pattern will be wrapped in parenthesis and will move any
preceding/trailing ``^`` or ``$`` characters outside the parenthesis
(e.g., the pattern ``^foo$`` will be rewritten as ``^(foo)$``)
char : ``#``
char: ``#``
The character to be inserted at the beginning of a line in order to
comment it out
backup : ``.bak``
backup: ``.bak``
The file will be backed up before edit with this file extension
.. warning::
@ -2154,7 +2154,7 @@ def replace(path,
repl
The replacement text
count : 0
count: 0
Maximum number of pattern occurrences to be replaced. If count is a
positive integer ``n``, only ``n`` occurrences will be replaced,
otherwise all occurrences will be replaced.
@ -2173,13 +2173,13 @@ def replace(path,
``file`` may be specified which will read the entire file into memory
before processing.
append_if_not_found : False
append_if_not_found: False
.. versionadded:: 2014.7.0
If set to ``True``, and pattern is not found, then the content will be
appended to the file.
prepend_if_not_found : False
prepend_if_not_found: False
.. versionadded:: 2014.7.0
If set to ``True`` and pattern is not found, then the content will be
@ -2191,21 +2191,21 @@ def replace(path,
Content to use for append/prepend if not found. If None (default), uses
``repl``. Useful when ``repl`` uses references to group in pattern.
backup : .bak
backup: .bak
The file extension to use for a backup of the file before editing. Set
to ``False`` to skip making a backup.
dry_run : False
dry_run: False
If set to ``True``, no changes will be made to the file, the function
will just return the changes that would have been made (or a
``True``/``False`` value if ``show_changes`` is set to ``False``).
search_only : False
search_only: False
If set to true, this no changes will be performed on the file, and this
function will simply return ``True`` if the pattern was matched, and
``False`` if not.
show_changes : True
show_changes: True
If ``True``, return a diff of changes made. Otherwise, return ``True``
if changes were made, and ``False`` if not.
@ -2215,13 +2215,13 @@ def replace(path,
diff. This may not normally be a concern, but could impact
performance if used with large files.
ignore_if_missing : False
ignore_if_missing: False
.. versionadded:: 2015.8.0
If set to ``True``, this function will simply return ``False``
if the file doesn't exist. Otherwise, an error will be thrown.
preserve_inode : True
preserve_inode: True
.. versionadded:: 2015.8.0
Preserve the inode of the file, so that any hard links continue to
@ -2232,7 +2232,7 @@ def replace(path,
filename. Hard links will then share an inode with the backup, instead
(if using ``backup`` to create a backup copy).
backslash_literal : False
backslash_literal: False
.. versionadded:: 2016.11.7
Interpret backslashes as literal backslashes for the repl and not
@ -2541,11 +2541,11 @@ def blockreplace(path,
The content to be used between the two lines identified by marker_start
and marker_stop.
append_if_not_found : False
append_if_not_found: False
If markers are not found and set to ``True`` then, the markers and
content will be appended to the file.
prepend_if_not_found : False
prepend_if_not_found: False
If markers are not found and set to ``True`` then, the markers and
content will be prepended to the file.
@ -2554,17 +2554,17 @@ def blockreplace(path,
The file extension to use for a backup of the file if any edit is made.
Set to ``False`` to skip making a backup.
dry_run : False
dry_run: False
If ``True``, do not make any edits to the file and simply return the
changes that *would* be made.
show_changes : True
show_changes: True
Controls how changes are presented. If ``True``, this function will
return a unified diff of the changes made. If False, then it will
return a boolean (``True`` if any changes were made, otherwise
``False``).
append_newline : False
append_newline: False
Controls whether or not a newline is appended to the content block. If
the value of this argument is ``True`` then a newline will be added to
the content block. If it is ``False``, then a newline will *not* be
@ -3775,6 +3775,10 @@ def remove(path):
.. code-block:: bash
salt '*' file.remove /tmp/foo
.. versionchanged:: 3000
The method now works on all types of file system entries, not just
files, directories and symlinks.
'''
path = os.path.expanduser(path)
@ -3782,7 +3786,7 @@ def remove(path):
raise SaltInvocationError('File path must be absolute: {0}'.format(path))
try:
if os.path.isfile(path) or os.path.islink(path):
if os.path.islink(path) or (os.path.exists(path) and not os.path.isdir(path)):
os.remove(path)
return True
elif os.path.isdir(path):
@ -5030,16 +5034,16 @@ def get_diff(file1,
had to be a file on the salt fileserver (i.e.
``salt://somefile.txt``)
show_filenames : True
show_filenames: True
Set to ``False`` to hide the filenames in the top two lines of the
diff.
show_changes : True
show_changes: True
If set to ``False``, and there are differences, then instead of a diff
a simple message stating that show_changes is set to ``False`` will be
returned.
template : False
template: False
Set to ``True`` if two templates are being compared. This is not useful
except for within states, with the ``obfuscate_templates`` option set
to ``True``.
@ -5209,14 +5213,14 @@ def manage_file(name,
dir_mode
mode for directories created with makedirs
skip_verify : False
skip_verify: False
If ``True``, hash verification of remote file sources (``http://``,
``https://``, ``ftp://``) will be skipped, and the ``source_hash``
argument will be ignored.
.. versionadded:: 2016.3.0
keep_mode : False
keep_mode: False
If ``True``, and the ``source`` is a file from the Salt fileserver (or
a local file on the minion), the mode of the destination file will be
set to the mode of the source file.
@ -5236,7 +5240,7 @@ def manage_file(name,
.. versionadded:: 2017.7.0
encoding_errors : 'strict'
encoding_errors: 'strict'
Default is ```'strict'```.
See https://docs.python.org/2/library/codecs.html#codec-base-classes
for the error handling schemes.

View file

@ -242,7 +242,7 @@ def restore(name=None, clean=False, **kwargs):
clean
If True remove the frozen information YAML from the cache
.. version-added:: Neon
.. version-added:: 3000
CLI Example:

View file

@ -3056,7 +3056,7 @@ def merge(cwd,
.. _`sshd(8)`: http://www.man7.org/linux/man-pages/man8/sshd.8.html#AUTHORIZED_KEYS_FILE_FORMAT
.. versionadded:: 2018.3.5,2019.2.1,Neon
.. versionadded:: 2018.3.5,2019.2.1,3000
ignore_retcode : False
If ``True``, do not log an error to the minion log if the git command
@ -4245,7 +4245,7 @@ def reset(cwd,
.. _`sshd(8)`: http://www.man7.org/linux/man-pages/man8/sshd.8.html#AUTHORIZED_KEYS_FILE_FORMAT
.. versionadded:: 2018.3.5,2019.2.1,Neon
.. versionadded:: 2018.3.5,2019.2.1,3000
ignore_retcode : False
If ``True``, do not log an error to the minion log if the git command

View file

@ -1066,7 +1066,7 @@ def verify(text=None,
- always
- auto
.. versionadded:: fluorine
.. versionadded:: 2019.2.0
CLI Example:

View file

@ -121,7 +121,7 @@ def base64_encodestring(instr):
a newline ('\\n') character after every 76 characters and always
at the end of the encoded byte-like object.
.. versionadded:: Neon
.. versionadded:: 3000
CLI Example:
@ -169,7 +169,7 @@ def base64_decodestring(instr):
'''
Decode a base64-encoded byte-like object using the "modern" Python interface
.. versionadded:: Neon
.. versionadded:: 3000
CLI Example:
@ -265,7 +265,7 @@ def hmac_signature(string, shared_secret, challenge_hmac):
def hmac_compute(string, shared_secret):
'''
.. versionadded:: Sodium
.. versionadded:: 3000
Compute a HMAC SHA256 digest using a string and secret.

View file

@ -475,7 +475,7 @@ def create_stack(name=None, template_file=None, environment=None,
.. versionadded:: 2017.7.5,2018.3.1
The spelling mistake in parameter `enviroment` was corrected to `environment`.
The `enviroment` spelling mistake has been removed in Salt Neon.
The `enviroment` spelling mistake has been removed in Salt 3000.
'''
h_client = _auth(profile)
@ -669,7 +669,7 @@ def update_stack(name=None, template_file=None, environment=None,
.. versionadded:: 2017.7.5,2018.3.1
The spelling mistake in parameter `enviroment` was corrected to `environment`.
The `enviroment` spelling mistake has been removed in Salt Neon.
The `enviroment` spelling mistake has been removed in Salt 3000.
'''
h_client = _auth(profile)

View file

@ -70,7 +70,7 @@ def run_command(jboss_config, command, fail_on_error=True):
salt '*' jboss7_cli.run_command '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_command
'''
cli_command_result = __call_cli(jboss_config, command)
cli_command_result = _call_cli(jboss_config, command)
if cli_command_result['retcode'] == 0:
cli_command_result['success'] = True
@ -104,7 +104,7 @@ def run_operation(jboss_config, operation, fail_on_error=True, retries=1):
salt '*' jboss7_cli.run_operation '{"cli_path": "integration.modules.sysmod.SysModuleTest.test_valid_docs", "controller": "10.11.12.13:9999", "cli_user": "jbossadm", "cli_password": "jbossadm"}' my_operation
'''
cli_command_result = __call_cli(jboss_config, operation, retries)
cli_command_result = _call_cli(jboss_config, operation, retries)
if cli_command_result['retcode'] == 0:
if _is_cli_output(cli_command_result['stdout']):
@ -116,8 +116,19 @@ def run_operation(jboss_config, operation, fail_on_error=True, retries=1):
if _is_cli_output(cli_command_result['stdout']):
cli_result = _parse(cli_command_result['stdout'])
cli_result['success'] = False
match = re.search(r'^(JBAS\d+):', cli_result['failure-description'])
cli_result['err_code'] = match.group(1)
# if match is None then check for wildfly error code
if match is None:
match = re.search(r'^(WFLYCTL\d+):', cli_result['failure-description'])
if match is not None:
cli_result['err_code'] = match.group(1)
else:
# Could not find err_code
log.error("Jboss 7 operation failed! Error Code could not be found!")
cli_result['err_code'] = '-1'
cli_result['stdout'] = cli_command_result['stdout']
else:
if fail_on_error:
@ -132,7 +143,7 @@ def run_operation(jboss_config, operation, fail_on_error=True, retries=1):
return cli_result
def __call_cli(jboss_config, command, retries=1):
def _call_cli(jboss_config, command, retries=1):
command_segments = [
jboss_config['cli_path'],
'--connect',
@ -158,11 +169,11 @@ def __call_cli(jboss_config, command, retries=1):
if cli_command_result['retcode'] == 1 and 'Unable to authenticate against controller' in cli_command_result['stderr']:
raise CommandExecutionError('Could not authenticate against controller, please check username and password for the management console. Err code: {retcode}, stdout: {stdout}, stderr: {stderr}'.format(**cli_command_result))
# It may happen that eventhough server is up it may not respond to the call
# TODO add WFLYCTL code
if cli_command_result['retcode'] == 1 and 'JBAS012144' in cli_command_result['stderr'] and retries > 0: # Cannot connect to cli
log.debug('Command failed, retrying... (%d tries left)', retries)
time.sleep(3)
return __call_cli(jboss_config, command, retries - 1)
return _call_cli(jboss_config, command, retries - 1)
return cli_command_result

View file

@ -3,7 +3,7 @@
Module for checking jinja maps and verifying the result of loading JSON/YAML
files
.. versionadded:: Neon
.. versionadded:: 3000
'''
from __future__ import absolute_import, print_function, unicode_literals

View file

@ -574,10 +574,13 @@ def _fix_cask_namespace(name=None, pkgs=None):
if pkgs:
pkgs_ = []
for pkg in pkgs:
if pkg.startswith('caskroom/cask/'):
if isinstance(pkg, str) and pkg.startswith('caskroom/cask/'):
show_warning = True
pkg = pkg.replace("caskroom/cask/", "homebrew/cask/")
pkgs_.append(pkg)
pkgs_.append(pkg)
else:
pkgs_.append(pkg)
continue
pkgs = pkgs_
if show_warning:

View file

@ -5,7 +5,6 @@ The function cache system allows for data to be stored on the master so it can b
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
import time
import traceback
@ -17,6 +16,10 @@ import salt.utils.args
import salt.utils.event
import salt.utils.network
import salt.transport.client
import salt.utils.mine
import salt.utils.minions
import salt.utils.dictupdate
import salt.utils.functools
from salt.exceptions import SaltClientError
# Import 3rd-party libs
@ -79,10 +82,40 @@ def _mine_get(load, opts):
return channel.send(load)
def _mine_store(
mine_data,
clear=False):
'''
Helper function to store the provided mine data.
This will store either locally in the cache (for masterless setups), or in
the master's cache.
:param dict mine_data: Dictionary with function_name: function_data to store.
:param bool clear: Whether or not to clear (`True`) the mine data for the
function names present in ``mine_data``, or update it (`False`).
'''
# Store in the salt-minion's local cache
if __opts__['file_client'] == 'local':
if not clear:
old = __salt__['data.get']('mine_cache')
if isinstance(old, dict):
old.update(mine_data)
mine_data = old
return __salt__['data.update']('mine_cache', mine_data)
# Store on the salt master
load = {
'cmd': '_mine',
'data': mine_data,
'id': __opts__['id'],
'clear': clear,
}
return _mine_send(load, __opts__)
def update(clear=False, mine_functions=None):
'''
Execute the configured functions and send the data back up to the master.
The functions to be executed are merged from the master config, pillar and
Call the configured functions and send the data back up to the master.
The functions to be called are merged from the master config, pillar and
minion config under the option `mine_functions`:
.. code-block:: yaml
@ -94,14 +127,17 @@ def update(clear=False, mine_functions=None):
This function accepts the following arguments:
clear: False
Boolean flag specifying whether updating will clear the existing
mines, or will update. Default: `False` (update).
:param bool clear: Default: ``False``
Specifies whether updating will clear the existing values (``True``), or
whether it will update them (``False``).
:param dict mine_functions:
Update (or clear, see ``clear``) the mine data on these functions only.
This will need to have the structure as defined on
https://docs.saltstack.com/en/latest/topics/mine/index.html#mine-functions
mine_functions
Update the mine data on certain functions only.
This feature can be used when updating the mine for functions
that require refresh at different intervals than the rest of
that require a refresh at different intervals than the rest of
the functions specified under `mine_functions` in the
minion/master config or pillar.
A potential use would be together with the `scheduler`, for example:
@ -129,64 +165,68 @@ def update(clear=False, mine_functions=None):
salt '*' mine.update
'''
m_data = {}
if not mine_functions:
m_data = __salt__['config.merge']('mine_functions', {})
mine_functions = __salt__['config.merge']('mine_functions', {})
# If we don't have any mine functions configured, then we should just bail out
if not m_data:
if not mine_functions:
return
elif mine_functions and isinstance(mine_functions, list):
m_data = dict((fun, {}) for fun in mine_functions)
elif mine_functions and isinstance(mine_functions, dict):
m_data = mine_functions
elif isinstance(mine_functions, list):
mine_functions = dict((fun, {}) for fun in mine_functions)
elif isinstance(mine_functions, dict):
pass
else:
return
data = {}
for func in m_data:
mine_data = {}
for function_alias, function_data in six.iteritems(mine_functions):
function_name, function_args, function_kwargs, minion_acl = \
salt.utils.mine.parse_function_definition(function_data)
if not _mine_function_available(function_name or function_alias):
continue
try:
if m_data[func] and isinstance(m_data[func], dict):
mine_func = m_data[func].pop('mine_function', func)
if not _mine_function_available(mine_func):
continue
data[func] = __salt__[mine_func](**m_data[func])
elif m_data[func] and isinstance(m_data[func], list):
mine_func = func
if isinstance(m_data[func][0], dict) and 'mine_function' in m_data[func][0]:
mine_func = m_data[func][0]['mine_function']
m_data[func].pop(0)
if not _mine_function_available(mine_func):
continue
data[func] = __salt__[mine_func](*m_data[func])
else:
if not _mine_function_available(func):
continue
data[func] = __salt__[func]()
res = salt.utils.functools.call_function(
__salt__[function_name or function_alias],
*function_args,
**function_kwargs
)
except Exception: # pylint: disable=broad-except
trace = traceback.format_exc()
log.error('Function %s in mine_functions failed to execute', func)
log.error('Function %s in mine.update failed to execute', function_name or function_alias)
log.debug('Error: %s', trace)
continue
if __opts__['file_client'] == 'local':
if not clear:
old = __salt__['data.get']('mine_cache')
if isinstance(old, dict):
old.update(data)
data = old
return __salt__['data.update']('mine_cache', data)
load = {
'cmd': '_mine',
'data': data,
'id': __opts__['id'],
'clear': clear,
}
return _mine_send(load, __opts__)
mine_data[function_alias] = salt.utils.mine.wrap_acl_structure(
res,
**minion_acl
)
return _mine_store(mine_data, clear)
def send(func, *args, **kwargs):
def send(name, *args, **kwargs):
'''
Send a specific function to the mine.
Send a specific function and its result to the salt mine.
This gets stored in either the local cache, or the salt master's cache.
:param str name: Name of the function to add to the mine.
The following pameters are extracted from kwargs if present:
:param str mine_function: The name of the execution_module.function to run
and whose value will be stored in the salt mine. Defaults to ``name``.
:param str allow_tgt: Targeting specification for ACL. Specifies which minions
are allowed to access this function.
:param str allow_tgt_type: Type of the targeting specification. This value will
be ignored if ``allow_tgt`` is not specified.
Remaining args and kwargs will be passed on to the function to run.
:rtype: bool
:return: Whether executing the function and storing the information was succesful.
.. versionchanged:: 3000
Added ``allow_tgt``- and ``allow_tgt_type``-parameters to specify which
minions are allowed to access this function.
See :ref:`targeting` for more information about targeting.
CLI Example:
@ -194,48 +234,30 @@ def send(func, *args, **kwargs):
salt '*' mine.send network.ip_addrs eth0
salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0
salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0 allow_tgt='G@grain:value' allow_tgt_type=compound
'''
kwargs = salt.utils.args.clean_kwargs(**kwargs)
mine_func = kwargs.pop('mine_function', func)
if mine_func not in __salt__:
return False
data = {}
arg_data = salt.utils.args.arg_lookup(__salt__[mine_func])
func_data = copy.deepcopy(kwargs)
for ind, _ in enumerate(arg_data.get('args', [])):
try:
func_data[arg_data['args'][ind]] = args[ind]
except IndexError:
# Safe error, arg may be in kwargs
pass
f_call = salt.utils.args.format_call(
__salt__[mine_func],
func_data,
expected_extra_kws=MINE_INTERNAL_KEYWORDS)
for arg in args:
if arg not in f_call['args']:
f_call['args'].append(arg)
mine_function = kwargs.pop('mine_function', None)
allow_tgt = kwargs.pop('allow_tgt', None)
allow_tgt_type = kwargs.pop('allow_tgt_type', None)
mine_data = {}
try:
if 'kwargs' in f_call:
data[func] = __salt__[mine_func](*f_call['args'], **f_call['kwargs'])
else:
data[func] = __salt__[mine_func](*f_call['args'])
res = salt.utils.functools.call_function(
__salt__[mine_function or name],
*args,
**kwargs
)
except Exception as exc: # pylint: disable=broad-except
log.error('Function %s in mine.send failed to execute: %s',
mine_func, exc)
trace = traceback.format_exc()
log.error('Function %s in mine.send failed to execute', mine_function or name)
log.debug('Error: %s', trace)
return False
if __opts__['file_client'] == 'local':
old = __salt__['data.get']('mine_cache')
if isinstance(old, dict):
old.update(data)
data = old
return __salt__['data.update']('mine_cache', data)
load = {
'cmd': '_mine',
'data': data,
'id': __opts__['id'],
}
return _mine_send(load, __opts__)
mine_data[name] = salt.utils.mine.wrap_acl_structure(
res,
allow_tgt=allow_tgt,
allow_tgt_type=allow_tgt_type
)
return _mine_store(mine_data)
def get(tgt,
@ -243,24 +265,17 @@ def get(tgt,
tgt_type='glob',
exclude_minion=False):
'''
Get data from the mine based on the target, function and tgt_type
Get data from the mine.
Targets can be matched based on any standard matching system that can be
matched on the master via these keywords:
- glob
- pcre
- grain
- grain_pcre
- compound
- pillar
- pillar_pcre
Note that all pillar matches, whether using the compound matching system or
the pillar matching system, will be exact matches, with globbing disabled.
exclude_minion
Excludes the current minion from the result set
:param str tgt: Target whose mine data to get.
:param fun: Function to get the mine data of. You can specify multiple functions
to retrieve using either a list or a comma-separated string of functions.
:type fun: str or list
:param str tgt_type: Default ``glob``. Target type to use with ``tgt``.
See :ref:`targeting` for more information.
Note that all pillar matches, whether using the compound matching system or
the pillar matching system, will be exact matches, with globbing disabled.
:param bool exclude_minion: Excludes the current minion from the result set.
CLI Example:
@ -286,6 +301,7 @@ def get(tgt,
fun='network.ip_addrs',
tgt_type='glob') %}
'''
# Load from local minion's cache
if __opts__['file_client'] == 'local':
ret = {}
is_target = {'glob': __salt__['match.glob'],
@ -298,28 +314,58 @@ def get(tgt,
'pillar': __salt__['match.pillar'],
'pillar_pcre': __salt__['match.pillar_pcre'],
}[tgt_type](tgt)
if is_target:
data = __salt__['data.get']('mine_cache')
if isinstance(data, dict) and fun in data:
ret[__opts__['id']] = data[fun]
if not is_target:
return ret
data = __salt__['data.get']('mine_cache')
if not isinstance(data, dict):
return ret
if isinstance(fun, six.string_types):
functions = list(set(fun.split(',')))
_ret_dict = len(functions) > 1
elif isinstance(fun, list):
functions = fun
_ret_dict = True
else:
return ret
for function in functions:
if function not in data:
continue
# If this is a mine item with minion_side_ACL, get its data
if salt.utils.mine.MINE_ITEM_ACL_ID in data[function]:
res = data[function][salt.utils.mine.MINE_ITEM_ACL_DATA]
else:
# Backwards compatibility with non-ACL mine data.
res = data[function]
if _ret_dict:
ret.setdefault(function, {})[__opts__['id']] = res
else:
ret[__opts__['id']] = res
return ret
# Load from master
load = {
'cmd': '_mine_get',
'id': __opts__['id'],
'tgt': tgt,
'fun': fun,
'tgt_type': tgt_type,
'cmd': '_mine_get',
'id': __opts__['id'],
'tgt': tgt,
'fun': fun,
'tgt_type': tgt_type,
}
ret = _mine_get(load, __opts__)
if exclude_minion:
if __opts__['id'] in ret:
del ret[__opts__['id']]
if exclude_minion and __opts__['id'] in ret:
del ret[__opts__['id']]
return ret
def delete(fun):
'''
Remove specific function contents of minion. Returns True on success.
Remove specific function contents of minion.
:param str fun: The name of the function.
:rtype: bool
:return: True on success.
CLI Example:
@ -333,16 +379,19 @@ def delete(fun):
del data[fun]
return __salt__['data.update']('mine_cache', data)
load = {
'cmd': '_mine_delete',
'id': __opts__['id'],
'fun': fun,
'cmd': '_mine_delete',
'id': __opts__['id'],
'fun': fun,
}
return _mine_send(load, __opts__)
def flush():
'''
Remove all mine contents of minion. Returns True on success.
Remove all mine contents of minion.
:rtype: bool
:return: True on success
CLI Example:
@ -353,8 +402,8 @@ def flush():
if __opts__['file_client'] == 'local':
return __salt__['data.update']('mine_cache', {})
load = {
'cmd': '_mine_flush',
'id': __opts__['id'],
'cmd': '_mine_flush',
'id': __opts__['id'],
}
return _mine_send(load, __opts__)
@ -477,30 +526,21 @@ def valid():
salt '*' mine.valid
'''
m_data = __salt__['config.merge']('mine_functions', {})
mine_functions = __salt__['config.merge']('mine_functions', {})
# If we don't have any mine functions configured, then we should just bail out
if not m_data:
if not mine_functions:
return
data = {}
for func in m_data:
if m_data[func] and isinstance(m_data[func], dict):
mine_func = m_data[func].pop('mine_function', func)
if not _mine_function_available(mine_func):
continue
data[func] = {mine_func: m_data[func]}
elif m_data[func] and isinstance(m_data[func], list):
mine_func = func
if isinstance(m_data[func][0], dict) and 'mine_function' in m_data[func][0]:
mine_func = m_data[func][0]['mine_function']
m_data[func].pop(0)
if not _mine_function_available(mine_func):
continue
data[func] = {mine_func: m_data[func]}
mine_data = {}
for function_alias, function_data in six.iteritems(mine_functions):
function_name, function_args, function_kwargs, minion_acl = \
salt.utils.mine.parse_function_definition(function_data)
if not _mine_function_available(function_name or function_alias):
continue
if function_name:
mine_data[function_alias] = {
function_name: function_args + [{key, value} for key, value in six.iteritems(function_kwargs)]
}
else:
if not _mine_function_available(func):
continue
data[func] = m_data[func]
return data
mine_data[function_alias] = function_data
return mine_data

View file

@ -311,21 +311,32 @@ def format_pkg_list(packages, versions_as_list, attr):
'''
ret = copy.deepcopy(packages)
if attr:
ret_attr = {}
requested_attr = {'epoch', 'version', 'release', 'arch', 'install_date', 'install_date_time_t'}
if attr != 'all':
requested_attr &= set(attr + ['version'])
requested_attr &= set(attr + ['version'] + ['arch'])
for name in ret:
if 'pkg.parse_arch' in __salt__:
_parse_arch = __salt__['pkg.parse_arch'](name)
else:
_parse_arch = {'name': name, 'arch': None}
_name = _parse_arch['name']
_arch = _parse_arch['arch']
versions = []
pkgname = None
for all_attr in ret[name]:
filtered_attr = {}
for key in requested_attr:
if all_attr[key]:
if key in all_attr:
filtered_attr[key] = all_attr[key]
versions.append(filtered_attr)
ret[name] = versions
return ret
if _name and filtered_attr.get('arch', None) == _arch:
pkgname = _name
ret_attr.setdefault(pkgname or name, []).extend(versions)
return ret_attr
for name in ret:
ret[name] = [format_version(d['epoch'], d['version'], d['release'])

View file

@ -3151,6 +3151,7 @@ def datadir_init(name,
password=password,
encoding=encoding,
locale=locale,
checksums=checksums,
runas=runas)
return ret['retcode'] == 0

View file

@ -269,7 +269,7 @@ def list_upstreams(runas=None):
salt '*' rabbitmq.list_upstreams
.. versionadded:: Neon
.. versionadded:: 3000
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
@ -329,7 +329,7 @@ def upstream_exists(name, runas=None):
salt '*' rabbitmq.upstream_exists rabbit_upstream
.. versionadded:: Neon
.. versionadded:: 3000
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
@ -1223,7 +1223,7 @@ def set_upstream(
salt '*' rabbitmq.set_upstream upstream_name ack_mode=on-confirm max_hops=1 \
trust_user_id=True uri=amqp://hostname
.. versionadded:: Neon
.. versionadded:: 3000
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
@ -1262,7 +1262,7 @@ def delete_upstream(name, runas=None):
salt '*' rabbitmq.delete_upstream upstream_name
.. versionadded:: Neon
.. versionadded:: 3000
'''
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()

View file

@ -2,7 +2,7 @@
'''
Access Salt's elemental release code-names.
.. versionadded:: Neon
.. versionadded:: 3000
Salt's feature release schedule is based on the Periodic Table, as described
in the :ref:`Version Numbers <version-numbers>` documentation.

View file

@ -20,7 +20,7 @@ folder, and should be named the same as the associated state. The ``id`` of a te
same manner as in salt state files and should be unique and descriptive.
.. versionadded:: Neon
.. versionadded:: 3000
The ``saltcheck-tests`` folder can be customized using the ``saltcheck_test_location`` minion
configuration setting. This setting is a relative path from the formula's ``salt://`` path
to the test files.
@ -375,7 +375,7 @@ def report_highstate_tests(saltenv=None):
salt '*' saltcheck.report_highstate_tests
.. versionadded:: Neon
.. versionadded:: 3000
'''
if not saltenv:
if 'saltenv' in __opts__ and __opts__['saltenv']:

View file

@ -922,7 +922,7 @@ def sync_pillar(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blackl
def sync_executors(saltenv=None, refresh=True, extmod_whitelist=None, extmod_blacklist=None):
'''
.. versionadded:: Neon
.. versionadded:: 3000
Sync executors from ``salt://_executors`` to the minion

View file

@ -67,9 +67,11 @@ def active():
'''
# turn off all profiles
result = __salt__['cmd.run']('tuned-adm active')
result = __salt__['cmd.run_all']('tuned-adm active', ignore_retcode=True)
if result['retcode'] != 0:
return "none"
pattern = re.compile(r'''(?P<stmt>Current active profile:) (?P<profile>\w+.*)''')
match = re.match(pattern, result)
match = re.match(pattern, result['stdout'])
return '{0}'.format(match.group('profile'))

Some files were not shown because too many files have changed in this diff Show more