Merge branch 'develop' into configserializer

This commit is contained in:
Nick Zeljkovic 2018-03-29 18:27:23 +02:00 committed by GitHub
commit 41960137a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
176 changed files with 2896 additions and 2453 deletions

8
.github/CODEOWNERS vendored
View File

@ -52,6 +52,14 @@ salt/**/thin.py @saltstack/team-ssh
# Team State
salt/state.py @saltstack/team-state
# Team SUSE
salt/**/*btrfs* @saltstack/team-suse
salt/**/*kubernetes* @saltstack/team-suse
salt/**/*pkg* @saltstack/team-suse
salt/**/*snapper* @saltstack/team-suse
salt/**/*xfs* @saltstack/team-suse
salt/**/*zypper* @saltstack/team-suse
# Team Transport
salt/transport/ @saltstack/team-transport
salt/utils/zeromq.py @saltstack/team-transport

View File

@ -1,6 +1,6 @@
---
<% vagrant = system('which vagrant 2>/dev/null >/dev/null') %>
<% version = '2017.7.1' %>
<% version = '2017.7.4' %>
<% platformsfile = ENV['SALT_KITCHEN_PLATFORMS'] || '.kitchen/platforms.yml' %>
<% driverfile = ENV['SALT_KITCHEN_DRIVER'] || '.kitchen/driver.yml' %>
<% verifierfile = ENV['SALT_KITCHEN_VERIFIER'] || '.kitchen/verifier.yml' %>
@ -34,6 +34,9 @@ provisioner:
log_level: info
sudo: true
require_chef: false
retry_on_exit_code:
- 139
max_retries: 2
remote_states:
name: git://github.com/saltstack/salt-jenkins.git
branch: 2018.3
@ -41,8 +44,6 @@ provisioner:
testingdir: /testing
salt_copy_filter:
- .bundle
- .git
- .gitignore
- .kitchen
- .kitchen.yml
- Gemfile
@ -56,6 +57,20 @@ provisioner:
- prep_windows
"*":
- git.salt
pillars:
top.sls:
base:
"*":
- jenkins
"os:Windows":
- match: grain
- windows
jenkins.sls:
testing_dir: "{{salt.config.get('root_dir')|replace('\\', '\\\\')}}/testing"
clone_repo: false
salttesting_namespec: salttesting==2017.6.1
windows.sls:
virtualenv_path: 'c:\Python27\Scripts\pip.exe'
<% if File.exists?(platformsfile) %>
<%= ERB.new(File.read(platformsfile)).result %>
<% else %>
@ -119,29 +134,6 @@ platforms:
provisioner:
salt_bootstrap_options: -X -p rsync git v<%= version %> >/dev/null
<% if vagrant != false %>
- name: windows-2012r2
driver:
box: mwrock/Windows2012R2
name: vagrant
gui: true
customize:
cpus: 4
memory: 8192
transport:
name: winrm
username: Vagrant
password: vagrant
provisioner:
salt_bootstrap_url: https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.ps1
salt_bootstrap_options: -version <%= version %>
verifier:
windows: true
types:
- unit
coverage_xml: false
save:
$env:TEMP/salt-runtests.log: artifacts/logs/salt-runtests.log
/salt/var/log/salt/minion: artifacts/logs/minion
- name: windows-2016
driver:
box: mwrock/Windows2016
@ -157,6 +149,13 @@ platforms:
provisioner:
salt_bootstrap_url: https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.ps1
salt_bootstrap_options: -version <%= version %>
init_environment: |
Clear-Host
$AddedLocation ="c:\salt;c:\salt\bin\Scripts"
$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"
$OldPath = (Get-ItemProperty -Path $Reg -Name PATH).Path
$NewPath= $OldPath + ";" + $AddedLocation
Set-ItemProperty -Path $Reg -Value $NewPath -Name PATH
verifier:
windows: true
types:
@ -171,21 +170,6 @@ suites:
- name: py2
verifier:
python_bin: python2.7
provisioner:
pillars:
top.sls:
base:
"*":
- jenkins
"os:Windows":
- match: grain
- windows
jenkins.sls:
testing_dir: "{{salt.config.get('root_dir')|replace('\\', '\\\\')}}/testing"
clone_repo: false
salttesting_namespec: salttesting==2017.6.1
windows.sls:
virtualenv_path: 'c:\Python27\Scripts\pip.exe'
- name: py3
excludes:
- centos-6
@ -194,18 +178,8 @@ suites:
python_bin: python3
provisioner:
pillars:
top.sls:
base:
"*":
- jenkins
"os:Windows":
- match: grain
- windows
jenkins.sls:
testing_dir: "{{salt.config.get('root_dir')|replace('\\', '\\\\')}}/testing"
clone_repo: false
py3: true
salttesting_namespec: salttesting==2017.6.1
windows.sls:
virtualenv_path: 'c:\Python35\Scripts\pip.exe'

View File

@ -2,7 +2,7 @@
source 'https://rubygems.org'
gem 'test-kitchen', :git => 'https://github.com/gtmanfred/test-kitchen.git'
gem 'test-kitchen', '~>1.20'
gem 'kitchen-salt', :git => 'https://github.com/saltstack/kitchen-salt.git'
gem 'kitchen-sync'
gem 'git'
@ -12,7 +12,7 @@ group :docker do
end
group :opennebula do
gem 'kitchen-opennebula', :git => 'https://github.com/gtmanfred/kitchen-opennebula.git'
gem 'kitchen-opennebula', '>=0.2.3'
gem 'xmlrpc'
end
@ -20,7 +20,7 @@ group :windows do
gem 'vagrant-wrapper'
gem 'kitchen-vagrant'
gem 'winrm', '~>2.0'
gem 'winrm-fs', :git => 'https://github.com/gtmanfred/winrm-fs.git'
gem 'winrm-fs', '>=1.1.1'
end
group :ec2 do

View File

@ -370,7 +370,7 @@ gettext_compact = False
### HTML options
html_theme = 'saltstack2' #change to 'saltstack' to use previous theme
html_theme = os.environ.get('HTML_THEME', 'saltstack2') # set 'HTML_THEME=saltstack' to use previous theme
html_theme_path = ['_themes']
html_title = u''
html_short_title = 'Salt'

View File

@ -551,7 +551,7 @@ Default: ``0``
Memcache is an additional cache layer that keeps a limited amount of data
fetched from the minion data cache for a limited period of time in memory that
makes cache operations faster. It doesn't make much sence for the ``localfs``
makes cache operations faster. It doesn't make much sense for the ``localfs``
cache driver but helps for more complex drivers like ``consul``.
This option sets the memcache items expiration time. By default is set to ``0``

View File

@ -808,6 +808,35 @@ A value of 10 minutes is a reasonable default.
grains_refresh_every: 0
.. conf_minion:: fibre_channel_grains
``fibre_channel_grains``
------------------------
Default: ``False``
The ``fibre_channel_grains`` setting will enable the ``fc_wwn`` grain for
Fibre Channel WWN's on the minion. Since this grain is expensive, it is
disabled by default.
.. code-block:: yaml
fibre_channel_grains: True
.. conf_minion:: iscsi_grains
``iscsi_grains``
------------------------
Default: ``False``
The ``iscsi_grains`` setting will enable the ``iscsi_iqn`` grain on the
minion. Since this grain is expensive, it is disabled by default.
.. code-block:: yaml
iscsi_grains: True
.. conf_minion:: mine_enabled
``mine_enabled``

View File

@ -108,7 +108,7 @@ The frequency of keepalive checks, in minutes. It requires the
Default: ``True``
Wheter the proxy should maintain the connection with the remote
Whether the proxy should maintain the connection with the remote
device. Similarly to :conf_proxy:`proxy_keep_alive`, this option
is very specific to the design of the proxy module.
When :conf_proxy:`proxy_always_alive` is set to ``False``,
@ -126,7 +126,7 @@ has to be closed after every command.
Default: ``False``.
Wheter the pillar data to be merged into the proxy configuration options.
Whether the pillar data to be merged into the proxy configuration options.
As multiple proxies can run on the same server, we may need different
configuration options for each, while there's one single configuration file.
The solution is merging the pillar data of each proxy minion into the opts.

View File

@ -6,7 +6,7 @@ The Salt Fileserver and Client
Introduction
------------
Salt has a modular fileserver, and mulitple client classes which are used to
Salt has a modular fileserver, and multiple client classes which are used to
interact with it. This page serves as a developer's reference, to help explain
how the fileserver and clients both work.

View File

@ -125,6 +125,10 @@ state modules
influxdb_retention_policy
influxdb_user
infoblox
infoblox_a
infoblox_cname
infoblox_host_record
infoblox_range
ini_manage
ipmi
ipset

View File

@ -0,0 +1,6 @@
salt.states.infoblox_a module
===========================
.. automodule:: salt.states.infoblox_a
:members:
:undoc-members:

View File

@ -0,0 +1,6 @@
salt.states.infoblox_cname module
===========================
.. automodule:: salt.states.infoblox_cname
:members:
:undoc-members:

View File

@ -0,0 +1,6 @@
salt.states.infoblox_host_record module
===========================
.. automodule:: salt.states.infoblox_host_record
:members:
:undoc-members:

View File

@ -0,0 +1,6 @@
salt.states.infoblox_range module
===========================
.. automodule:: salt.states.infoblox_range
:members:
:undoc-members:

View File

@ -12,7 +12,7 @@ option to your state declaration:
service.running:
- parallel: True
Now ``nginx`` will be started in a seperate process from the normal state run
Now ``nginx`` will be started in a separate process from the normal state run
and will therefore not block additional states.
Parallel States and Requisites

View File

@ -263,7 +263,7 @@ The use of ``require_any`` demands that one of the required states executes befo
dependent state. The state containing the ``require_any`` requisite is defined as the
dependent state. The states specified in the ``require_any`` statement are defined as the
required states. If at least one of the required state's execution succeeds, the dependent state
will then execute. If at least one of the required state's execution fails, the dependent state
will then execute. If all of the executions by the required states fail, the dependent state
will not execute.
.. code-block:: yaml

View File

@ -156,7 +156,7 @@ security_group
~~~~~~~~~~~~~~
.. versionadded:: next-release
You can specifiy a list of security groups (by name or id) that should be
You can specify a list of security groups (by name or id) that should be
assigned to the VM.
.. code-block:: yaml

View File

@ -104,6 +104,7 @@ Here is an example of a profile:
profitbricks_production:
provider: my-profitbricks-config
image: Ubuntu-15.10-server-2016-05-01
image_password: MyPassword1
disk_type: SSD
disk_size: 40
cores: 8
@ -185,6 +186,14 @@ disk_type
This option allow the disk type to be set to HDD or SSD. The default is
HDD.
.. versionadded:: Fluorine
image_password
A password is set on the image for the "root" or "Administrator" account.
This field may only be set during volume creation. Only valid with
ProfitBricks supplied HDD (not ISO) images. The password must contain at
least 8 and no more than 50 characters. Only these characters are
allowed: [a-z][A-Z][0-9]
cores
This option allows you to override the number of CPU cores as defined by
the size.

View File

@ -436,7 +436,7 @@ external resource, like a cloud virtual machine. This decorator is not normally
used by developers outside of the Salt core team.
`@destructiveTest` -- Marks a test as potentially destructive. It will not be run
by the test runner unles the ``-run-destructive`` test is expressly passed.
by the test runner unless the ``-run-destructive`` test is expressly passed.
`@requires_network` -- Requires a network connection for the test to operate
successfully. If a network connection is not detected, the test will not run.

View File

@ -98,7 +98,7 @@ Mocking Loader Modules
Salt loader modules use a series of globally available dunder variables,
``__salt__``, ``__opts__``, ``__pillar__``, etc. To facilitate testing these
modules a mixin class was created, ``LoaderModuleMockMixin`` which can be found
in ``tests/support/mixins.py``. The reason for the existance of this class is
in ``tests/support/mixins.py``. The reason for the existence of this class is
because historiclly and because it was easier, one would add these dunder
variables directly on the imported module. This however, introduces unexpected
behavior when running the full test suite since those attributes would not be

View File

@ -17,4 +17,4 @@ For example, to install the develop version of salt:
.. note::
SaltStack does offer commerical support for Solaris which includes packages.
SaltStack does offer commercial support for Solaris which includes packages.

View File

@ -18,7 +18,7 @@ and others):
The major difference between these two mechanism is from where results are
returned (from the Salt Master or Salt Minion). Configuring either of these
options will also make the :py:mod:`Jobs Runner functions <salt.runners.jobs>`
to automatically query the remote stores for infomation.
to automatically query the remote stores for information.
External Job Cache - Minion-Side Returner
-----------------------------------------

View File

@ -168,6 +168,28 @@ And the actual pillar file at '/srv/pillar/common_pillar.sls':
context.
Dynamic Pillar Environments
===========================
If environment ``__env__`` is specified in :conf_master:`pillar_roots`, all
environments that are not explicitly specified in :conf_master:`pillar_roots`
will map to the directories from ``__env__``. This allows one to use dynamic
git branch based environments for state/pillar files with the same file-based
pillar applying to all environments. For example:
.. code-block:: yaml
pillar_roots:
__env__:
- /srv/pillar
ext_pillar:
- git:
- __env__ https://example.com/git-pillar.git
.. versionadded:: 2017.7.5,2018.3.1
Pillar Namespace Flattening
===========================

View File

@ -68,7 +68,7 @@ and each event tag has a list of reactor SLS files to be run.
Reactor SLS files are similar to State and Pillar SLS files. They are by
default YAML + Jinja templates and are passed familiar context variables.
Click :ref:`here <reactor-jinja-context>` for more detailed information on the
variables availble in Jinja templating.
variables available in Jinja templating.
Here is the SLS for a simple reaction:
@ -178,7 +178,7 @@ The below two examples are equivalent:
| | fromrepo: updates |
+---------------------------------+-----------------------------+
This reaction would be equvalent to running the following Salt command:
This reaction would be equivalent to running the following Salt command:
.. code-block:: bash
@ -229,7 +229,7 @@ The below two examples are equivalent:
+-------------------------------------------------+-------------------------------------------------+
Assuming that the event tag is ``foo``, and the data passed to the event is
``{'bar': 'baz'}``, then this reaction is equvalent to running the following
``{'bar': 'baz'}``, then this reaction is equivalent to running the following
Salt command:
.. code-block:: bash
@ -294,7 +294,7 @@ The below two examples are equivalent:
| - name: /tmp/foo | - /tmp/foo |
+---------------------------------+---------------------------+
This reaction is equvalent to running the following Salt command:
This reaction is equivalent to running the following Salt command:
.. code-block:: bash

View File

@ -21,7 +21,7 @@ Minion Data Cache Fixes
Added Memcache booster for the minion data cache.
Memcache is an additional cache layer that keeps a limited amount of data
fetched from the minion data cache for a limited period of time in memory that
makes cache operations faster. It doesn't make much sence for the ``localfs``
makes cache operations faster. It doesn't make much sense for the ``localfs``
cache driver but helps for more complex drivers like ``consul``.
For more details see ``memcache_expire_seconds`` and other ``memcache_*``
options in the master config reverence.

View File

@ -518,7 +518,7 @@ Changes:
* ef8e3ef569 Update win_pki.py
- **PR** `#41557`_: (*dmurphy18*) Add symbolic link for salt-proxy service similar to other serivce files
- **PR** `#41557`_: (*dmurphy18*) Add symbolic link for salt-proxy service similar to other service files
@ *2017-06-06T17:13:52Z*
* 3335fcbc7d Merge pull request `#41557`_ from dmurphy18/fix-proxy-service
@ -753,7 +753,7 @@ Changes:
* 66ab1e5184 Re-adding neutron dependency check
* cce07eefc2 Updating Neutron module to suport KeystoneAuth
* cce07eefc2 Updating Neutron module to support KeystoneAuth
- **PR** `#41409`_: (*garethgreenaway*) Fixes to ipc transport
@ *2017-05-25T21:06:27Z*
@ -926,7 +926,7 @@ Changes:
- **ISSUE** `#41306`_: (*lomeroe*) win_lgpo does not properly pack group policy version number in gpt.ini
| refs: `#41319`_ `#41307`_
- **PR** `#41307`_: (*lomeroe*) properly pack/unpack the verison numbers into a number
- **PR** `#41307`_: (*lomeroe*) properly pack/unpack the version numbers into a number
| refs: `#41319`_
* 140b0427e1 Merge pull request `#41319`_ from lomeroe/bp_41307
* 4f0aa577a5 backport 41307 to 2016.11, properly pack version numbers into single number

View File

@ -632,7 +632,7 @@ Changes:
* 3072576 Merge pull request `#42629`_ from xiaoanyunfei/tornadoapi
* 1e13383 tornado api
- **PR** `#42655`_: (*whiteinge*) Reenable cpstats for rest_cherrypy
- **PR** `#42655`_: (*whiteinge*) Re-enable cpstats for rest_cherrypy
@ *2017-08-03T20:44:10Z*
- **PR** `#33806`_: (*cachedout*) Work around upstream cherrypy bug
@ -640,7 +640,7 @@ Changes:
* f0f00fc Merge pull request `#42655`_ from whiteinge/rest_cherrypy-reenable-stats
* deb6316 Fix lint errors
* 6bd91c8 Reenable cpstats for rest_cherrypy
* 6bd91c8 Re-enable cpstats for rest_cherrypy
- **PR** `#42693`_: (*gilbsgilbs*) Fix RabbitMQ tags not properly set.
@ *2017-08-03T20:23:08Z*
@ -847,11 +847,11 @@ Changes:
* 42bb1a6 Merge pull request `#42350`_ from twangboy/win_fix_ver_grains_2016.11
* 8c04840 Detect Server OS with a desktop release name
- **PR** `#42356`_: (*meaksh*) Allow to check whether a function is available on the AliasesLoader wrapper
- **PR** `#42356`_: (*meaksh*) Allow checking whether a function is available on the AliasesLoader wrapper
@ *2017-07-19T16:56:41Z*
* 0a72e56 Merge pull request `#42356`_ from meaksh/2016.11-AliasesLoader-wrapper-fix
* 915d942 Allow to check whether a function is available on the AliasesLoader wrapper
* 915d942 Allow checking whether a function is available on the AliasesLoader wrapper
- **PR** `#42368`_: (*twangboy*) Remove build and dist directories before install (2016.11)
@ *2017-07-19T16:47:28Z*
@ -1392,7 +1392,7 @@ Changes:
* 7f69613 test and lint fixes
* 8ee4843 Suppress output of crypt context and be more specifc with whitespace vs. serial
* 8ee4843 Suppress output of crypt context and be more specific with whitespace vs. serial
* 61f817d Match serials based on output position (fix for non-English languages)

View File

@ -29,7 +29,7 @@ Significate changes (PR #43708 & #45390, damon-atkins) have been made to the pkg
- ``pkg.install`` without a ``version`` parameter no longer upgrades software if the software is already installed. Use ``pkg.install version=latest`` or in a state use ``pkg.latest`` to get the old behavior.
- ``pkg.list_pkgs`` now returns multiple versions if software installed more than once.
- ``pkg.list_pkgs`` now returns 'Not Found' when the version is not found instead of '(value not set)' which matches the contents of the sls definitions.
- ``pkg.remove()`` will wait upto 3 seconds (normally about a second) to detect changes in the registry after removing software, improving reporting of version changes.
- ``pkg.remove()`` will wait up to 3 seconds (normally about a second) to detect changes in the registry after removing software, improving reporting of version changes.
- ``pkg.remove()`` can remove ``latest`` software, if ``latest`` is defined in sls definition.
- Documentation was update for the execution module to match the style in new versions, some corrections as well.
- All install/remove commands are prefix with cmd.exe shell and cmdmod is called with a command line string instead of a list. Some sls files in saltstack/salt-winrepo-ng expected the commands to be prefixed with cmd.exe (i.e. the use of ``&``).
@ -407,7 +407,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
@ *2017-11-28T21:50:19Z*
* 998d714ee7 Merge pull request `#44517`_ from whytewolf/publish_port_doc_missing
* 4b5855283a missed one place where i didnt chanbge master_port from my copy to publish_port
* 4b5855283a missed one place where i didn't change master_port from my copy to publish_port
* e4610baea5 update doc to have publish port
@ -598,7 +598,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
@ *2017-10-31T17:56:34Z*
* cab54e34b5 Merge pull request `#44173`_ from twangboy/win_system_docs
* 8e111b413d Fix some of the wording and grammer errors
* 8e111b413d Fix some of the wording and grammar errors
* a12bc5ae41 Use google style docstrings
@ -831,7 +831,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
- **ISSUE** `#43581`_: (*jcourington*) cherrypy stats issue
| refs: `#44021`_
- **PR** `#42655`_: (*whiteinge*) Reenable cpstats for rest_cherrypy
- **PR** `#42655`_: (*whiteinge*) Re-enable cpstats for rest_cherrypy
| refs: `#44021`_
- **PR** `#33806`_: (*cachedout*) Work around upstream cherrypy bug
| refs: `#42655`_
@ -1001,13 +1001,13 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* ea8d273c2b Merge pull request `#43768`_ from vutny/fix-pylint-deprecation-warnings
* f8b3fa9da1 Merge branch '2016.11' into fix-pylint-deprecation-warnings
- **PR** `#43772`_: (*gtmanfred*) dont print Minion not responding with quiet
- **PR** `#43772`_: (*gtmanfred*) don't print Minion not responding with quiet
@ *2017-09-27T15:39:18Z*
- **ISSUE** `#40311`_: (*cralston0*) --hide-timeout used with --output json --static produces unparseable JSON
| refs: `#43772`_
* 1a8cc60bb4 Merge pull request `#43772`_ from gtmanfred/2016.11
* 0194c60960 dont print Minion not responding with quiet
* 0194c60960 don't print Minion not responding with quiet
- **PR** `#43747`_: (*rallytime*) Add GPG Verification section to Contributing Docs
@ *2017-09-26T21:25:37Z*

View File

@ -41,7 +41,7 @@ Salt's policy has always been that when upgrading, the minion should never be
on a newer version than the master. Specifically with this update, because of
changes in the fileclient, the 2017.7 minion requires a 2017.7 master.
Backwards compatiblity is still maintained, so older minions can still be used.
Backwards compatibility is still maintained, so older minions can still be used.
More information can be found in the :ref:`Salt FAQ<which-version>`
@ -54,7 +54,7 @@ The :py:func:`service.masked <salt.states.service.masked>` and
added to allow Salt to manage masking of systemd units.
Additionally, the following functions in the :mod:`systemd
<salt.modules.systemd>` execution module have changed to accomodate the fact
<salt.modules.systemd>` execution module have changed to accommodate the fact
that indefinite and runtime masks can co-exist for the same unit:
- :py:func:`service.masked <salt.modules.systemd.masked>` - The return from
@ -152,7 +152,7 @@ State Module Changes
In a rare case that you have a function that needs to be called several times but
with the different parameters, an additional feature of "tagging" is to the
rescue. In order to tag a function, use a colon delimeter. For example:
rescue. In order to tag a function, use a colon delimiter. For example:
.. code-block:: yaml
@ -281,7 +281,7 @@ Minion Configuration Additions
salt-api Changes
================
The ``rest_cherrypy`` netapi module has recieved a few minor improvements:
The ``rest_cherrypy`` netapi module has received a few minor improvements:
* A CORS bugfix.
* A new ``/token`` convenience endpoint to generate Salt eauth tokens.
@ -557,7 +557,7 @@ of objects (users, databases, roles, etc.).
.. note::
With the `Moby announcement`_ coming at this year's DockerCon_, Salt's
:mod:`docker <salt.modules.dockermod>` execution module (as well as the
state modules) work interchangably when **docker** is replaced with
state modules) work interchangeably when **docker** is replaced with
**moby** (e.g. :py:func:`moby_container.running
<salt.states.docker_container.running>`, :py:func:`moby_image.present
<salt.states.docker_image.present>`, :py:func:`moby.inspect_container

View File

@ -962,7 +962,7 @@ Changes
- **PR** `#42884`_: (*Giandom*) Convert to dict type the pillar string value passed from slack
@ *2017-08-16T22:30:43Z*
- **ISSUE** `#42842`_: (*Giandom*) retreive kwargs passed with slack engine
- **ISSUE** `#42842`_: (*Giandom*) retrieve kwargs passed with slack engine
| refs: `#42884`_
* 82be9dceb6 Merge pull request `#42884`_ from Giandom/2017.7.1-fix-slack-engine-pillar-args
* 80fd733c99 Update slack.py
@ -1235,13 +1235,13 @@ Changes
* 4ce96eb1a1 Merge pull request `#42778`_ from gtmanfred/spm
* 7ef691e8da make sure to use the correct out_file
- **PR** `#42857`_: (*gtmanfred*) use older name if _create_unverified_context is unvailable
- **PR** `#42857`_: (*gtmanfred*) use older name if _create_unverified_context is unavailable
@ *2017-08-11T13:37:59Z*
- **ISSUE** `#480`_: (*zyluo*) PEP8 types clean-up
| refs: `#42857`_
* 3d05d89e09 Merge pull request `#42857`_ from gtmanfred/vmware
* c1f673eca4 use older name if _create_unverified_context is unvailable
* c1f673eca4 use older name if _create_unverified_context is unavailable
- **PR** `#42866`_: (*twangboy*) Change to GitPython version 2.1.1
@ *2017-08-11T13:23:52Z*
@ -1448,7 +1448,7 @@ Changes
| refs: `#42574`_
- **PR** `#42693`_: (*gilbsgilbs*) Fix RabbitMQ tags not properly set.
- **PR** `#42669`_: (*garethgreenaway*) [2016.11] Fixes to augeas module
- **PR** `#42655`_: (*whiteinge*) Reenable cpstats for rest_cherrypy
- **PR** `#42655`_: (*whiteinge*) Re-enable cpstats for rest_cherrypy
- **PR** `#42629`_: (*xiaoanyunfei*) tornado api
- **PR** `#42623`_: (*terminalmage*) Fix unicode constructor in custom YAML loader
- **PR** `#42574`_: (*sbojarski*) Fixed error reporting in "boto_cfn.present" function.
@ -1469,7 +1469,7 @@ Changes
* deb6316d67 Fix lint errors
* 6bd91c8b03 Reenable cpstats for rest_cherrypy
* 6bd91c8b03 Re-enable cpstats for rest_cherrypy
* 21cf15f9c3 Merge pull request `#42693`_ from gilbsgilbs/fix-rabbitmq-tags
@ -2031,7 +2031,7 @@ Changes
- **PR** `#42368`_: (*twangboy*) Remove build and dist directories before install (2016.11)
- **PR** `#42360`_: (*Ch3LL*) [2016.11] Update version numbers in doc config for 2017.7.0 release
- **PR** `#42359`_: (*Ch3LL*) [2016.3] Update version numbers in doc config for 2017.7.0 release
- **PR** `#42356`_: (*meaksh*) Allow to check whether a function is available on the AliasesLoader wrapper
- **PR** `#42356`_: (*meaksh*) Allow checking whether a function is available on the AliasesLoader wrapper
- **PR** `#42352`_: (*CorvinM*) Multiple documentation fixes
- **PR** `#42350`_: (*twangboy*) Fixes problem with Version and OS Release related grains on certain versions of Python (2016.11)
- **PR** `#42319`_: (*rallytime*) Add more documentation for config options that are missing from master/minion docs
@ -2046,7 +2046,7 @@ Changes
* 0a72e56f6b Merge pull request `#42356`_ from meaksh/2016.11-AliasesLoader-wrapper-fix
* 915d94219e Allow to check whether a function is available on the AliasesLoader wrapper
* 915d94219e Allow checking whether a function is available on the AliasesLoader wrapper
* 10eb7b7a79 Merge pull request `#42368`_ from twangboy/win_fix_build_2016.11

View File

@ -30,7 +30,7 @@ Significate changes (PR #43708 & #45390, damon-atkins) have been made to the pkg
- ``pkg.install`` without a ``version`` parameter no longer upgrades software if the software is already installed. Use ``pkg.install version=latest`` or in a state use ``pkg.latest`` to get the old behavior.
- ``pkg.list_pkgs`` now returns multiple versions if software installed more than once.
- ``pkg.list_pkgs`` now returns 'Not Found' when the version is not found instead of '(value not set)' which matches the contents of the sls definitions.
- ``pkg.remove()`` will wait upto 3 seconds (normally about a second) to detect changes in the registry after removing software, improving reporting of version changes.
- ``pkg.remove()`` will wait up to 3 seconds (normally about a second) to detect changes in the registry after removing software, improving reporting of version changes.
- ``pkg.remove()`` can remove ``latest`` software, if ``latest`` is defined in sls definition.
- Documentation was update for the execution module to match the style in new versions, some corrections as well.
- All install/remove commands are prefix with cmd.exe shell and cmdmod is called with a command line string instead of a list. Some sls files in saltstack/salt-winrepo-ng expected the commands to be prefixed with cmd.exe (i.e. the use of ``&``).
@ -69,7 +69,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
- **PR** `#45664`_: (*rallytime*) Back-port `#45452`_ to 2017.7.3
@ *2018-01-24T15:33:13Z*
- **PR** `#45452`_: (*adelcast*) opkg.py: make owner fuction return value, instead of iterator
- **PR** `#45452`_: (*adelcast*) opkg.py: make owner function return value, instead of iterator
| refs: `#45664`_
* 0717f7a578 Merge pull request `#45664`_ from rallytime/`bp-45452`_
* 369720677b opkg.py: make owner function return value, instead of iterator
@ -359,7 +359,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 66da9b47bc Merge pull request `#45299`_ from garethgreenaway/config_gate_auth_events
* 9a15ec3430 Updating versionadded string. Fixing typo.
* edfc3dc078 Adding in documention for `auth_events` configuration option
* edfc3dc078 Adding in documentation for `auth_events` configuration option
* 3ee4eabffd Fixing small typo
@ -1007,7 +1007,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 4b60b1ec84 Merge remote branch 'refs/remotes/upstream/2017.7' into 2017.7_replace_with_newer_2016.11_win_pkg
* b46f818a57 Raise a PR to fix 2016 issues commited here, fixed issues with merge.
* b46f818a57 Raise a PR to fix 2016 issues committed here, fixed issues with merge.
* 32ef1e12ae Merge branch '2017.7' into 2017.7_replace_with_newer_2016.11_win_pkg
@ -1362,7 +1362,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 998d714ee7 Merge pull request `#44517`_ from whytewolf/publish_port_doc_missing
* 4b5855283a missed one place where i didnt chanbge master_port from my copy to publish_port
* 4b5855283a missed one place where i didn't change master_port from my copy to publish_port
* e4610baea5 update doc to have publish port
@ -1569,9 +1569,9 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 3bb385b44e removing debugging logging
* 7f0ff5a8b0 When passing IDs on the command line convert them all the strings for later comparision.
* 7f0ff5a8b0 When passing IDs on the command line convert them all the strings for later comparison.
* 99e436add4 When looking for job ids to remove based on the tag_name the comparision was comparing an INT to a STR, so the correct job id was not being returned.
* 99e436add4 When looking for job ids to remove based on the tag_name the comparison was comparing an INT to a STR, so the correct job id was not being returned.
- **PR** `#44695`_: (*gtmanfred*) pop None for runas and runas_password
@ *2017-12-01T14:35:01Z*
@ -1714,7 +1714,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 88ef9f18fc ignore lint error on import
* 25427d845e convert key iterator to list as python 3 wont index an iterator
* 25427d845e convert key iterator to list as python 3 won't index an iterator
* bce50154e5 Merge branch '2017.7' into improve-net-load
@ -1773,13 +1773,13 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* c6733ac1ee pop None
- **PR** `#44616`_: (*Ch3LL*) Add Non Base Environement salt:// source integration test
- **PR** `#44616`_: (*Ch3LL*) Add Non Base Environment salt:// source integration test
@ *2017-11-22T16:13:54Z*
* d6ccf4bb30 Merge pull request `#44616`_ from Ch3LL/nonbase_test
* 80b71652e3 Merge branch '2017.7' into nonbase_test
* c9ba33432e Add Non Base Environement salt:// source integration test
* c9ba33432e Add Non Base Environment salt:// source integration test
- **PR** `#44617`_: (*Ch3LL*) Add ssh thin_dir integration test
@ *2017-11-22T16:12:51Z*
@ -1896,7 +1896,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 1643bb7fd4 Merge pull request `#44551`_ from cloudflare/annoying-tmpnam
* ce1882943d Use salt.utils.files.mkstemp() instead
* 6689bd3b2d Dont use dangerous os.tmpnam
* 6689bd3b2d Don't use dangerous os.tmpnam
* 2d6176b0bc Fx2 proxy minion: clean return, like all the other modules
@ -2151,7 +2151,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* cab54e34b5 Merge pull request `#44173`_ from twangboy/win_system_docs
* 8e111b413d Fix some of the wording and grammer errors
* 8e111b413d Fix some of the wording and grammar errors
* a12bc5ae41 Use google style docstrings
@ -2728,7 +2728,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
@ *2017-10-17T15:24:19Z*
* 6252f82f58 Merge pull request `#44133`_ from cachedout/fix_paralell_docs
* 8d1c1e21f0 Fix typos in paralell states docs
* 8d1c1e21f0 Fix typos in parallel states docs
- **PR** `#44135`_: (*timfreund*) Insert missing verb in gitfs walkthrough
@ *2017-10-17T14:32:13Z*
@ -2814,7 +2814,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
- **PR** `#44021`_: (*whiteinge*) Also catch cpstats AttributeError for bad CherryPy release ~5.6.0
- **PR** `#44010`_: (*Ch3LL*) Security Fixes for 2016.3.8
- **PR** `#43977`_: (*Ch3LL*) Add Security Notes to 2016.3.8 Release Notes
- **PR** `#42655`_: (*whiteinge*) Reenable cpstats for rest_cherrypy
- **PR** `#42655`_: (*whiteinge*) Re-enable cpstats for rest_cherrypy
| refs: `#44021`_
- **PR** `#33806`_: (*cachedout*) Work around upstream cherrypy bug
| refs: `#42655`_
@ -3286,7 +3286,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
- **ISSUE** `#40311`_: (*cralston0*) --hide-timeout used with --output json --static produces unparseable JSON
| refs: `#43772`_
- **PR** `#43772`_: (*gtmanfred*) dont print Minion not responding with quiet
- **PR** `#43772`_: (*gtmanfred*) don't print Minion not responding with quiet
- **PR** `#43747`_: (*rallytime*) Add GPG Verification section to Contributing Docs
* 9615ca32d5 Merge pull request `#43773`_ from rallytime/merge-2017.7
* f7035ed7da Merge branch '2017.7' into merge-2017.7
@ -3295,7 +3295,7 @@ Windows cmdmod forcing cmd to be a list (issue #43522) resolved by "cmdmod: Don'
* 1a8cc60bb4 Merge pull request `#43772`_ from gtmanfred/2016.11
* 0194c60960 dont print Minion not responding with quiet
* 0194c60960 don't print Minion not responding with quiet
* 9dee896fb9 Merge pull request `#43747`_ from rallytime/gpg-verification

View File

@ -4,6 +4,22 @@
Salt 2018.3.0 Release Notes - Codename Oxygen
=============================================
Unicode/Python 3 Compatibility Improvements
-------------------------------------------
This release fixes a number of nagging issues with Unicode strings in Salt
under Python 2 (ex. ``'ascii' codec can't decode byte 0xd0``). For best
results, use a UTF-8 locale (such as by setting the ``LANG`` environment
variable to one which supports UTF-8. For example ``en_US.UTF-8``,
``de_DE.UTF-8``, ``ru_RU.UTF-8``, ``C.UTF-8``).
Additionally, a number of Python 3 compatibility fixes have been made, many of
them having to do with file I/O and str/bytes mismatches.
We continue to work toward improving both Unicode and Python 3 compatibility
and welcome any feedback.
Lots of Docker Improvements
---------------------------
@ -521,6 +537,8 @@ In addition to the ``mapping`` and ``port`` options, the following additional op
match a given Master. If set to ``any`` (the default), then any match to a
key/value mapping will constitute a match.
- ``pause`` - The interval in seconds between attempts (default: 5).
- ``fibre_channel_grains`` - Enables the ``fc_wwn`` grain. (Default: False)
- ``iscsi_grains`` - Enables the ``iscsi_iqn`` grain. (Default: False)
Connection to a type instead of DNS
===================================
@ -1522,7 +1540,7 @@ The use of ``require_any`` demands that one of the required states executes befo
dependent state. The state containing the ``require_any`` requisite is defined as the
dependent state. The states specified in the ``require_any`` statement are defined as the
required states. If at least one of the required state's execution succeeds, the dependent state
will then execute. If at least one of the required state's execution fails, the dependent state
will then execute. If all of the executions by the required states fail, the dependent state
will not execute.
- ``watch_any``

View File

@ -36,6 +36,26 @@ information.
Deprecations
------------
API Deprecations
================
Support for :ref:`LocalClient <local-client>`'s ``expr_form`` argument has
been removed. Please use ``tgt_type`` instead. This change was made due to
numerous reports of confusion among community members, since the targeting
method is published to minions as ``tgt_type``, and appears as ``tgt_type``
in the job cache as well.
Those who are using the :ref:`LocalClient <local-client>` (either directly,
or implicitly via a :ref:`netapi module <all-netapi-modules>`) need to update
their code to use ``tgt_type``.
.. code-block:: python
>>> import salt.client
>>> local = salt.client.LocalClient()
>>> local.cmd('*', 'cmd.run', ['whoami'], tgt_type='glob')
{'jerry': 'root'}
Module Deprecations
===================

View File

@ -178,7 +178,7 @@ that the text following it can be evaluated properly.
local States
~~~~~~~~~~~~
``local`` states are evaluated locally; this is analagous to issuing a state
``local`` states are evaluated locally; this is analogous to issuing a state
run using a ``salt-call --local`` command. These commands will be issued on the
local machine running the ``spm`` command, whether that machine is a master or
a minion.

View File

@ -1042,7 +1042,7 @@ Thu Sep 19 17:18:06 UTC 2013 - aboe76@gmail.com
* salt-ssh requires sshpass
* salt-syndic requires salt-master
Minor features:
- 0.17.0 release wil be last release for 0.XX.X numbering system
- 0.17.0 release will be last release for 0.XX.X numbering system
Next release will be <Year>.<Month>.<Minor>
-------------------------------------------------------------------

View File

@ -206,7 +206,7 @@ if ( ! [bool]$Env:SALT_PIP_LOCAL_CACHE) {
Start_Process_and_test_exitcode "$($ini['Settings']['Python2Dir'])\python.exe" "-m pip download --dest $Env:SALT_PIP_LOCAL_CACHE -r $($script_path)\req_pip.txt" "pip download"
}
Write-Output " reading from local pip cache $Env:SALT_PIP_LOCAL_CACHE"
Write-Output " If a (new) ressource is missing, please delete all files in this cache, go online and repeat"
Write-Output " If a (new) resource is missing, please delete all files in this cache, go online and repeat"
Start_Process_and_test_exitcode "$($ini['Settings']['Python2Dir'])\python.exe" "-m pip install --no-index --find-links=$Env:SALT_PIP_LOCAL_CACHE -r $($script_path)\req_pip.txt" "pip install"
}
@ -226,24 +226,16 @@ if ( ! [bool]$Env:SALT_REQ_LOCAL_CACHE) {
Start_Process_and_test_exitcode "$($ini['Settings']['Python2Dir'])\python.exe" "-m pip download --dest $Env:SALT_REQ_LOCAL_CACHE -r $($script_path)\req.txt" "pip download"
}
Write-Output " reading from local pip cache $Env:SALT_REQ_LOCAL_CACHE"
Write-Output " If a (new) ressource is missing, please delete all files in this cache, go online and repeat"
Write-Output " If a (new) resource is missing, please delete all files in this cache, go online and repeat"
Start_Process_and_test_exitcode "$($ini['Settings']['Python2Dir'])\python.exe" "-m pip install --no-index --find-links=$Env:SALT_REQ_LOCAL_CACHE -r $($script_path)\req.txt" "pip install"
}
#==============================================================================
# Install PyWin32 from wheel file
# Cleaning Up PyWin32
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing PyWin32 . . ."
Write-Output " - $script_name :: Cleaning Up PyWin32 . . ."
Write-Output " ----------------------------------------------------------------"
# Download
$file = "$($ini[$bitPrograms]['PyWin322'])"
$url = "$($ini['Settings']['SaltRepo'])/$bitFolder/$file"
$file = "$($ini['Settings']['DownloadDir'])\$bitFolder\$file"
DownloadFileWithProgress $url $file
# Install
Start_Process_and_test_exitcode "$($ini['Settings']['Scripts2Dir'])\pip.exe" "install $file " "pip install PyWin32"
# Move DLL's to Python Root
Write-Output " - $script_name :: Moving PyWin32 DLLs . . ."

View File

@ -191,7 +191,7 @@ If (!($Path.ToLower().Contains("$($ini['Settings']['Scripts3Dir'])".ToLower())))
#==============================================================================
# Update PIP and SetupTools
# caching depends on environmant variable SALT_PIP_LOCAL_CACHE
# caching depends on environment variable SALT_PIP_LOCAL_CACHE
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Updating PIP and SetupTools . . ."
@ -206,13 +206,13 @@ if ( ! [bool]$Env:SALT_PIP_LOCAL_CACHE) {
Start_Process_and_test_exitcode "$($ini['Settings']['Python3Dir'])\python.exe" "-m pip download --dest $Env:SALT_PIP_LOCAL_CACHE -r $($script_path)\req_pip.txt" "pip download"
}
Write-Output " reading from local pip cache $Env:SALT_PIP_LOCAL_CACHE"
Write-Output " If a (new) ressource is missing, please delete all files in this cache, go online and repeat"
Write-Output " If a (new) resource is missing, please delete all files in this cache, go online and repeat"
Start_Process_and_test_exitcode "$($ini['Settings']['Python3Dir'])\python.exe" "-m pip install --no-index --find-links=$Env:SALT_PIP_LOCAL_CACHE -r $($script_path)\req_pip.txt" "pip install"
}
#==============================================================================
# Install pypi resources using pip
# caching depends on environmant variable SALT_REQ_LOCAL_CACHE
# caching depends on environment variable SALT_REQ_LOCAL_CACHE
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing pypi resources using pip . . ."
@ -226,24 +226,16 @@ if ( ! [bool]$Env:SALT_REQ_LOCAL_CACHE) {
Start_Process_and_test_exitcode "$($ini['Settings']['Python3Dir'])\python.exe" "-m pip download --dest $Env:SALT_REQ_LOCAL_CACHE -r $($script_path)\req.txt" "pip download"
}
Write-Output " reading from local pip cache $Env:SALT_REQ_LOCAL_CACHE"
Write-Output " If a (new) ressource is missing, please delete all files in this cache, go online and repeat"
Write-Output " If a (new) resource is missing, please delete all files in this cache, go online and repeat"
Start_Process_and_test_exitcode "$($ini['Settings']['Python3Dir'])\python.exe" "-m pip install --no-index --find-links=$Env:SALT_REQ_LOCAL_CACHE -r $($script_path)\req.txt" "pip install"
}
#==============================================================================
# Install PyWin32 from wheel file
# Cleaning Up PyWin32
#==============================================================================
Write-Output " ----------------------------------------------------------------"
Write-Output " - $script_name :: Installing PyWin32 . . ."
Write-Output " - $script_name :: Cleaning Up PyWin32 . . ."
Write-Output " ----------------------------------------------------------------"
# Download
$file = "$($ini[$bitPrograms]['PyWin323'])"
$url = "$($ini['Settings']['SaltRepo'])/$bitFolder/$file"
$file = "$($ini['Settings']['DownloadDir'])\$bitFolder\$file"
DownloadFileWithProgress $url $file
# Install
Start_Process_and_test_exitcode "$($ini['Settings']['Scripts3Dir'])\pip.exe" "install $file " "pip install PyWin32"
# Move DLL's to Python Root
# The dlls have to be in Python directory and the site-packages\win32 directory

View File

@ -113,6 +113,23 @@ xcopy /Q /Y "%SrcDir%\conf\master" "%CnfDir%\"
xcopy /Q /Y "%SrcDir%\conf\minion" "%CnfDir%\"
@echo.
@echo Copying NSSM to buildenv
@echo ----------------------------------------------------------------------
:: Make sure the "prereq" directory exists
If NOT Exist "%PreDir%" mkdir "%PreDir%"
:: Set the location of the nssm to download
Set Url64="https://repo.saltstack.com/windows/dependencies/64/nssm-2.24-101-g897c7ad.exe"
Set Url32="https://repo.saltstack.com/windows/dependencies/32/nssm-2.24-101-g897c7ad.exe"
:: Check for 64 bit by finding the Program Files (x86) directory
If Defined ProgramFiles(x86) (
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url "%Url64%" -file "%BldDir%\nssm.exe"
) Else (
powershell -ExecutionPolicy RemoteSigned -File download_url_file.ps1 -url "%Url32%" -file "%BldDir%\nssm.exe"
)
@echo.
@echo Copying VCRedist to Prerequisites
@echo ----------------------------------------------------------------------
:: Make sure the "prereq" directory exists

Binary file not shown.

View File

@ -661,7 +661,6 @@ Section -Post
nsExec::Exec "nssm.exe install salt-minion $INSTDIR\bin\python.exe -E -s $INSTDIR\bin\Scripts\salt-minion -c $INSTDIR\conf -l quiet"
nsExec::Exec "nssm.exe set salt-minion Description Salt Minion from saltstack.com"
nsExec::Exec "nssm.exe set salt-minion Start SERVICE_AUTO_START"
nsExec::Exec "nssm.exe set salt-minion AppNoConsole 1"
nsExec::Exec "nssm.exe set salt-minion AppStopMethodConsole 24000"
nsExec::Exec "nssm.exe set salt-minion AppStopMethodWindow 2000"

View File

@ -2,37 +2,37 @@ backports-abc==0.5
backports.ssl-match-hostname==3.5.0.1
certifi
cffi==1.10.0
cryptography==2.1.4
CherryPy==10.2.1
cryptography==1.8.1
enum34==1.1.6
futures==3.1.1
gitdb==0.6.4
GitPython==2.1.7
idna==2.6
GitPython==2.1.3
idna==2.5
ioloop==0.1a0
ipaddress==1.0.18
Jinja2==2.10
Jinja2==2.9.6
libnacl==1.6.1
lxml==4.1.1
Mako==1.0.7
lxml==3.7.3
Mako==1.0.6
MarkupSafe==1.0
msgpack-python==0.4.8
psutil==5.4.1
pyasn1==0.4.2
pycparser==2.18
psutil==5.2.2
pyasn1==0.2.3
pycparser==2.17
pycrypto==2.6.1
pycurl==7.43.0
PyMySQL==0.7.11
pyOpenSSL==17.5.0
python-dateutil==2.6.1
python-gnupg==0.4.1
pythonnet==2.3.0
pyyaml==3.12
pyzmq==16.0.3
requests==2.18.4
pyOpenSSL==17.0.0
python-dateutil==2.6.0
python-gnupg==0.4.0
pywin32==223
PyYAML==3.12
pyzmq==16.0.2
requests==2.13.0
singledispatch==3.4.0.3
six==1.11.0
smmap==0.9.0
timelib==0.2.4
tornado==4.5.2
wheel==0.30.0
tornado==4.5.1
wheel==0.30.0a0
WMI==1.4.9

View File

@ -1,6 +1,6 @@
-r base.txt
mock
mock>=2.0.0
apache-libcloud>=0.14.0
boto>=2.32.1
boto3>=1.2.1

View File

@ -1,6 +1,6 @@
-r base.txt
mock
mock>=2.0.0
apache-libcloud>=0.14.0
boto>=2.32.1
boto3>=1.2.1

View File

@ -79,7 +79,7 @@ def beacon(config):
The second one will match disks from A:\ to Z:\ on a Windows system
Note that if a regular expression are evaluated after static mount points,
which means that if a regular expression matches an other defined mount point,
which means that if a regular expression matches another defined mount point,
it will override the previously defined threshold.
'''

View File

@ -119,7 +119,7 @@ def beacon(config):
for k in ['1m', '5m', '15m']:
LAST_STATUS[k] = avg_dict[k]
if not config['emitatstartup']:
log.debug('Dont emit because emitatstartup is False')
log.debug("Don't emit because emitatstartup is False")
return ret
send_beacon = False

View File

@ -392,7 +392,7 @@ def flush(bank, key=None):
An improvement for this would be loading a custom Lua script in the Redis instance of the user
(using the ``register_script`` feature) and call it whenever we flush.
This script would only need to build this sub-tree causing problems. It can be added later and the behaviour
should not change as the user needs to explicitely allow Salt inject scripts in their Redis instance.
should not change as the user needs to explicitly allow Salt inject scripts in their Redis instance.
'''
redis_server = _get_redis_server()
redis_pipe = redis_server.pipeline()

View File

@ -30,7 +30,7 @@ class SPM(parsers.SPMParser):
self.parse_args()
self.setup_logfile_logger()
v_dirs = [
self.config['cachedir'],
self.config['spm_cache_dir'],
]
verify_env(v_dirs,
self.config['user'],

View File

@ -41,7 +41,6 @@ import salt.utils.platform
import salt.utils.stringutils
import salt.utils.user
import salt.utils.verify
import salt.utils.versions
import salt.utils.zeromq
import salt.syspaths as syspaths
from salt.exceptions import (
@ -315,15 +314,6 @@ class LocalClient(object):
>>> local.run_job('*', 'test.sleep', [300])
{'jid': '20131219215650131543', 'minions': ['jerry']}
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
try:
@ -380,15 +370,6 @@ class LocalClient(object):
>>> local.run_job_async('*', 'test.sleep', [300])
{'jid': '20131219215650131543', 'minions': ['jerry']}
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
try:
@ -437,15 +418,6 @@ class LocalClient(object):
>>> local.cmd_async('*', 'test.sleep', [300])
'20131219215921857715'
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
pub_data = self.run_job(tgt,
fun,
@ -484,15 +456,6 @@ class LocalClient(object):
>>> SLC.cmd_subset('*', 'test.ping', sub=1)
{'jerry': True}
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
minion_ret = self.cmd(tgt,
'sys.list_functions',
tgt_type=tgt_type,
@ -547,15 +510,6 @@ class LocalClient(object):
{'dave': {...}}
{'stewart': {...}}
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
import salt.cli.batch
arg = salt.utils.args.condition_input(arg, kwarg)
opts = {'tgt': tgt,
@ -705,15 +659,6 @@ class LocalClient(object):
minion ID. A compound command will return a sub-dictionary keyed by
function name.
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
was_listening = self.event.cpub
@ -774,15 +719,6 @@ class LocalClient(object):
:param verbose: Print extra information about the running command
:returns: A generator
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
was_listening = self.event.cpub
@ -861,15 +797,6 @@ class LocalClient(object):
{'dave': {'ret': True}}
{'stewart': {'ret': True}}
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
was_listening = self.event.cpub
@ -937,15 +864,6 @@ class LocalClient(object):
None
{'stewart': {'ret': True}}
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
was_listening = self.event.cpub
@ -994,15 +912,6 @@ class LocalClient(object):
'''
Execute a salt command and return
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
arg = salt.utils.args.condition_input(arg, kwarg)
was_listening = self.event.cpub
@ -1045,15 +954,6 @@ class LocalClient(object):
:returns: all of the information for the JID
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
if verbose:
msg = 'Executing job with jid {0}'.format(jid)
print(msg)
@ -1124,15 +1024,6 @@ class LocalClient(object):
:returns: all of the information for the JID
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
if not isinstance(minions, set):
if isinstance(minions, six.string_types):
minions = set([minions])
@ -1571,15 +1462,6 @@ class LocalClient(object):
'''
log.trace('func get_cli_event_returns()')
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
if verbose:
msg = 'Executing job with jid {0}'.format(jid)
print(msg)
@ -1766,15 +1648,6 @@ class LocalClient(object):
minions:
A set, the targets that the tgt passed should match.
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
# Make sure the publisher is running by checking the unix socket
if (self.opts.get('ipc_mode', '') != 'tcp' and
not os.path.exists(os.path.join(self.opts['sock_dir'],
@ -1882,15 +1755,6 @@ class LocalClient(object):
minions:
A set, the targets that the tgt passed should match.
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
# Make sure the publisher is running by checking the unix socket
if (self.opts.get('ipc_mode', '') != 'tcp' and
not os.path.exists(os.path.join(self.opts['sock_dir'],

View File

@ -13,7 +13,6 @@ import logging
import salt.config
import salt.client
import salt.utils.kinds as kinds
import salt.utils.versions
import salt.syspaths as syspaths
try:
@ -49,15 +48,6 @@ class LocalClient(salt.client.LocalClient):
'''
Publish the command!
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
payload_kwargs = self._prep_pub(
tgt,
fun,

View File

@ -223,8 +223,8 @@ class SSH(object):
if self.opts['regen_thin']:
self.opts['ssh_wipe'] = True
if not salt.utils.path.which('ssh'):
raise salt.exceptions.SaltSystemExit('No ssh binary found in path -- ssh must be '
'installed for salt-ssh to run. Exiting.')
raise salt.exceptions.SaltSystemExit(code=-1,
msg='No ssh binary found in path -- ssh must be installed for salt-ssh to run. Exiting.')
self.opts['_ssh_version'] = ssh_version()
self.tgt_type = self.opts['selected_target_option'] \
if self.opts['selected_target_option'] else 'glob'

View File

@ -9,7 +9,7 @@ import random
# Import Salt libs
import salt.config
import salt.utils.versions
import salt.utils.args
import salt.syspaths as syspaths
from salt.exceptions import SaltClientError # Temporary
@ -52,15 +52,6 @@ class SSHClient(object):
'''
Prepare the arguments
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
opts = copy.deepcopy(self.opts)
opts.update(kwargs)
if timeout:
@ -88,15 +79,6 @@ class SSHClient(object):
.. versionadded:: 2015.5.0
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
ssh = self._prep_ssh(
tgt,
fun,
@ -122,15 +104,6 @@ class SSHClient(object):
.. versionadded:: 2015.5.0
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
ssh = self._prep_ssh(
tgt,
fun,
@ -226,14 +199,6 @@ class SSHClient(object):
.. versionadded:: 2017.7.0
'''
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
minion_ret = self.cmd(tgt,
'sys.list_functions',
tgt_type=tgt_type,

View File

@ -102,7 +102,7 @@ def is_windows():
def need_deployment():
'''
Salt thin needs to be deployed - prep the target directory and emit the
delimeter and exit code that signals a required deployment.
delimiter and exit code that signals a required deployment.
'''
if os.path.exists(OPTIONS.saltdir):
shutil.rmtree(OPTIONS.saltdir)

View File

@ -18,7 +18,6 @@ import logging
import salt.client.ssh
import salt.runner
import salt.utils.args
import salt.utils.versions
log = logging.getLogger(__name__)
@ -112,8 +111,7 @@ def publish(tgt,
tgt_type='glob',
returner='',
timeout=5,
roster=None,
expr_form=None):
roster=None):
'''
Publish a command "from the minion out to other minions". In reality, the
minion does not execute this function, it is executed by the master. Thus,
@ -172,17 +170,6 @@ def publish(tgt,
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
return _publish(tgt,
fun,
arg=arg,
@ -199,8 +186,7 @@ def full_data(tgt,
tgt_type='glob',
returner='',
timeout=5,
roster=None,
expr_form=None):
roster=None):
'''
Return the full data about the publication, this is invoked in the same
way as the publish function
@ -222,17 +208,6 @@ def full_data(tgt,
salt-ssh '*' publish.full_data test.kwarg arg='cheese=spam'
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
return _publish(tgt,
fun,
arg=arg,

View File

@ -1499,8 +1499,8 @@ class Cloud(object):
vm_name = vm_details['id']
else:
log.debug(
'vm:{0} in provider:{1} is not in name '
'list:\'{2}\''.format(vm_name, driver, names)
'vm:%s in provider:%s is not in name '
'list:\'%s\'', vm_name, driver, names
)
continue

View File

@ -348,7 +348,8 @@ def get_size(vm_):
return sizes['Small Instance']
for size in sizes:
if vm_size and six.text_type(vm_size) in (six.text_type(sizes[size]['id']), six.text_type(size)):
combinations = (six.text_type(sizes[size]['id']), six.text_type(size))
if vm_size and six.text_type(vm_size) in combinations:
return sizes[size]
raise SaltCloudNotFound(
'The specified size, \'{0}\', could not be found.'.format(vm_size)
@ -568,7 +569,8 @@ def list_nodes(conn=None, call=None):
try:
nodes = conn.list_servers(datacenter_id=datacenter_id)
except PBNotFoundError:
log.error('Failed to get nodes list from datacenter: %s', datacenter_id)
log.error('Failed to get nodes list '
'from datacenter: %s', datacenter_id)
raise
for item in nodes['items']:
@ -1112,8 +1114,6 @@ def _get_system_volume(vm_):
'''
Construct VM system volume list from cloud profile config
'''
# Retrieve list of SSH public keys
ssh_keys = get_public_keys(vm_)
# Override system volume size if 'disk_size' is defined in cloud profile
disk_size = get_size(vm_)['disk']
@ -1124,10 +1124,17 @@ def _get_system_volume(vm_):
volume = Volume(
name='{0} Storage'.format(vm_['name']),
size=disk_size,
disk_type=get_disk_type(vm_),
ssh_keys=ssh_keys
disk_type=get_disk_type(vm_)
)
if 'image_password' in vm_:
image_password = vm_['image_password']
volume.image_password = image_password
# Retrieve list of SSH public keys
ssh_keys = get_public_keys(vm_)
volume.ssh_keys = ssh_keys
if 'image_alias' in vm_.keys():
volume.image_alias = vm_['image_alias']
else:

View File

@ -244,13 +244,13 @@ def start(token,
- ``html``: send the output as HTML
- ``code``: send the output as code
This can be overriden when executing a command, using the ``--out-type`` argument.
This can be overridden when executing a command, using the ``--out-type`` argument.
.. versionadded:: 2017.7.0
outputter: ``nested``
The format to display the data, using the outputters available on the CLI.
This argument can also be overriden when executing a command, using the ``--out`` option.
This argument can also be overridden when executing a command, using the ``--out`` option.
.. versionadded:: 2017.7.0

View File

@ -557,7 +557,7 @@ class Fileserver(object):
if '../' in path:
return fnd
if salt.utils.url.is_escaped(path):
# don't attempt to find URL query arguements in the path
# don't attempt to find URL query arguments in the path
path = salt.utils.url.unescape(path)
else:
if '?' in path:

View File

@ -15,7 +15,6 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
import socket
import sys
import glob
import re
import platform
import logging
@ -71,7 +70,6 @@ __salt__ = {
'cmd.run_all': salt.modules.cmdmod._run_all_quiet,
'smbios.records': salt.modules.smbios.records,
'smbios.get': salt.modules.smbios.get,
'cmd.run_ps': salt.modules.cmdmod.powershell,
}
log = logging.getLogger(__name__)
@ -83,9 +81,8 @@ if salt.utils.platform.is_windows():
import wmi # pylint: disable=import-error
import salt.utils.winapi
import win32api
import salt.modules.reg
import salt.utils.win_reg
HAS_WMI = True
__salt__['reg.read_value'] = salt.modules.reg.read_value
except ImportError:
log.exception(
'Unable to import Python wmi module, some core grains '
@ -110,10 +107,10 @@ def _windows_cpudata():
grains['num_cpus'] = int(os.environ['NUMBER_OF_PROCESSORS'])
except ValueError:
grains['num_cpus'] = 1
grains['cpu_model'] = __salt__['reg.read_value'](
"HKEY_LOCAL_MACHINE",
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
"ProcessorNameString").get('vdata')
grains['cpu_model'] = salt.utils.win_reg.read_value(
hive="HKEY_LOCAL_MACHINE",
key="HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
vname="ProcessorNameString").get('vdata')
return grains
@ -821,6 +818,10 @@ def _virtual(osdata):
fhr_contents = fhr.read()
if ':/lxc/' in fhr_contents:
grains['virtual_subtype'] = 'LXC'
elif ':/kubepods/' in fhr_contents:
grains['virtual_subtype'] = 'kubernetes'
elif ':/libpod_parent/' in fhr_contents:
grains['virtual_subtype'] = 'libpod'
else:
if any(x in fhr_contents
for x in (':/system.slice/docker', ':/docker/',
@ -2494,123 +2495,3 @@ def default_gateway():
except Exception:
continue
return grains
def fc_wwn():
'''
Return list of fiber channel HBA WWNs
'''
grains = {}
grains['fc_wwn'] = False
if salt.utils.platform.is_linux():
grains['fc_wwn'] = _linux_wwns()
elif salt.utils.platform.is_windows():
grains['fc_wwn'] = _windows_wwns()
return grains
def iscsi_iqn():
'''
Return iSCSI IQN
'''
grains = {}
grains['iscsi_iqn'] = False
if salt.utils.platform.is_linux():
grains['iscsi_iqn'] = _linux_iqn()
elif salt.utils.platform.is_windows():
grains['iscsi_iqn'] = _windows_iqn()
elif salt.utils.platform.is_aix():
grains['iscsi_iqn'] = _aix_iqn()
return grains
def _linux_iqn():
'''
Return iSCSI IQN from a Linux host.
'''
ret = []
initiator = '/etc/iscsi/initiatorname.iscsi'
try:
with salt.utils.files.fopen(initiator, 'r') as _iscsi:
for line in _iscsi:
line = line.strip()
if line.startswith('InitiatorName='):
ret.append(line.split('=', 1)[1])
except IOError as ex:
if ex.errno != os.errno.ENOENT:
log.debug("Error while accessing '%s': %s", initiator, ex)
return ret
def _aix_iqn():
'''
Return iSCSI IQN from an AIX host.
'''
ret = []
aixcmd = 'lsattr -E -l iscsi0 | grep initiator_name'
aixret = __salt__['cmd.run'](aixcmd)
if aixret[0].isalpha():
try:
ret.append(aixret.split()[1].rstrip())
except IndexError:
pass
return ret
def _linux_wwns():
'''
Return Fibre Channel port WWNs from a Linux host.
'''
ret = []
for fcfile in glob.glob('/sys/class/fc_host/*/port_name'):
with salt.utils.files.fopen(fcfile, 'r') as _wwn:
for line in _wwn:
ret.append(line.rstrip()[2:])
return ret
def _windows_iqn():
'''
Return iSCSI IQN from a Windows host.
'''
ret = []
wmic = salt.utils.path.which('wmic')
if not wmic:
return ret
namespace = r'\\root\WMI'
mspath = 'MSiSCSIInitiator_MethodClass'
get = 'iSCSINodeName'
cmdret = __salt__['cmd.run_all'](
'{0} /namespace:{1} path {2} get {3} /format:table'.format(
wmic, namespace, mspath, get))
for line in cmdret['stdout'].splitlines():
if line.startswith('iqn.'):
line = line.rstrip()
ret.append(line.rstrip())
return ret
def _windows_wwns():
'''
Return Fibre Channel port WWNs from a Windows host.
'''
ps_cmd = r'Get-WmiObject -ErrorAction Stop -class MSFC_FibrePortHBAAttributes -namespace "root\WMI" | Select -Expandproperty Attributes | %{($_.PortWWN | % {"{0:x2}" -f $_}) -join ""}'
ret = []
cmdret = __salt__['cmd.run_ps'](ps_cmd)
for line in cmdret:
ret.append(line.rstrip())
return ret

View File

@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
'''
Grains for Fibre Channel WWN's. On Windows this runs a PowerShell command that
queries WMI to get the Fibre Channel WWN's available.
.. versionadded:: 2018.3.0
To enable these grains set ``fibre_channel_grains: True``.
.. code-block:: yaml
fibre_channel_grains: True
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import glob
import logging
# Import Salt libs
import salt.modules.cmdmod
import salt.utils.platform
import salt.utils.files
__virtualname__ = 'fibre_channel'
# Get logging started
log = logging.getLogger(__name__)
def __virtual__():
if __opts__.get('fibre_channel_grains', False) is False:
return False
else:
return __virtualname__
def _linux_wwns():
'''
Return Fibre Channel port WWNs from a Linux host.
'''
ret = []
for fc_file in glob.glob('/sys/class/fc_host/*/port_name'):
with salt.utils.files.fopen(fc_file, 'r') as _wwn:
content = _wwn.read()
for line in content.splitlines():
ret.append(line.rstrip()[2:])
return ret
def _windows_wwns():
'''
Return Fibre Channel port WWNs from a Windows host.
'''
ps_cmd = r'Get-WmiObject -ErrorAction Stop ' \
r'-class MSFC_FibrePortHBAAttributes ' \
r'-namespace "root\WMI" | ' \
r'Select -Expandproperty Attributes | ' \
r'%{($_.PortWWN | % {"{0:x2}" -f $_}) -join ""}'
ret = []
cmd_ret = salt.modules.cmdmod.powershell(ps_cmd)
for line in cmd_ret:
ret.append(line.rstrip())
return ret
def fibre_channel_wwns():
'''
Return list of fiber channel HBA WWNs
'''
grains = {'fc_wwn': False}
if salt.utils.platform.is_linux():
grains['fc_wwn'] = _linux_wwns()
elif salt.utils.platform.is_windows():
grains['fc_wwn'] = _windows_wwns()
return grains

114
salt/grains/iscsi.py Normal file
View File

@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
'''
Grains for iSCSI Qualified Names (IQN).
.. versionadded:: 2018.3.0
To enable these grains set `iscsi_grains: True`.
.. code-block:: yaml
iscsi_grains: True
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
# Import Salt libs
import salt.modules.cmdmod
import salt.utils.files
import salt.utils.path
import salt.utils.platform
__virtualname__ = 'iscsi'
# Get logging started
log = logging.getLogger(__name__)
def __virtual__():
if __opts__.get('iscsi_grains', False) is False:
return False
else:
return __virtualname__
def iscsi_iqn():
'''
Return iSCSI IQN
'''
grains = {}
grains['iscsi_iqn'] = False
if salt.utils.platform.is_linux():
grains['iscsi_iqn'] = _linux_iqn()
elif salt.utils.platform.is_windows():
grains['iscsi_iqn'] = _windows_iqn()
elif salt.utils.platform.is_aix():
grains['iscsi_iqn'] = _aix_iqn()
return grains
def _linux_iqn():
'''
Return iSCSI IQN from a Linux host.
'''
ret = []
initiator = '/etc/iscsi/initiatorname.iscsi'
try:
with salt.utils.files.fopen(initiator, 'r') as _iscsi:
for line in _iscsi:
line = line.strip()
if line.startswith('InitiatorName='):
ret.append(line.split('=', 1)[1])
except IOError as ex:
if ex.errno != os.errno.ENOENT:
log.debug("Error while accessing '%s': %s", initiator, ex)
return ret
def _aix_iqn():
'''
Return iSCSI IQN from an AIX host.
'''
ret = []
aix_cmd = 'lsattr -E -l iscsi0 | grep initiator_name'
aix_ret = salt.modules.cmdmod.run(aix_cmd)
if aix_ret[0].isalpha():
try:
ret.append(aix_ret.split()[1].rstrip())
except IndexError:
pass
return ret
def _windows_iqn():
'''
Return iSCSI IQN from a Windows host.
'''
ret = []
wmic = salt.utils.path.which('wmic')
if not wmic:
return ret
namespace = r'\\root\WMI'
path = 'MSiSCSIInitiator_MethodClass'
get = 'iSCSINodeName'
cmd_ret = salt.modules.cmdmod.run_all(
'{0} /namespace:{1} path {2} get {3} /format:table'
''.format(wmic, namespace, path, get))
for line in cmd_ret['stdout'].splitlines():
if line.startswith('iqn.'):
line = line.rstrip()
ret.append(line.rstrip())
return ret

View File

@ -326,7 +326,7 @@ def host(proxy=None):
.. note::
The diference betwen ``host`` and ``hostname`` is that
The diference between ``host`` and ``hostname`` is that
``host`` provides the physical location - either domain name or IP address,
while ``hostname`` provides the hostname as configured on the device.
They are not necessarily the same.

View File

@ -652,7 +652,7 @@ def _load_cached_grains(opts, cfn):
try:
serial = salt.payload.Serial(opts)
with salt.utils.files.fopen(cfn, 'rb') as fp_:
cached_grains = salt.utils.data.decode(serial.load(fp_))
cached_grains = salt.utils.data.decode(serial.load(fp_), preserve_tuples=True)
if not cached_grains:
log.debug('Cached grains are empty, cache might be corrupted. Refreshing.')
return None
@ -819,7 +819,7 @@ def grains(opts, force_refresh=False, proxy=None):
salt.utils.dictupdate.update(grains_data, opts['grains'])
else:
grains_data.update(opts['grains'])
return salt.utils.data.decode(grains_data)
return salt.utils.data.decode(grains_data, preserve_tuples=True)
# TODO: get rid of? Does anyone use this? You should use raw() instead

View File

@ -1484,7 +1484,7 @@ class AESFuncs(object):
if load['loc']:
fp_.seek(load['loc'])
fp_.write(load['data'])
fp_.write(salt.utils.stringutils.to_bytes(load['data']))
return True
def _pillar(self, load):

View File

@ -927,7 +927,7 @@ def _wipe(dev):
def _wait(lfunc, log_lvl=None, log_msg=None, tries=10):
'''
Wait for lfunc to be True
:return: True if lfunc succeeded within tries, False if it didnt
:return: True if lfunc succeeded within tries, False if it didn't
'''
i = 0
while i < tries:

View File

@ -2642,7 +2642,7 @@ def _maybe_set_tags(tags, obj):
def _maybe_set_dns(conn, vpcid, dns_support, dns_hostnames):
if dns_support:
conn.modify_vpc_attribute(vpc_id=vpcid, enable_dns_support=dns_support)
log.debug('DNS spport was set to: %s on vpc %s', dns_support, vpcid)
log.debug('DNS support was set to: %s on vpc %s', dns_support, vpcid)
if dns_hostnames:
conn.modify_vpc_attribute(vpc_id=vpcid, enable_dns_hostnames=dns_hostnames)
log.debug('DNS hostnames was set to: %s on vpc %s', dns_hostnames, vpcid)

View File

@ -425,7 +425,7 @@ def _merge_list_of_dict(first, second, prepend=True):
if first and not second:
return first
# Determine overlaps
# So we dont change the position of the existing terms/filters
# So we don't change the position of the existing terms/filters
overlaps = []
merged = []
appended = []

View File

@ -919,6 +919,7 @@ def version(name, check_remote=False, source=None, pre_versions=False):
salt "*" chocolatey.version <package name> check_remote=True
'''
installed = list_(narrow=name, local_only=True)
installed = {k.lower(): v for k, v in installed.items()}
packages = {}
lower_name = name.lower()
@ -928,6 +929,7 @@ def version(name, check_remote=False, source=None, pre_versions=False):
if check_remote:
available = list_(narrow=name, pre_versions=pre_versions, source=source)
available = {k.lower(): v for k, v in available.items()}
for pkg in packages:
packages[pkg] = {'installed': installed[pkg],

View File

@ -12,7 +12,6 @@ import functools
import glob
import logging
import os
import platform
import shutil
import subprocess
import sys
@ -37,6 +36,7 @@ import salt.utils.timed_subprocess
import salt.utils.user
import salt.utils.versions
import salt.utils.vt
import salt.utils.win_reg
import salt.grains.extra
from salt.ext import six
from salt.exceptions import CommandExecutionError, TimedProcTimeoutError, \
@ -3103,9 +3103,9 @@ def shell_info(shell, list_modules=False):
# Ensure ret['installed'] always as a value of True, False or None (not sure)
ret = {'installed': False}
if salt.utils.platform.is_windows() and shell == 'powershell':
pw_keys = __salt__['reg.list_keys'](
'HKEY_LOCAL_MACHINE',
'Software\\Microsoft\\PowerShell')
pw_keys = salt.utils.win_reg.list_keys(
hive='HKEY_LOCAL_MACHINE',
key='Software\\Microsoft\\PowerShell')
pw_keys.sort(key=int)
if len(pw_keys) == 0:
return {
@ -3114,16 +3114,16 @@ def shell_info(shell, list_modules=False):
'installed': False,
}
for reg_ver in pw_keys:
install_data = __salt__['reg.read_value'](
'HKEY_LOCAL_MACHINE',
'Software\\Microsoft\\PowerShell\\{0}'.format(reg_ver),
'Install')
install_data = salt.utils.win_reg.read_value(
hive='HKEY_LOCAL_MACHINE',
key='Software\\Microsoft\\PowerShell\\{0}'.format(reg_ver),
vname='Install')
if install_data.get('vtype') == 'REG_DWORD' and \
install_data.get('vdata') == 1:
details = __salt__['reg.list_values'](
'HKEY_LOCAL_MACHINE',
'Software\\Microsoft\\PowerShell\\{0}\\'
'PowerShellEngine'.format(reg_ver))
details = salt.utils.win_reg.list_values(
hive='HKEY_LOCAL_MACHINE',
key='Software\\Microsoft\\PowerShell\\{0}\\'
'PowerShellEngine'.format(reg_ver))
# reset data, want the newest version details only as powershell
# is backwards compatible
@ -3418,11 +3418,9 @@ def powershell(cmd,
python_shell = True
# Append PowerShell Object formatting
# ConvertTo-JSON is only available on Versions of Windows greater than
# `7.1.7600`. We have to use `platform.version` instead of `__grains__` here
# because this function is called by `salt/grains/core.py` before
# `__grains__` is populated
if salt.utils.versions.version_cmp(platform.version(), '7.1.7600') == 1:
# ConvertTo-JSON is only available on PowerShell 3.0 and later
psversion = shell_info('powershell')['psversion']
if salt.utils.versions.version_cmp(psversion, '2.0') == 1:
cmd += ' | ConvertTo-JSON'
if depth is not None:
cmd += ' -Depth {0}'.format(depth)

View File

@ -1369,7 +1369,7 @@ def login(*registries):
# information is added to the config.json, since docker-py isn't designed
# to do so.
registry_auth = __pillar__.get('docker-registries', {})
ret = {}
ret = {'retcode': 0}
errors = ret.setdefault('Errors', [])
if not isinstance(registry_auth, dict):
errors.append('\'docker-registries\' Pillar value must be a dictionary')
@ -1427,6 +1427,8 @@ def login(*registries):
errors.append(login_cmd['stderr'])
elif login_cmd['stdout']:
errors.append(login_cmd['stdout'])
if errors:
ret['retcode'] = 1
return ret
@ -4505,7 +4507,7 @@ def pull(image,
time_started = time.time()
response = _client_wrapper('pull', image, **kwargs)
ret = {'Time_Elapsed': time.time() - time_started}
ret = {'Time_Elapsed': time.time() - time_started, 'retcode': 0}
_clear_context()
if not response:
@ -4538,6 +4540,7 @@ def pull(image,
if errors:
ret['Errors'] = errors
ret['retcode'] = 1
return ret
@ -4600,7 +4603,7 @@ def push(image,
time_started = time.time()
response = _client_wrapper('push', image, **kwargs)
ret = {'Time_Elapsed': time.time() - time_started}
ret = {'Time_Elapsed': time.time() - time_started, 'retcode': 0}
_clear_context()
if not response:
@ -4632,6 +4635,7 @@ def push(image,
if errors:
ret['Errors'] = errors
ret['retcode'] = 1
return ret
@ -4703,9 +4707,11 @@ def rmi(*names, **kwargs):
_clear_context()
ret = {'Layers': [x for x in pre_images if x not in images(all=True)],
'Tags': [x for x in pre_tags if x not in list_tags()]}
'Tags': [x for x in pre_tags if x not in list_tags()],
'retcode': 0}
if errors:
ret['Errors'] = errors
ret['retcode'] = 1
return ret
@ -6848,7 +6854,7 @@ def sls_build(repository,
.. versionadded:: 2018.3.0
dryrun: False
when set to True the container will not be commited at the end of
when set to True the container will not be committed at the end of
the build. The dryrun succeed also when the state contains errors.
**RETURN DATA**

View File

@ -220,7 +220,7 @@ def rm_(key, recurse=False, profile=None, **kwargs):
'''
.. versionadded:: 2014.7.0
Delete a key from etcd. Returns True if the key was deleted, False if it wasn
Delete a key from etcd. Returns True if the key was deleted, False if it was
not and None if there was a failure.
CLI Example:

View File

@ -135,7 +135,7 @@ def peer_status():
The return value is a dictionary with peer UUIDs as keys and dicts of peer
information as values. Hostnames are listed in one list. GlusterFS separates
one of the hostnames but the only reason for this seems to be which hostname
happens to be used firts in peering.
happens to be used first in peering.
CLI Example:

View File

@ -51,6 +51,7 @@ from salt.ext import six
import salt.utils.files
import salt.utils.json
import salt.utils.stringutils
import salt.utils.versions
import salt.utils.yaml
# pylint: disable=import-error
@ -193,7 +194,7 @@ def _parse_template(tmpl_str):
return tpl
def _parse_enviroment(env_str):
def _parse_environment(env_str):
'''
Parsing template
'''
@ -428,9 +429,9 @@ def delete_stack(name=None, poll=0, timeout=60, profile=None):
return ret
def create_stack(name=None, template_file=None, enviroment=None,
def create_stack(name=None, template_file=None, environment=None,
parameters=None, poll=0, rollback=False, timeout=60,
profile=None):
profile=None, enviroment=None):
'''
Create a stack (heat stack-create)
@ -440,8 +441,8 @@ def create_stack(name=None, template_file=None, enviroment=None,
template_file
File of template
enviroment
File of enviroment
environment
File of environment
parameters
Parameter dict used to create the stack
@ -464,11 +465,23 @@ def create_stack(name=None, template_file=None, enviroment=None,
salt '*' heat.create_stack name=mystack \\
template_file=salt://template.yaml \\
enviroment=salt://enviroment.yaml \\
environment=salt://environment.yaml \\
parameters="{"image": "Debian 8", "flavor": "m1.small"}" \\
poll=5 rollback=False timeout=60 profile=openstack1
.. versionadded:: 2017.7.5,2018.3.1
The spelling mistake in parameter `enviroment` was corrected to `environment`.
The misspelled version is still supported for backward compatibility, but will
be removed in Salt Neon.
'''
if environment is None and enviroment is not None:
salt.utils.versions.warn_until('Neon', (
"Please use the 'environment' parameter instead of the misspelled 'enviroment' "
"parameter which will be removed in Salt Neon."
))
environment = enviroment
h_client = _auth(profile)
ret = {
'result': True,
@ -536,12 +549,12 @@ def create_stack(name=None, template_file=None, enviroment=None,
ret['comment'] = 'Template not valid {0}'.format(ex)
return ret
env = {}
if enviroment:
enviroment_tmp_file = salt.utils.files.mkstemp()
if environment:
environment_tmp_file = salt.utils.files.mkstemp()
esfn, source_sum, comment_ = __salt__['file.get_managed'](
name=enviroment_tmp_file,
name=environment_tmp_file,
template=None,
source=enviroment,
source=environment,
source_hash=None,
user=None,
group=None,
@ -552,11 +565,11 @@ def create_stack(name=None, template_file=None, enviroment=None,
skip_verify=False,
kwargs=None)
enviroment_manage_result = __salt__['file.manage_file'](
name=enviroment_tmp_file,
environment_manage_result = __salt__['file.manage_file'](
name=environment_tmp_file,
sfn=esfn,
ret=None,
source=enviroment,
source=environment,
source_sum=source_sum,
user=None,
group=None,
@ -568,18 +581,18 @@ def create_stack(name=None, template_file=None, enviroment=None,
show_changes=False,
contents=None,
dir_mode=None)
if enviroment_manage_result['result']:
with salt.utils.files.fopen(enviroment_tmp_file, 'r') as efp_:
if environment_manage_result['result']:
with salt.utils.files.fopen(environment_tmp_file, 'r') as efp_:
env_str = salt.utils.stringutils.to_unicode(efp_.read())
salt.utils.files.safe_rm(enviroment_tmp_file)
salt.utils.files.safe_rm(environment_tmp_file)
try:
env = _parse_enviroment(env_str)
env = _parse_environment(env_str)
except ValueError as ex:
ret['result'] = False
ret['comment'] = 'Error parsing template {0}'.format(ex)
else:
ret['result'] = False
ret['comment'] = 'Can not open enviroment: {0}, {1}'.format(enviroment, comment_)
ret['comment'] = 'Can not open environment: {0}, {1}'.format(environment, comment_)
if ret['result'] is False:
return ret
@ -611,9 +624,9 @@ def create_stack(name=None, template_file=None, enviroment=None,
return ret
def update_stack(name=None, template_file=None, enviroment=None,
def update_stack(name=None, template_file=None, environment=None,
parameters=None, poll=0, rollback=False, timeout=60,
profile=None):
profile=None, enviroment=None):
'''
Update a stack (heat stack-template)
@ -623,8 +636,8 @@ def update_stack(name=None, template_file=None, enviroment=None,
template_file
File of template
enviroment
File of enviroment
environment
File of environment
parameters
Parameter dict used to update the stack
@ -647,11 +660,23 @@ def update_stack(name=None, template_file=None, enviroment=None,
salt '*' heat.update_stack name=mystack \\
template_file=salt://template.yaml \\
enviroment=salt://enviroment.yaml \\
environment=salt://environment.yaml \\
parameters="{"image": "Debian 8", "flavor": "m1.small"}" \\
poll=5 rollback=False timeout=60 profile=openstack1
.. versionadded:: 2017.7.5,2018.3.1
The spelling mistake in parameter `enviroment` was corrected to `environment`.
The misspelled version is still supported for backward compatibility, but will
be removed in Salt Neon.
'''
if environment is None and enviroment is not None:
salt.utils.versions.warn_until('Neon', (
"Please use the 'environment' parameter instead of the misspelled 'enviroment' "
"parameter which will be removed in Salt Neon."
))
environment = enviroment
h_client = _auth(profile)
ret = {
'result': True,
@ -723,12 +748,12 @@ def update_stack(name=None, template_file=None, enviroment=None,
ret['comment'] = 'Template not valid {0}'.format(ex)
return ret
env = {}
if enviroment:
enviroment_tmp_file = salt.utils.files.mkstemp()
if environment:
environment_tmp_file = salt.utils.files.mkstemp()
esfn, source_sum, comment_ = __salt__['file.get_managed'](
name=enviroment_tmp_file,
name=environment_tmp_file,
template=None,
source=enviroment,
source=environment,
source_hash=None,
user=None,
group=None,
@ -739,11 +764,11 @@ def update_stack(name=None, template_file=None, enviroment=None,
skip_verify=False,
kwargs=None)
enviroment_manage_result = __salt__['file.manage_file'](
name=enviroment_tmp_file,
environment_manage_result = __salt__['file.manage_file'](
name=environment_tmp_file,
sfn=esfn,
ret=None,
source=enviroment,
source=environment,
source_sum=source_sum,
user=None,
group=None,
@ -755,18 +780,18 @@ def update_stack(name=None, template_file=None, enviroment=None,
show_changes=False,
contents=None,
dir_mode=None)
if enviroment_manage_result['result']:
with salt.utils.files.fopen(enviroment_tmp_file, 'r') as efp_:
if environment_manage_result['result']:
with salt.utils.files.fopen(environment_tmp_file, 'r') as efp_:
env_str = salt.utils.stringutils.to_unicode(efp_.read())
salt.utils.files.safe_rm(enviroment_tmp_file)
salt.utils.files.safe_rm(environment_tmp_file)
try:
env = _parse_enviroment(env_str)
env = _parse_environment(env_str)
except ValueError as ex:
ret['result'] = False
ret['comment'] = 'Error parsing template {0}'.format(ex)
else:
ret['result'] = False
ret['comment'] = 'Can not open enviroment: {0}, {1}'.format(enviroment, comment_)
ret['comment'] = 'Can not open environment: {0}, {1}'.format(environment, comment_)
if ret['result'] is False:
return ret

View File

@ -593,7 +593,7 @@ def ping(dest_ip=None, **kwargs):
def cli(command=None, format='text', **kwargs):
'''
Executes the CLI commands and returns the output in specified format. \
(default is text) The ouput can also be stored in a file.
(default is text) The output can also be stored in a file.
Usage:

View File

@ -1540,7 +1540,7 @@ def __dict_to_deployment_spec(spec):
'''
Converts a dictionary into kubernetes AppsV1beta1DeploymentSpec instance.
'''
spec_obj = AppsV1beta1DeploymentSpec(template="")
spec_obj = AppsV1beta1DeploymentSpec(template=spec.get('template', ''))
for key, value in iteritems(spec):
if hasattr(spec_obj, key):
setattr(spec_obj, key, value)

View File

@ -18,7 +18,7 @@ CLI Example:
.. code-block:: bash
salt '*' log.error 'Please dont do that, this module is not for CLI use!'
salt '*' log.error "Please don't do that, this module is not for CLI use!"
'''
from __future__ import absolute_import, print_function, unicode_literals

View File

@ -865,7 +865,7 @@ def _network_conf(conf_tuples=None, **kwargs):
for row in val:
ret.append(salt.utils.odict.OrderedDict([(row, val[row])]))
# on old versions of lxc, still support the gateway auto mode
# if we didnt explicitly say no to
# if we didn't explicitly say no to
# (lxc.network.ipv4.gateway: auto)
if _LooseVersion(version()) <= '1.0.7' and \
True not in ['lxc.network.ipv4.gateway' in a for a in ret] and \

View File

@ -11,7 +11,6 @@ import sys
# Import salt libs
import salt.minion
import salt.utils.versions
from salt.defaults import DEFAULT_TARGET_DELIM
from salt.ext import six
@ -309,7 +308,6 @@ def glob(tgt, minion_id=None):
def filter_by(lookup,
tgt_type='compound',
minion_id=None,
expr_form=None,
default='default'):
'''
Return the first match in a dictionary of target patterns
@ -335,17 +333,6 @@ def filter_by(lookup,
# Make the filtered data available to Pillar:
roles: {{ roles | yaml() }}
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
expr_funcs = dict(inspect.getmembers(sys.modules[__name__],
predicate=inspect.isfunction))

View File

@ -16,7 +16,6 @@ import salt.payload
import salt.utils.args
import salt.utils.event
import salt.utils.network
import salt.utils.versions
from salt.exceptions import SaltClientError
# Import 3rd-party libs
@ -242,8 +241,7 @@ def send(func, *args, **kwargs):
def get(tgt,
fun,
tgt_type='glob',
exclude_minion=False,
expr_form=None):
exclude_minion=False):
'''
Get data from the mine based on the target, function and tgt_type
@ -288,17 +286,6 @@ def get(tgt,
fun='network.ip_addrs',
tgt_type='glob') %}
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
if __opts__['file_client'] == 'local':
ret = {}
is_target = {'glob': __salt__['match.glob'],

View File

@ -90,7 +90,7 @@ def _to_dict(objects):
def db_list(user=None, password=None, host=None, port=None, authdb=None):
'''
List all Mongodb databases
List all MongoDB databases
CLI Example:
@ -112,7 +112,7 @@ def db_list(user=None, password=None, host=None, port=None, authdb=None):
def db_exists(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Checks if a database exists in Mongodb
Checks if a database exists in MongoDB
CLI Example:
@ -130,7 +130,7 @@ def db_exists(name, user=None, password=None, host=None, port=None, authdb=None)
def db_remove(name, user=None, password=None, host=None, port=None, authdb=None):
'''
Remove a Mongodb database
Remove a MongoDB database
CLI Example:
@ -207,7 +207,7 @@ def user_find(name, user=None, password=None, host=None, port=None,
def user_list(user=None, password=None, host=None, port=None, database='admin', authdb=None):
'''
List users of a Mongodb database
List users of a MongoDB database
CLI Example:
@ -248,7 +248,7 @@ def user_list(user=None, password=None, host=None, port=None, database='admin',
def user_exists(name, user=None, password=None, host=None, port=None,
database='admin', authdb=None):
'''
Checks if a user exists in Mongodb
Checks if a user exists in MongoDB
CLI Example:
@ -271,7 +271,7 @@ def user_exists(name, user=None, password=None, host=None, port=None,
def user_create(name, passwd, user=None, password=None, host=None, port=None,
database='admin', authdb=None, roles=None):
'''
Create a Mongodb user
Create a MongoDB user
CLI Example:
@ -299,7 +299,7 @@ def user_create(name, passwd, user=None, password=None, host=None, port=None,
def user_remove(name, user=None, password=None, host=None, port=None,
database='admin', authdb=None):
'''
Remove a Mongodb user
Remove a MongoDB user
CLI Example:
@ -325,7 +325,7 @@ def user_remove(name, user=None, password=None, host=None, port=None,
def user_roles_exists(name, roles, database, user=None, password=None, host=None,
port=None, authdb=None):
'''
Checks if a user of a Mongodb database has specified roles
Checks if a user of a MongoDB database has specified roles
CLI Examples:
@ -363,7 +363,7 @@ def user_roles_exists(name, roles, database, user=None, password=None, host=None
def user_grant_roles(name, roles, database, user=None, password=None, host=None,
port=None, authdb=None):
'''
Grant one or many roles to a Mongodb user
Grant one or many roles to a MongoDB user
CLI Examples:
@ -398,7 +398,7 @@ def user_grant_roles(name, roles, database, user=None, password=None, host=None,
def user_revoke_roles(name, roles, database, user=None, password=None, host=None,
port=None, authdb=None):
'''
Revoke one or many roles to a Mongodb user
Revoke one or many roles to a MongoDB user
CLI Examples:

View File

@ -105,7 +105,7 @@ def version(**kwargs):
def db_list(**kwargs):
'''
Return the databse list created on a MS SQL server.
Return the database list created on a MS SQL server.
CLI Example:

View File

@ -185,9 +185,9 @@ def _get_config(**kwargs):
config = {
'box_type': 'sealedbox',
'sk': None,
'sk_file': os.path.join(__opts__['pki_dir'], 'master/nacl'),
'sk_file': os.path.join(__opts__['pki_dir'], 'master', 'nacl'),
'pk': None,
'pk_file': os.path.join(__opts__['pki_dir'], 'master/nacl.pub'),
'pk_file': os.path.join(__opts__['pki_dir'], 'master', 'nacl.pub'),
}
config_key = '{0}.config'.format(__virtualname__)
try:

View File

@ -198,7 +198,7 @@ def load_term_config(filter_name,
debug: ``False``
Debug mode. Will insert a new key under the output dictionary,
as ``loaded_config`` contaning the raw configuration loaded on the device.
as ``loaded_config`` containing the raw configuration loaded on the device.
source_service
A special service to choose from. This is a helper so the user is able to
@ -544,7 +544,7 @@ def load_filter_config(filter_name,
debug: ``False``
Debug mode. Will insert a new key under the output dictionary,
as ``loaded_config`` contaning the raw configuration loaded on the device.
as ``loaded_config`` containing the raw configuration loaded on the device.
The output is a dictionary having the same form as :mod:`net.load_config <salt.modules.napalm_network.load_config>`.
@ -744,7 +744,7 @@ def load_policy_config(filters=None,
debug: ``False``
Debug mode. Will insert a new key under the output dictionary,
as ``loaded_config`` contaning the raw configuration loaded on the device.
as ``loaded_config`` containing the raw configuration loaded on the device.
The output is a dictionary having the same form as :mod:`net.load_config <salt.modules.napalm_network.load_config>`.

View File

@ -1100,10 +1100,10 @@ def config(source=None, **kwargs): # pylint: disable=unused-argument
- running (string): Representation of the native running configuration.
- candidate (string): Representation of the native candidate configuration.
If the device doesnt differentiate between running and startup
If the device doesn't differentiate between running and startup
configuration this will an empty string.
- startup (string): Representation of the native startup configuration.
If the device doesnt differentiate between running and startup
If the device doesn't differentiate between running and startup
configuration this will an empty string.
CLI Example:
@ -1690,7 +1690,7 @@ def load_template(template_name,
# after running the other features:
# compare_config, discard / commit
# which have to be over the same session
# so we'll set the CLOSE global explicitely as False
# so we'll set the CLOSE global explicitly as False
napalm_device['CLOSE'] = False # pylint: disable=undefined-variable
_loaded = salt.utils.napalm.call(
napalm_device, # pylint: disable=undefined-variable

View File

@ -67,7 +67,7 @@ def show(destination, protocol=None, **kwargs): # pylint: disable=unused-argume
In case the destination prefix is too short,
there may be too many routes matched.
Therefore in cases of devices having a very high number of routes
it may be necessary to adjust the prefix lenght and request
it may be necessary to adjust the prefix length and request
using a longer prefix.
destination

View File

@ -442,7 +442,7 @@ def load_config(data, *models, **kwargs):
debug: ``False``
Debug mode. Will insert a new key under the output dictionary,
as ``loaded_config`` contaning the raw configuration loaded on the device.
as ``loaded_config`` containing the raw configuration loaded on the device.
replace: ``False``
Should replace the config with the new generate one?

View File

@ -267,7 +267,7 @@ def modify(
specify user account control properties
.. note::
Only the follwing can be set:
Only the following can be set:
- N: No password required
- D: Account disabled
- H: Home directory required

View File

@ -13,7 +13,6 @@ import salt.crypt
import salt.payload
import salt.transport
import salt.utils.args
import salt.utils.versions
from salt.exceptions import SaltReqTimeoutError, SaltInvocationError
log = logging.getLogger(__name__)
@ -183,8 +182,7 @@ def publish(tgt,
tgt_type='glob',
returner='',
timeout=5,
via_master=None,
expr_form=None):
via_master=None):
'''
Publish a command from the minion out to other minions.
@ -251,17 +249,6 @@ def publish(tgt,
master the publication should be sent to. Only one master may be specified. If
unset, the publication will be sent only to the first master in minion configuration.
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
return _publish(tgt,
fun,
arg=arg,
@ -278,8 +265,7 @@ def full_data(tgt,
arg=None,
tgt_type='glob',
returner='',
timeout=5,
expr_form=None):
timeout=5):
'''
Return the full data about the publication, this is invoked in the same
way as the publish function
@ -301,17 +287,6 @@ def full_data(tgt,
salt '*' publish.full_data test.kwarg arg='cheese=spam'
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
return _publish(tgt,
fun,
arg=arg,

View File

@ -12,7 +12,6 @@ import logging
import salt.payload
import salt.transport
import salt.utils.args
import salt.utils.versions
from salt.exceptions import SaltReqTimeoutError
# Import 3rd party libs
@ -111,8 +110,7 @@ def publish(tgt,
arg=None,
tgt_type='glob',
returner='',
timeout=5,
expr_form=None):
timeout=5):
'''
Publish a command from the minion out to other minions.
@ -167,17 +165,6 @@ def publish(tgt,
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
return _publish(tgt,
fun,
arg=arg,
@ -192,8 +179,7 @@ def full_data(tgt,
arg=None,
tgt_type='glob',
returner='',
timeout=5,
expr_form=None):
timeout=5):
'''
Return the full data about the publication, this is invoked in the same
way as the publish function
@ -215,17 +201,6 @@ def full_data(tgt,
salt '*' publish.full_data test.kwarg arg='cheese=spam'
'''
# remember to remove the expr_form argument from this function when
# performing the cleanup on this deprecation.
if expr_form is not None:
salt.utils.versions.warn_until(
'Fluorine',
'the target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = expr_form
return _publish(tgt,
fun,
arg=arg,

View File

@ -28,26 +28,12 @@ Values/Entries are name/data pairs. There can be many values in a key. The
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import sys
import logging
from salt.ext.six.moves import range # pylint: disable=W0622,import-error
# Import third party libs
try:
import win32api
import win32con
import pywintypes
HAS_WINDOWS_MODULES = True
except ImportError:
HAS_WINDOWS_MODULES = False
# Import Salt libs
import salt.utils.platform
import salt.utils.stringutils
import salt.utils.win_functions
from salt.exceptions import CommandExecutionError
PY2 = sys.version_info[0] == 2
log = logging.getLogger(__name__)
# Define the module's virtual name
@ -62,102 +48,17 @@ def __virtual__():
return (False, 'reg execution module failed to load: '
'The module will only run on Windows systems')
if not HAS_WINDOWS_MODULES:
if 'reg.read_value' not in __utils__:
return (False, 'reg execution module failed to load: '
'One of the following libraries did not load: '
'win32con, win32api, pywintypes')
'The reg salt util is unavailable')
return __virtualname__
def _to_mbcs(vdata):
def key_exists(hive, key, use_32bit_registry=False):
'''
Converts unicode to to current users character encoding. Use this for values
returned by reg functions
'''
return salt.utils.stringutils.to_unicode(vdata, 'mbcs')
def _to_unicode(vdata):
'''
Converts from current users character encoding to unicode. Use this for
parameters being pass to reg functions
'''
# None does not convert to Unicode
if vdata is None:
return None
return salt.utils.stringutils.to_unicode(vdata, 'utf-8')
class Registry(object): # pylint: disable=R0903
'''
Delay usage until this module is used
'''
def __init__(self):
self.hkeys = {
'HKEY_CURRENT_CONFIG': win32con.HKEY_CURRENT_CONFIG,
'HKEY_CLASSES_ROOT': win32con.HKEY_CLASSES_ROOT,
'HKEY_CURRENT_USER': win32con.HKEY_CURRENT_USER,
'HKEY_LOCAL_MACHINE': win32con.HKEY_LOCAL_MACHINE,
'HKEY_USERS': win32con.HKEY_USERS,
'HKCC': win32con.HKEY_CURRENT_CONFIG,
'HKCR': win32con.HKEY_CLASSES_ROOT,
'HKCU': win32con.HKEY_CURRENT_USER,
'HKLM': win32con.HKEY_LOCAL_MACHINE,
'HKU': win32con.HKEY_USERS,
}
self.vtype = {
'REG_BINARY': win32con.REG_BINARY,
'REG_DWORD': win32con.REG_DWORD,
'REG_EXPAND_SZ': win32con.REG_EXPAND_SZ,
'REG_MULTI_SZ': win32con.REG_MULTI_SZ,
'REG_SZ': win32con.REG_SZ,
'REG_QWORD': win32con.REG_QWORD
}
self.opttype = {
'REG_OPTION_NON_VOLATILE': 0,
'REG_OPTION_VOLATILE': 1
}
# Return Unicode due to from __future__ import unicode_literals
self.vtype_reverse = {
win32con.REG_BINARY: 'REG_BINARY',
win32con.REG_DWORD: 'REG_DWORD',
win32con.REG_EXPAND_SZ: 'REG_EXPAND_SZ',
win32con.REG_MULTI_SZ: 'REG_MULTI_SZ',
win32con.REG_SZ: 'REG_SZ',
win32con.REG_QWORD: 'REG_QWORD'
}
self.opttype_reverse = {
0: 'REG_OPTION_NON_VOLATILE',
1: 'REG_OPTION_VOLATILE'
}
# delete_key_recursive uses this to check the subkey contains enough \
# as we do not want to remove all or most of the registry
self.subkey_slash_check = {
win32con.HKEY_CURRENT_USER: 0,
win32con.HKEY_LOCAL_MACHINE: 1,
win32con.HKEY_USERS: 1,
win32con.HKEY_CURRENT_CONFIG: 1,
win32con.HKEY_CLASSES_ROOT: 1
}
self.registry_32 = {
True: win32con.KEY_READ | win32con.KEY_WOW64_32KEY,
False: win32con.KEY_READ,
}
def __getattr__(self, k):
try:
return self.hkeys[k]
except KeyError:
msg = 'No hkey named \'{0}. Try one of {1}\''
hkeys = ', '.join(self.hkeys)
raise CommandExecutionError(msg.format(k, hkeys))
def _key_exists(hive, key, use_32bit_registry=False):
'''
Check that the key is found in the registry
Check that the key is found in the registry. This refers to keys and not
value/data pairs.
:param str hive: The hive to connect to.
:param str key: The key to check
@ -166,19 +67,9 @@ def _key_exists(hive, key, use_32bit_registry=False):
:return: Returns True if found, False if not found
:rtype: bool
'''
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
registry = Registry()
hkey = registry.hkeys[local_hive]
access_mask = registry.registry_32[use_32bit_registry]
try:
handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)
win32api.RegCloseKey(handle)
return True
except WindowsError: # pylint: disable=E0602
return False
return __utils__['reg.key_exists'](hive=hive,
key=key,
use_32bit_registry=use_32bit_registry)
def broadcast_change():
@ -223,32 +114,9 @@ def list_keys(hive, key=None, use_32bit_registry=False):
salt '*' reg.list_keys HKLM 'SOFTWARE'
'''
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
registry = Registry()
hkey = registry.hkeys[local_hive]
access_mask = registry.registry_32[use_32bit_registry]
subkeys = []
try:
handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)
for i in range(win32api.RegQueryInfoKey(handle)[0]):
subkey = win32api.RegEnumKey(handle, i)
if PY2:
subkeys.append(_to_mbcs(subkey))
else:
subkeys.append(subkey)
handle.Close()
except pywintypes.error: # pylint: disable=E0602
log.debug(r'Cannot find key: %s\%s', hive, key, exc_info=True)
return False, r'Cannot find key: {0}\{1}'.format(hive, key)
return subkeys
return __utils__['reg.list_keys'](hive=hive,
key=key,
use_32bit_registry=use_32bit_registry)
def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
@ -280,44 +148,10 @@ def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
salt '*' reg.list_values HKLM 'SYSTEM\\CurrentControlSet\\Services\\Tcpip'
'''
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
registry = Registry()
hkey = registry.hkeys[local_hive]
access_mask = registry.registry_32[use_32bit_registry]
handle = None
values = list()
try:
handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)
for i in range(win32api.RegQueryInfoKey(handle)[1]):
vname, vdata, vtype = win32api.RegEnumValue(handle, i)
if not vname:
vname = "(Default)"
value = {'hive': local_hive,
'key': local_key,
'vname': _to_mbcs(vname),
'vtype': registry.vtype_reverse[vtype],
'success': True}
# Only convert text types to unicode
if vtype == win32con.REG_MULTI_SZ:
value['vdata'] = [_to_mbcs(i) for i in vdata]
elif vtype in [win32con.REG_SZ, win32con.REG_EXPAND_SZ]:
value['vdata'] = _to_mbcs(vdata)
else:
value['vdata'] = vdata
values.append(value)
except pywintypes.error as exc: # pylint: disable=E0602
log.debug(r'Cannot find key: %s\%s', hive, key, exc_info=True)
return False, r'Cannot find key: {0}\{1}'.format(hive, key)
finally:
if handle:
handle.Close()
return values
return __utils__['reg.list_values'](hive=hive,
key=key,
use_32bit_registry=use_32bit_registry,
include_default=include_default)
def read_value(hive, key, vname=None, use_32bit_registry=False):
@ -357,60 +191,10 @@ def read_value(hive, key, vname=None, use_32bit_registry=False):
salt '*' reg.read_value HKEY_LOCAL_MACHINE 'SOFTWARE\Salt' 'version'
'''
# If no name is passed, the default value of the key will be returned
# The value name is Default
# Setup the return array
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
local_vname = _to_unicode(vname)
ret = {'hive': local_hive,
'key': local_key,
'vname': local_vname,
'vdata': None,
'success': True}
if not vname:
ret['vname'] = '(Default)'
registry = Registry()
hkey = registry.hkeys[local_hive]
access_mask = registry.registry_32[use_32bit_registry]
try:
handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)
try:
# RegQueryValueEx returns and accepts unicode data
vdata, vtype = win32api.RegQueryValueEx(handle, local_vname)
if vdata or vdata in [0, '']:
# Only convert text types to unicode
ret['vtype'] = registry.vtype_reverse[vtype]
if vtype == win32con.REG_MULTI_SZ:
ret['vdata'] = [_to_mbcs(i) for i in vdata]
elif vtype in [win32con.REG_SZ, win32con.REG_EXPAND_SZ]:
ret['vdata'] = _to_mbcs(vdata)
else:
ret['vdata'] = vdata
else:
ret['comment'] = 'Empty Value'
except WindowsError: # pylint: disable=E0602
ret['vdata'] = ('(value not set)')
ret['vtype'] = 'REG_SZ'
except pywintypes.error as exc: # pylint: disable=E0602
msg = 'Cannot find {0} in {1}\\{2}' \
''.format(local_vname, local_hive, local_key)
log.trace(exc)
log.trace(msg)
ret['comment'] = msg
ret['success'] = False
except pywintypes.error as exc: # pylint: disable=E0602
msg = 'Cannot find key: {0}\\{1}'.format(local_hive, local_key)
log.trace(exc)
log.trace(msg)
ret['comment'] = msg
ret['success'] = False
return ret
return __utils__['reg.read_value'](hive=hive,
key=key,
vname=vname,
use_32bit_registry=use_32bit_registry)
def set_value(hive,
@ -514,49 +298,13 @@ def set_value(hive,
salt '*' reg.set_value HKEY_LOCAL_MACHINE 'SOFTWARE\\Salt' 'version' '2015.5.2' \\
vtype=REG_LIST vdata='[a,b,c]'
'''
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
local_vname = _to_unicode(vname)
local_vtype = _to_unicode(vtype)
registry = Registry()
hkey = registry.hkeys[local_hive]
vtype_value = registry.vtype[local_vtype]
access_mask = registry.registry_32[use_32bit_registry] | win32con.KEY_ALL_ACCESS
# Check data type and cast to expected type
# int will automatically become long on 64bit numbers
# https://www.python.org/dev/peps/pep-0237/
# String Types to Unicode
if vtype_value in [win32con.REG_SZ, win32con.REG_EXPAND_SZ]:
local_vdata = _to_unicode(vdata)
# Don't touch binary...
elif vtype_value == win32con.REG_BINARY:
local_vdata = vdata
# Make sure REG_MULTI_SZ is a list of strings
elif vtype_value == win32con.REG_MULTI_SZ:
local_vdata = [_to_unicode(i) for i in vdata]
# Everything else is int
else:
local_vdata = int(vdata)
if volatile:
create_options = registry.opttype['REG_OPTION_VOLATILE']
else:
create_options = registry.opttype['REG_OPTION_NON_VOLATILE']
try:
handle, _ = win32api.RegCreateKeyEx(hkey, local_key, access_mask,
Options=create_options)
win32api.RegSetValueEx(handle, local_vname, 0, vtype_value, local_vdata)
win32api.RegFlushKey(handle)
win32api.RegCloseKey(handle)
broadcast_change()
return True
except (win32api.error, SystemError, ValueError, TypeError): # pylint: disable=E0602
log.exception('Encountered error setting registry value')
return False
return __utils__['reg.set_value'](hive=hive,
key=key,
vname=vname,
vdata=vdata,
vtype=vtype,
use_32bit_registry=use_32bit_registry,
volatile=volatile)
def delete_key_recursive(hive, key, use_32bit_registry=False):
@ -591,73 +339,9 @@ def delete_key_recursive(hive, key, use_32bit_registry=False):
salt '*' reg.delete_key_recursive HKLM SOFTWARE\\salt
'''
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
# Instantiate the registry object
registry = Registry()
hkey = registry.hkeys[local_hive]
key_path = local_key
access_mask = registry.registry_32[use_32bit_registry] | win32con.KEY_ALL_ACCESS
if not _key_exists(local_hive, local_key, use_32bit_registry):
return False
if (len(key) > 1) and (key.count('\\', 1) < registry.subkey_slash_check[hkey]):
log.error(
'Hive:%s Key:%s; key is too close to root, not safe to remove',
hive, key
)
return False
# Functions for traversing the registry tree
def _subkeys(_key):
'''
Enumerate keys
'''
i = 0
while True:
try:
subkey = win32api.RegEnumKey(_key, i)
yield subkey
i += 1
except pywintypes.error: # pylint: disable=E0602
break
def _traverse_registry_tree(_hkey, _keypath, _ret, _access_mask):
'''
Traverse the registry tree i.e. dive into the tree
'''
_key = win32api.RegOpenKeyEx(_hkey, _keypath, 0, _access_mask)
for subkeyname in _subkeys(_key):
subkeypath = r'{0}\{1}'.format(_keypath, subkeyname)
_ret = _traverse_registry_tree(_hkey, subkeypath, _ret, access_mask)
_ret.append(subkeypath)
return _ret
# Get a reverse list of registry keys to be deleted
key_list = []
key_list = _traverse_registry_tree(hkey, key_path, key_list, access_mask)
# Add the top level key last, all subkeys must be deleted first
key_list.append(key_path)
ret = {'Deleted': [],
'Failed': []}
# Delete all sub_keys
for sub_key_path in key_list:
try:
key_handle = win32api.RegOpenKeyEx(hkey, sub_key_path, 0, access_mask)
win32api.RegDeleteKey(key_handle, '')
ret['Deleted'].append(r'{0}\{1}'.format(hive, sub_key_path))
except WindowsError as exc: # pylint: disable=E0602
log.error(exc, exc_info=True)
ret['Failed'].append(r'{0}\{1} {2}'.format(hive, sub_key_path, exc))
broadcast_change()
return ret
return __utils__['reg.delete_key_recursive'](hive=hive,
key=key,
use_32bit_registry=use_32bit_registry)
def delete_value(hive, key, vname=None, use_32bit_registry=False):
@ -689,27 +373,10 @@ def delete_value(hive, key, vname=None, use_32bit_registry=False):
salt '*' reg.delete_value HKEY_CURRENT_USER 'SOFTWARE\\Salt' 'version'
'''
local_hive = _to_unicode(hive)
local_key = _to_unicode(key)
local_vname = _to_unicode(vname)
registry = Registry()
hkey = registry.hkeys[local_hive]
access_mask = registry.registry_32[use_32bit_registry] | win32con.KEY_ALL_ACCESS
try:
handle = win32api.RegOpenKeyEx(hkey, local_key, 0, access_mask)
win32api.RegDeleteValue(handle, local_vname)
win32api.RegCloseKey(handle)
broadcast_change()
return True
except WindowsError as exc: # pylint: disable=E0602
log.error(exc, exc_info=True)
log.error('Hive: %s', local_hive)
log.error('Key: %s', local_key)
log.error('ValueName: %s', local_vname)
log.error('32bit Reg: %s', use_32bit_registry)
return False
return __utils__['reg.delete_value'](hive=hive,
key=key,
vname=vname,
use_32bit_registry=use_32bit_registry)
def import_file(source, use_32bit_registry=False):

View File

@ -55,7 +55,6 @@ import salt.utils.minion
import salt.utils.path
import salt.utils.process
import salt.utils.url
import salt.utils.versions
import salt.wheel
HAS_PSUTIL = True
@ -1366,15 +1365,6 @@ def _get_ssh_or_api_client(cfgfile, ssh=False):
def _exec(client, tgt, fun, arg, timeout, tgt_type, ret, kwarg, **kwargs):
if 'expr_form' in kwargs:
salt.utils.versions.warn_until(
'Fluorine',
'The target type should be passed using the \'tgt_type\' '
'argument instead of \'expr_form\'. Support for using '
'\'expr_form\' will be removed in Salt Fluorine.'
)
tgt_type = kwargs.pop('expr_form')
fcn_ret = {}
seen = 0
if 'batch' in kwargs:

View File

@ -564,7 +564,7 @@ def fcontext_apply_policy(name, recursive=False):
.. versionadded:: 2017.7.0
Applies SElinux policies to filespec using `restorecon [-R]
filespec`. Returns dict with changes if succesful, the output of
filespec`. Returns dict with changes if successful, the output of
the restorecon command otherwise.
name

View File

@ -141,7 +141,7 @@ def show_message(message, msg_type=None,
message
The message to display
msg_type
The type of the message. Changes the appearence of the message.
The type of the message. Changes the appearance of the message.
Available types are::

View File

@ -151,7 +151,7 @@ def _create_update_from_cfg(mode='create', uuid=None, vmcfg=None):
ret['Error'] = res['stderr']
return ret
else:
# cleanup json file (only when succesful to help troubleshooting)
# cleanup json file (only when successful to help troubleshooting)
salt.utils.files.safe_rm(vmadm_json_file)
# return uuid

View File

@ -195,7 +195,7 @@ def cluster_status(**kwargs):
def alias_exists(alias_name, **kwargs):
'''
Check alias existance
Check alias existence
Additional parameters (kwargs) may be passed, they will be proxied to http.query

View File

@ -40,33 +40,35 @@ def __virtual__():
'''
# Verify Windows
if not salt.utils.platform.is_windows():
log.debug('Module DSC: Only available on Windows systems')
return False, 'Module DSC: Only available on Windows systems'
log.debug('DSC: Only available on Windows systems')
return False, 'DSC: Only available on Windows systems'
# Verify PowerShell
powershell_info = __salt__['cmd.shell_info']('powershell')
if not powershell_info['installed']:
log.debug('Module DSC: Requires PowerShell')
return False, 'Module DSC: Requires PowerShell'
log.debug('DSC: Requires PowerShell')
return False, 'DSC: Requires PowerShell'
# Verify PowerShell 5.0 or greater
if salt.utils.versions.compare(powershell_info['version'], '<', '5.0'):
log.debug('Module DSC: Requires PowerShell 5 or later')
return False, 'Module DSC: Requires PowerShell 5 or later'
log.debug('DSC: Requires PowerShell 5 or later')
return False, 'DSC: Requires PowerShell 5 or later'
return __virtualname__
def _pshell(cmd, cwd=None, json_depth=2):
def _pshell(cmd, cwd=None, json_depth=2, ignore_retcode=False):
'''
Execute the desired PowerShell command and ensure that it returns data
in json format and load that into python
in json format and load that into python. Either return a dict or raise a
CommandExecutionError.
'''
if 'convertto-json' not in cmd.lower():
cmd = '{0} | ConvertTo-Json -Depth {1}'.format(cmd, json_depth)
log.debug('DSC: %s', cmd)
results = __salt__['cmd.run_all'](
cmd, shell='powershell', cwd=cwd, python_shell=True)
cmd, shell='powershell', cwd=cwd, python_shell=True,
ignore_retcode=ignore_retcode)
if 'pid' in results:
del results['pid']
@ -76,12 +78,17 @@ def _pshell(cmd, cwd=None, json_depth=2):
raise CommandExecutionError(
'Issue executing PowerShell {0}'.format(cmd), info=results)
# Sometimes Powershell returns an empty string, which isn't valid JSON
if results['stdout'] == '':
results['stdout'] = '{}'
try:
ret = salt.utils.json.loads(results['stdout'], strict=False)
except ValueError:
raise CommandExecutionError(
'No JSON results from PowerShell', info=results)
log.info('DSC: Returning "{0}"'.format(ret))
return ret
@ -99,8 +106,8 @@ def run_config(path,
script, the desired configuration can be applied by passing the name in the
``config`` option.
This command would be the equivalent of running ``dsc.compile_config`` and
``dsc.apply_config`` separately.
This command would be the equivalent of running ``dsc.compile_config``
followed by ``dsc.apply_config``.
Args:
@ -142,7 +149,7 @@ def run_config(path,
Default is 'base'
Returns:
bool: True if successfully compiled and applied, False if not
bool: True if successfully compiled and applied, otherwise False
CLI Example:
@ -150,13 +157,13 @@ def run_config(path,
.. code-block:: bash
salt '*' dsc.compile_apply_config C:\\DSC\\WebsiteConfig.ps1
salt '*' dsc.run_config C:\\DSC\\WebsiteConfig.ps1
To cache a config script to the system from the master and compile it:
.. code-block:: bash
salt '*' dsc.compile_apply_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
salt '*' dsc.run_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
'''
ret = compile_config(path=path,
source=source,
@ -241,31 +248,31 @@ def compile_config(path,
salt '*' dsc.compile_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
'''
if source:
log.info('Caching %s', source)
log.info('DSC: Caching %s', source)
cached_files = __salt__['cp.get_file'](path=source,
dest=path,
saltenv=salt_env,
makedirs=True)
if not cached_files:
error = 'Failed to cache {0}'.format(source)
log.error(error)
log.error('DSC: {0}'.format(error))
raise CommandExecutionError(error)
if config_data_source:
log.info('Caching %s', config_data_source)
log.info('DSC: Caching %s', config_data_source)
cached_files = __salt__['cp.get_file'](path=config_data_source,
dest=config_data,
saltenv=salt_env,
makedirs=True)
if not cached_files:
error = 'Failed to cache {0}'.format(config_data_source)
log.error(error)
log.error('DSC: {0}'.format(error))
raise CommandExecutionError(error)
# Make sure the path exists
if not os.path.exists(path):
error = '"{0} not found.'.format(path)
log.error(error)
error = '"{0}" not found'.format(path)
log.error('DSC: {0}'.format(error))
raise CommandExecutionError(error)
if config_name is None:
@ -291,10 +298,11 @@ def compile_config(path,
if ret:
# Script compiled, return results
if ret.get('Exists'):
log.info('DSC Compile Config: %s', ret)
log.info('DSC: Compile Config: %s', ret)
return ret
# Run the script and run the compile command
# If you get to this point, the script did not contain a compile command
# dot source the script to compile the state and generate the mof file
cmd = ['.', path]
if script_parameters:
cmd.append(script_parameters)
@ -312,12 +320,12 @@ def compile_config(path,
if ret:
# Script compiled, return results
if ret.get('Exists'):
log.info('DSC Compile Config: %s', ret)
log.info('DSC: Compile Config: %s', ret)
return ret
error = 'Failed to compile config: {0}'.format(path)
error += '\nReturned: {0}'.format(ret)
log.error('DSC Compile Config: %s', error)
log.error('DSC: %s', error)
raise CommandExecutionError(error)
@ -349,13 +357,13 @@ def apply_config(path, source=None, salt_env='base'):
.. code-block:: bash
salt '*' dsc.run_config C:\\DSC\\WebSiteConfiguration
salt '*' dsc.apply_config C:\\DSC\\WebSiteConfiguration
To cache a configuration from the master and apply it:
.. code-block:: bash
salt '*' dsc.run_config C:\\DSC\\WebSiteConfiguration salt://dsc/configs/WebSiteConfiguration
salt '*' dsc.apply_config C:\\DSC\\WebSiteConfiguration salt://dsc/configs/WebSiteConfiguration
'''
# If you're getting an error along the lines of "The client cannot connect
@ -369,38 +377,35 @@ def apply_config(path, source=None, salt_env='base'):
if path_name.lower() != source_name.lower():
# Append the Source name to the Path
path = '{0}\\{1}'.format(path, source_name)
log.debug('%s appended to the path.', source_name)
log.debug('DSC: %s appended to the path.', source_name)
# Destination path minus the basename
dest_path = os.path.dirname(os.path.normpath(path))
log.info('Caching %s', source)
log.info('DSC: Caching %s', source)
cached_files = __salt__['cp.get_dir'](source, dest_path, salt_env)
if not cached_files:
error = 'Failed to copy {0}'.format(source)
log.error(error)
log.error('DSC: {0}'.format(error))
raise CommandExecutionError(error)
else:
config = os.path.dirname(cached_files[0])
# Make sure the path exists
if not os.path.exists(config):
error = '{0} not found.'.format(config)
log.error(error)
error = '{0} not found'.format(config)
log.error('DSC: {0}'.format(error))
raise CommandExecutionError(error)
# Run the DSC Configuration
# Putting quotes around the parameter protects against command injection
cmd = 'Start-DscConfiguration -Path "{0}" -Wait -Force'.format(config)
ret = _pshell(cmd)
if ret is False:
raise CommandExecutionError('Apply Config Failed: {0}'.format(path))
_pshell(cmd)
cmd = '$status = Get-DscConfigurationStatus; $status.Status'
ret = _pshell(cmd)
log.info('DSC Apply Config: %s', ret)
log.info('DSC: Apply Config: %s', ret)
return ret == 'Success'
return ret == 'Success' or ret == {}
def get_config():
@ -410,15 +415,153 @@ def get_config():
Returns:
dict: A dictionary representing the DSC Configuration on the machine
Raises:
CommandExecutionError: On failure
CLI Example:
.. code-block:: bash
salt '*' dsc.get_config
'''
cmd = 'Get-DscConfiguration | ' \
'Select-Object * -ExcludeProperty Cim*'
return _pshell(cmd)
cmd = 'Get-DscConfiguration | Select-Object * -ExcludeProperty Cim*'
try:
raw_config = _pshell(cmd, ignore_retcode=True)
except CommandExecutionError as exc:
if 'Current configuration does not exist' in exc.info['stderr']:
raise CommandExecutionError('Not Configured')
raise
config = dict()
if raw_config:
# Get DSC Configuration Name
if 'ConfigurationName' in raw_config[0]:
config[raw_config[0]['ConfigurationName']] = {}
# Add all DSC Configurations by ResourceId
for item in raw_config:
config[item['ConfigurationName']][item['ResourceId']] = {}
for key in item:
if key not in ['ConfigurationName', 'ResourceId']:
config[item['ConfigurationName']][item['ResourceId']][key] = item[key]
return config
def remove_config(reset=False):
'''
Remove the current DSC Configuration. Removes current, pending, and previous
dsc configurations.
.. versionadded:: 2017.7.5
Args:
reset (bool):
Attempts to reset the DSC configuration by removing the following
from ``C:\\Windows\\System32\\Configuration``:
- File: DSCStatusHistory.mof
- File: DSCEngineCache.mof
- Dir: ConfigurationStatus
Default is False
.. warning::
``remove_config`` may fail to reset the DSC environment if any
of the files in the ``ConfigurationStatus`` directory. If you
wait a few minutes and run again, it may complete successfully.
Returns:
bool: True if successful
Raises:
CommandExecutionError: On failure
CLI Example:
.. code-block:: bash
salt '*' dsc.remove_config True
'''
# Stopping a running config (not likely to occur)
cmd = 'Stop-DscConfiguration'
log.info('DSC: Stopping Running Configuration')
try:
_pshell(cmd)
except CommandExecutionError as exc:
if exc.info['retcode'] != 0:
raise CommandExecutionError('Failed to Stop DSC Configuration',
info=exc.info)
log.info('DSC: {0}'.format(exc.info['stdout']))
# Remove configuration files
cmd = 'Remove-DscConfigurationDocument -Stage Current, Pending, Previous ' \
'-Force'
log.info('DSC: Removing Configuration')
try:
_pshell(cmd)
except CommandExecutionError as exc:
if exc.info['retcode'] != 0:
raise CommandExecutionError('Failed to remove DSC Configuration',
info=exc.info)
log.info('DSC: {0}'.format(exc.info['stdout']))
if not reset:
return True
def _remove_fs_obj(path):
if os.path.exists(path):
log.info('DSC: Removing {0}'.format(path))
if not __salt__['file.remove'](path):
error = 'Failed to remove {0}'.format(path)
log.error('DSC: {0}'.format(error))
raise CommandExecutionError(error)
dsc_config_dir = '{0}\\System32\\Configuration' \
''.format(os.getenv('SystemRoot', 'C:\\Windows'))
# Remove History
_remove_fs_obj('{0}\\DSCStatusHistory.mof'.format(dsc_config_dir))
# Remove Engine Cache
_remove_fs_obj('{0}\\DSCEngineCache.mof'.format(dsc_config_dir))
# Remove Status Directory
_remove_fs_obj('{0}\\ConfigurationStatus'.format(dsc_config_dir))
return True
def restore_config():
'''
Reapplies the previous configuration.
.. versionadded:: 2017.7.5
.. note::
The current configuration will be come the previous configuration. If
run a second time back-to-back it is like toggling between two configs.
Returns:
bool: True if successfully restored
Raises:
CommandExecutionError: On failure
CLI Example:
.. code-block:: bash
salt '*' dsc.restore_config
'''
cmd = 'Restore-DscConfiguration'
try:
_pshell(cmd, ignore_retcode=True)
except CommandExecutionError as exc:
if 'A previous configuration does not exist' in exc.info['stderr']:
raise CommandExecutionError('Previous Configuration Not Found')
raise
return True
def test_config():
@ -434,9 +577,13 @@ def test_config():
salt '*' dsc.test_config
'''
cmd = 'Test-DscConfiguration *>&1'
ret = _pshell(cmd)
return ret == 'True'
cmd = 'Test-DscConfiguration'
try:
_pshell(cmd, ignore_retcode=True)
except CommandExecutionError as exc:
if 'Current configuration does not exist' in exc.info['stderr']:
raise CommandExecutionError('Not Configured')
raise
def get_config_status():
@ -457,7 +604,12 @@ def get_config_status():
'Select-Object -Property HostName, Status, MetaData, ' \
'@{Name="StartDate";Expression={Get-Date ($_.StartDate) -Format g}}, ' \
'Type, Mode, RebootRequested, NumberofResources'
return _pshell(cmd)
try:
return _pshell(cmd, ignore_retcode=True)
except CommandExecutionError as exc:
if 'No status information available' in exc.info['stderr']:
raise CommandExecutionError('Not Configured')
raise
def get_lcm_config():
@ -639,8 +791,8 @@ def set_lcm_config(config_mode=None,
ret = __salt__['cmd.run_all'](cmd, shell='powershell', python_shell=True)
__salt__['file.remove'](r'{0}\SaltConfig'.format(temp_dir))
if not ret['retcode']:
log.info('LCM config applied successfully')
log.info('DSC: LCM config applied successfully')
return True
else:
log.error('Failed to apply LCM config. Error %s', ret)
log.error('DSC: Failed to apply LCM config. Error %s', ret)
return False

View File

@ -218,7 +218,7 @@ def getent(refresh=False):
refresh (bool):
Refresh the info for all groups in ``__context__``. If False only
the groups in ``__context__`` wil be returned. If True the
the groups in ``__context__`` will be returned. If True the
``__context__`` will be refreshed with current data and returned.
Default is False
@ -469,7 +469,7 @@ def list_groups(refresh=False):
refresh (bool):
Refresh the info for all groups in ``__context__``. If False only
the groups in ``__context__`` wil be returned. If True, the
the groups in ``__context__`` will be returned. If True, the
``__context__`` will be refreshed with current data and returned.
Default is False

View File

@ -44,7 +44,7 @@ def __virtual__():
if not salt.utils.platform.is_windows():
return False, 'Module win_snmp: Requires Windows'
if not __salt__['reg.read_value'](_HKEY, _SNMP_KEY)['success']:
if not __salt__['reg.key_exists'](_HKEY, _SNMP_KEY):
return False, 'Module win_snmp: SNMP not installed'
return __virtualname__

View File

@ -1288,7 +1288,7 @@ def get_pending_servermanager():
key = r'SOFTWARE\Microsoft\ServerManager'
# There are situations where it's possible to have '(value not set)' as
# the value data, and since an actual reboot wont be pending in that
# the value data, and since an actual reboot won't be pending in that
# instance, just catch instances where we try unsuccessfully to cast as int.
reg_ret = __salt__['reg.read_value']('HKLM', key, vname)

View File

@ -131,6 +131,10 @@ def _new_extension(name, value, critical=0, issuer=None, _pyfree=1):
raise salt.exceptions.SaltInvocationError(
'value must be precomputed hash')
# ensure name and value are bytes
name = salt.utils.stringutils.to_bytes(name)
value = salt.utils.stringutils.to_bytes(value)
try:
ctx = M2Crypto.m2.x509v3_set_nconf()
_fix_ctx(ctx, issuer)
@ -316,7 +320,7 @@ def _text_or_file(input_):
'''
if os.path.isfile(input_):
with salt.utils.files.fopen(input_) as fp_:
return salt.utils.stringutils.to_unicode(fp_.read())
return salt.utils.stringutils.to_bytes(fp_.read())
else:
return input_
@ -493,7 +497,7 @@ def get_pem_entry(text, pem_type=None):
ret += pem_body[i:i + 64] + '\n'
ret += pem_footer + '\n'
return ret
return ret.encode('ascii')
def get_pem_entries(glob_path):

View File

@ -2082,7 +2082,7 @@ class Run(LowDataAdapter):
The /run enpoint can also be used to issue commands using the salt-ssh
subsystem.
When using salt-ssh, eauth credentials should not be supplied. Instad,
When using salt-ssh, eauth credentials should not be supplied. Instead,
authentication should be handled by the SSH layer itself. The use of
the salt-ssh client does not require a salt master to be running.
Instead, only a roster file must be present in the salt configuration
@ -2267,7 +2267,7 @@ class Events(object):
very busy and can quickly overwhelm the memory allocated to a
browser tab.
A full, working proof-of-concept JavaScript appliction is available
A full, working proof-of-concept JavaScript application is available
:blob:`adjacent to this file <salt/netapi/rest_cherrypy/index.html>`.
It can be viewed by pointing a browser at the ``/app`` endpoint in a
running ``rest_cherrypy`` instance.

View File

@ -463,6 +463,15 @@ class Pillar(object):
opts['ext_pillar'].append(self.ext)
else:
opts['ext_pillar'] = [self.ext]
if '__env__' in opts['file_roots']:
env = opts.get('pillarenv') or opts.get('saltenv') or 'base'
if env not in opts['file_roots']:
log.debug("pillar environment '%s' maps to __env__ pillar_roots directory", env)
opts['file_roots'][env] = opts['file_roots'].pop('__env__')
else:
log.debug("pillar_roots __env__ ignored (environment '%s' found in pillar_roots)",
env)
opts['file_roots'].pop('__env__')
return opts
def _get_envs(self):

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