neulab/tldr huggingface dataset:
Coding style is NEVER grounds to reject code contributions, and is never grounds to talk down to another member of the community (There are no grounds to treat others without respect, especially people working to improve Salt)!
Linting Most Salt style conventions are codified in Salt's .pylintrc file. Salt's linting has two major dependencies: pylint and saltpylint, the full lint requirements can be found under requirements/static/ci/lint.in and the pinned requirements at requirements/static/ci/py3.<minor-version>/lint.txt, however, linting should be done using nox, which is how pull requests are checked.
nox -e lint
One can target either salt's source code or the test suite(different pylint rules apply):
nox -e lint-salt nox -e lint-tests
Variables Variables should be a minimum of three characters and should provide an easy-to-understand name of the object being represented.
When keys and values are iterated over, descriptive names should be used to represent the temporary variables.
Multi-word variables should be separated by an underscore.
Variables which are two-letter words should have an underscore appended to them to pad them to three characters.
Formatting Strings All strings which require formatting should use the .format string method:
Please do NOT use printf formatting, unless it's a log message.
Good:
data = "some text" more = "{} and then some".format(data) log.debug("%s and then some", data)
data = "some text" log.debug("{} and then some".format(data))
Docstring Conventions When adding a new function or state, where possible try to use a versionadded directive to denote when the function, state, or parameter was added.
def new_func(msg=""): """ .. versionadded:: 0.16.0
Prints what was passed to the function.
msg : None The string to be printed. """ print(msg)
If you are uncertain what version should be used, either consult a core developer in IRC or bring this up when opening your pull request and a core developer will let you know what version to add. Typically this will be the next element in the periodic table.
Similar to the above, when an existing function or state is modified (for example, when an argument is added), then under the explanation of that new argument a versionadded directive should be used to note the version in which the new argument was added. If an argument's function changes significantly, the versionchanged directive can be used to clarify this:
def new_func(msg="", signature=""): """ .. versionadded:: 0.16.0
msg : None The string to be printed. Will be prepended with 'Greetings! '.
.. versionchanged:: 0.17.1
signature : None An optional signature.
.. versionadded:: 0.17.0 """ print("Greetings! {0}\n\n{1}".format(msg, signature))
Dictionaries Dictionaries should be initialized using {} instead of dict().
See here for an in-depth discussion of this topic.
Imports Salt code prefers importing modules and not explicit functions. This is both a style and functional preference. The functional preference originates around the fact that the module import system used by pluggable modules will include callable objects (functions) that exist in the direct module namespace. This is not only messy, but may unintentionally expose code python libs to the Salt interface and pose a security problem.
To say this more directly with an example, this is GOOD:
def minion_path(): path = os.path.join(self.opts["cachedir"], "minions") return path
This on the other hand is DISCOURAGED:
from os.path import join
def minion_path(): path = join(self.opts["cachedir"], "minions") return path
The time when this is changed is for importing exceptions, generally directly importing exceptions is preferred:
This is a good way to import exceptions:
from salt.exceptions import CommandExecutionError
Absolute Imports Although absolute imports seems like an awesome idea, please do not use it.  Extra care would be necessary all over salt's code in order for absolute imports to work as supposed. Believe it, it has been tried before and, as a tried example, by renaming salt.modules.sysmod to salt.modules.sys, all other salt modules which needed to import sys would have to also import absolute_import, which should be avoided.
NOTE: An exception to this rule is the absolute_import from __future__ at the top of each file within the Salt project. This import is necessary for Py3 compatibility. This particular import looks like this:
This import is required for all new Salt files and is a good idea to add to any custom states or modules. However, the practice of avoiding absolute imports still applies to all other cases as to avoid a name conflict.
Code Churn Many pull requests have been submitted that only churn code in the name of PEP 8. Code churn is a leading source of bugs and is strongly discouraged.  While style fixes are encouraged they should be isolated to a single file per commit, and the changes should be legitimate, if there are any questions about whether a style change is legitimate please reference this document and the official PEP 8 (‐ https://legacy.python.org/dev/peps/pep-0008/) document before changing code. Many claims that a change is PEP 8 have been invalid, please double check before committing fixes.
Salt code and internals Reference documentation on Salt's internal code.
Contents salt.aggregation salt.utils.aggregation This library makes it possible to introspect dataset and aggregate nodes when it is instructed.
NOTE: The following examples with be expressed in YAML for convenience's sake:
• !aggr-scalar will refer to Scalar python function
• !aggr-map will refer to Map python object
• !aggr-seq will refer for Sequence python object
How to instructs merging This yaml document has duplicate keys:
foo: !aggr-scalar first foo: !aggr-scalar second bar: !aggr-map {first: foo} bar: !aggr-map {second: bar} baz: !aggr-scalar 42
but tagged values instruct Salt that overlapping values they can be merged together:
foo: !aggr-seq [first, second] bar: !aggr-map {first: foo, second: bar} baz: !aggr-seq [42]
Default merge strategy is keep untouched For example, this yaml document still has duplicate keys, but does not instruct aggregation:
foo: first foo: second bar: {first: foo} bar: {second: bar} baz: 42
So the late found values prevail:
foo: second bar: {second: bar} baz: 42
Limitations Aggregation is permitted between tagged objects that share the same type. If not, the default merge strategy prevails.
For example, these examples:
foo: {first: value} foo: !aggr-map {second: value}
bar: !aggr-map {first: value} bar: 42
baz: !aggr-seq [42] baz: [fail]
qux: 42 qux: !aggr-scalar fail
are interpreted like this:
foo: !aggr-map{second: value}
bar: 42
baz: [fail]
qux: !aggr-seq [fail]
Introspection TODO: write this part
class salt.utils.aggregation.Aggregate Aggregation base.
class salt.utils.aggregation.Map Map aggregation.
class salt.utils.aggregation.OrderedDict
salt.utils.aggregation.Scalar(obj) Shortcut for Sequence creation
>>> Scalar('foo') == Sequence(['foo']) True
class salt.utils.aggregation.Sequence(iterable=(), /) Sequence aggregation.
salt.utils.aggregation.aggregate(obj_a, obj_b, level=False, map_class=<class 'salt.utils.aggregation.Map'>, sequence_class=<class 'salt.utils.aggregation.Sequence'>) Merge obj_b into obj_a.
salt.utils.aggregation.levelise(level) Describe which levels are allowed to do deep merging.
level can be:
True   all levels are True
False  all levels are False
an int only the first levels are True, the others are False
a sequence it describes which levels are True, it can be:
• a list of bool and int values
• a string of 0 and 1 characters
salt.utils.aggregation.mark(obj, map_class=<class 'salt.utils.aggregation.Map'>, sequence_class=<class 'salt.utils.aggregation.Sequence'>) Convert obj into an Aggregate instance
Exceptions Salt-specific exceptions should be thrown as often as possible so the various interfaces to Salt (CLI, API, etc) can handle those errors appropriately and display error messages appropriately.
┌────────────────┬──────────────────────────┐ │salt.exceptions │ This module is a central │ │                │ location for all salt    │ │                │ exceptions               │ └────────────────┴──────────────────────────┘
salt.exceptions This module is a central location for all salt exceptions
exception salt.exceptions.ArgumentValueError(message='', info=None) Used when an invalid argument was passed to a command execution
exception salt.exceptions.AuthenticationError(message='') If sha256 signature fails during decryption
exception salt.exceptions.AuthorizationError(message='') Thrown when runner or wheel execution fails due to permissions
exception salt.exceptions.CheckError(message='', info=None) Used when a check fails
exception salt.exceptions.CodePageError(message='', info=None) Raised when an error ocurs while getting or setting the windows code page
exception salt.exceptions.CommandExecutionError(message='', info=None) Used when a module runs a command which returns an error and wants to show the user the output gracefully instead of dying
exception salt.exceptions.CommandNotFoundError(message='') Used in modules or grains when a required binary is not available
exception salt.exceptions.EauthAuthenticationError(message='') Thrown when eauth authentication fails
exception salt.exceptions.FileLockError(message, time_start=None, *args, **kwargs) Used when an error occurs obtaining a file lock
exception salt.exceptions.FileserverConfigError(message='') Used when invalid fileserver settings are detected
exception salt.exceptions.GitLockError(errno, message, *args, **kwargs) Raised when an uncaught error occurs in the midst of obtaining an update/checkout lock in salt.utils.gitfs.
NOTE: While this uses the errno param similar to an OSError, this exception class is not as subclass of OSError. This is done intentionally, so that this exception class can be caught in a try/except without being caught as an OSError.
exception salt.exceptions.GitRemoteError(message='') Used by GitFS to denote a problem with the existence of the "origin" remote or part of its configuration
exception salt.exceptions.InvalidConfigError(message='', info=None) Used when the config is invalid
exception salt.exceptions.InvalidEntityError(message='', info=None) Used when an entity fails validation
exception salt.exceptions.InvalidKeyError(message='') Raised when we encounter an invalid RSA key.
exception salt.exceptions.LoaderError(message='') Problems loading the right renderer
exception salt.exceptions.LoggingRuntimeError Raised when we encounter an error while logging
exception salt.exceptions.MasterExit Rise when the master exits
exception salt.exceptions.MinionError(message='') Minion problems reading uris such as salt:// or http://
exception salt.exceptions.MissingSmb(message='') Raised when no smb library is found.
exception salt.exceptions.NotImplemented(message='') Used when a module runs a command which returns an error and wants to show the user the output gracefully instead of dying
exception salt.exceptions.NxosCliError(message='') NX-OS Cli Error raised when Cli command rejected by the NX-OS device
exception salt.exceptions.NxosClientError(message='') NX-OS Client Error raised for problems connecting to the NX-OS device
exception salt.exceptions.NxosError(message='') NX-OS Base Exception class
exception salt.exceptions.NxosRequestNotSupported(message='') Raised for unsupported client requests
exception salt.exceptions.PkgParseError(message='') Used when of the pkg modules cannot correctly parse the output from the CLI tool (pacman, yum, apt, aptitude, etc)
exception salt.exceptions.PublishError(message='') Problems encountered when trying to publish a command
exception salt.exceptions.SaltCacheError(message='') Thrown when a problem was encountered trying to read or write from the salt cache
exception salt.exceptions.SaltClientError(message='') Problem reading the master root key
exception salt.exceptions.SaltClientTimeout(message, jid=None, *args, **kwargs) Thrown when a job sent through one of the Client interfaces times out
Takes the jid as a parameter
exception salt.exceptions.SaltCloudConfigError(message='') Raised when a configuration setting is not found and should exist.
exception salt.exceptions.SaltCloudException(message='') Generic Salt Cloud Exception
exception salt.exceptions.SaltCloudExecutionFailure(message='') Raised when too much failures have occurred while querying/waiting for data.
exception salt.exceptions.SaltCloudExecutionTimeout(message='') Raised when too much time has passed while querying/waiting for data.
exception salt.exceptions.SaltCloudNotFound(message='') Raised when some cloud provider function cannot find what's being searched.
exception salt.exceptions.SaltCloudPasswordError(message='') Raise when virtual terminal password input failed
exception salt.exceptions.SaltCloudSystemExit(message, exit_code=1) This exception is raised when the execution should be stopped.
exception salt.exceptions.SaltConfigurationError(message='') Configuration error
exception salt.exceptions.SaltDaemonNotRunning(message='') Throw when a running master/minion/syndic is not running but is needed to perform the requested operation (e.g., eauth).
exception salt.exceptions.SaltDeserializationError(message='') Thrown when salt cannot deserialize data.
exception salt.exceptions.SaltException(message='') Base exception class; all Salt-specific exceptions should subclass this
pack() Pack this exception into a serializable dictionary that is safe for transport via msgpack
exception salt.exceptions.SaltInvocationError(message='') Used when the wrong number of arguments are sent to modules or invalid arguments are specified on the command line
exception salt.exceptions.SaltMasterError(message='') Problem reading the master root key
exception salt.exceptions.SaltMasterUnresolvableError(message='') Problem resolving the name of the Salt master
exception salt.exceptions.SaltNoMinionsFound(message='') An attempt to retrieve a list of minions failed
exception salt.exceptions.SaltRenderError(message, line_num=None, buf='', marker=' <======================', trace=None) Used when a renderer needs to raise an explicit error. If a line number and buffer string are passed, get_context will be invoked to get the location of the error.
exception salt.exceptions.SaltReqTimeoutError(message='') Thrown when a salt master request call fails to return within the timeout
exception salt.exceptions.SaltRunnerError(message='') Problem in runner
exception salt.exceptions.SaltSyndicMasterError(message='') Problem while proxying a request in the syndication master
exception salt.exceptions.SaltSystemExit(code=0, msg=None) This exception is raised when an unsolvable problem is found. There's nothing else to do, salt should just exit.
exception salt.exceptions.SaltWheelError(message='') Problem in wheel
exception salt.exceptions.TemplateError(message='') Used when a custom error is triggered in a template
exception salt.exceptions.TimedProcTimeoutError(message='') Thrown when a timed subprocess does not terminate within the timeout, or if the specified timeout is not an int or a float
exception salt.exceptions.TimeoutError(message='') Thrown when an opration cannot be completet within a given time limit.
exception salt.exceptions.TokenAuthenticationError(message='') Thrown when token authentication fails
exception salt.exceptions.VMwareApiError(message='', info=None) Used when representing a generic VMware API error
exception salt.exceptions.VMwareConnectionError(message='', info=None) Used when the client fails to connect to a either a VMware vCenter server or to a ESXi host
exception salt.exceptions.VMwareFileNotFoundError(message='', info=None) Used when representing a generic VMware error if a file not found
exception salt.exceptions.VMwareMultipleObjectsError(message='', info=None) Used when multiple objects were retrieved (and one was expected)
exception salt.exceptions.VMwareNotFoundError(message='', info=None) Used when a VMware object was not found
exception salt.exceptions.VMwareObjectExistsError(message='', info=None) Used when a VMware object already exists
exception salt.exceptions.VMwareObjectNotFoundError(message='', info=None) Used when a VMware object was not found
exception salt.exceptions.VMwareObjectRetrievalError(message='', info=None) Used when a VMware object cannot be retrieved
exception salt.exceptions.VMwarePowerOnError(message='', info=None) Used when error occurred during power on
exception salt.exceptions.VMwareRuntimeError(message='', info=None) Used when a runtime error is encountered when communicating with the vCenter
exception salt.exceptions.VMwareSaltError(message='', info=None) Used when a VMware object cannot be retrieved
exception salt.exceptions.VMwareSystemError(message='', info=None) Used when representing a generic VMware system error
exception salt.exceptions.VMwareVmCreationError(message='', info=None) Used when a configuration parameter is incorrect
exception salt.exceptions.VMwareVmRegisterError(message='', info=None) Used when a configuration parameter is incorrect
salt.exceptions.get_error_message(error) Get human readable message from Python Exception
The Salt Fileserver and Client Introduction 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.
Fileserver The fileserver is not a daemon, so the fileserver and client are not a true server and client in the traditional sense. Instead, the fileserver is simply a class (salt.fileserver.Fileserver), located in salt/fileserver/__init__.py. This class has access to the configured fileserver backends via a loader instance, referenced as self.servers. When a request comes in from the fileclient, it will ultimately result in a Fileserver class function being run.
The functions in this class will run corresponding functions in the configured fileserver backends to perform the requested action. So, in summary:
1. A fileclient class makes a request...
2. which triggers the fileserver to run a function...
3. which runs a named function in each of the configured backends.
Not all of the functions will always execute on every configured backend. For instance, the find_file function in the fileserver will stop when it finds a match, so if it finds a match for the desired path in the first configured backend, it won't proceed and try to find the file in the next backend in the list.
Additionally, not all backends implement all functions in the salt.fileserver.Fileserver class. For instance, there is a function called update, which exists to update remote fileservers such as the git, hg, and svn backends. This action has no use however in the roots backend, so it is simply not implemented there, and thus the roots backend will be skipped if the update function is run on the fileserver.
Backends for the fileserver are located in salt/fileserver/ (the files not named __init__.py).
Fileclient There are three fileclient classes:
salt.fileclient.RemoteClient This client is used when file_client is set to remote. This is how minions request files from the master.
Functions in this client will craft a payload and send it to the master via the transport channel. This is the same way that the minion asks the minion to do other things, such as updating and requesting data from the mine. The payload will be a dictionary with a key called cmd, and other values as needed.
Payloads sent via the transport channel are processed my an MWorker instance on the master, and the MWorker's _handle_aes() function will execute the command. The command will be a function attribute of the salt.master.AESFuncs class. The AESFuncs class' __setup_fileserver() function instantiates a salt.fileserver.Fileserver instance and maps its member functions to AESFuncs attributes. This is what makes the fileserver functions available remotely. The result of the function is returned back through the transport channel to the minion.
Transporting files is done in chunks, the size of which is decided by the file_buffer_size config option. If you look at the serve_file() function in any of the fileserver backends, you can see how the loc value in the payload determines the offset so that an intermediate chunk of the file can be served. The RemoteClient's get_file() function will loop until the end of the file is reached, retrieving one chunk at a time.
salt.fileclient.FSClient This client is used when file_client is set to local. This is how masterless minions request files.
This class inherits from the RemoteClient, but instead of using a transport channel (zmq, tcp, etc.), it uses a "fake" transport channel (salt.fileserver.FSChan), which implements its own send() function. Thus, when a function that the FSClient inherits from the RemoteClient runs self.channel.send(), it's actually calling salt.fileserver.FSChan.send(), which calls corresponding functions in the salt.fileserver.Fileserver() class. The result is that local file requests use the same code as remote file requests, they just bypass sending them through an actual transport channel and instead call them on the FSChan's Fileserver instance.
salt.fileclient.LocalClient This client is now used exclusively by Pillar. This used to be used when file_client was set to local, but the FSChan class was written to allow minions with file_client: local to access the full set of backends. This class will probably be renamed at some point as it is often confused with salt.client.LocalClient.
The cp Module Most of the user-facing interaction with the fileclient happens via the cp module. The functions in this module instantiate a fileclient instance (if one is not already saved to the __context__ dunder) and run fileclient functions.
Updating the Fileserver The master daemon spawns a process dedicated to routine maintenance tasks upon startup. This process runs an instance of salt.master.Maintenance, which loops forever, running a series of functions and then sleeping for a length of time determined by the loop_interval config option. One of the maintenance tasks is to update the fileserver, and it essentially runs salt.fileserver.Fileserver.update(), which as we know from above will run all configured backends' update() functions, if present. This is now remote fileservers like git, hg, and svn stay up-to-date.
For the local file_client (FSClient), since it does not interact with the master, upon spawning of its FSChan it will update the fileserver.
Salt opts dictionary It is very common in the Salt codebase to see opts referred to in a number of contexts.
For example, it can be seen as __opts__ in certain cases, or simply as opts as an argument to a function in others.
Simply put, this data structure is a dictionary of Salt's runtime configuration information that's passed around in order for functions to know how Salt is configured.
When writing Python code to use specific parts of Salt, it may become necessary to initialize a copy of opts from scratch in order to have it available for a given function.
To do so, use the utility functions available in salt.config.
As an example, here is how one might generate and print an options dictionary for a minion instance:
import salt.config
opts = salt.config.minion_config("/etc/salt/minion") print(opts)
To generate and display opts for a master, the process is similar:
opts = salt.config.master_config("/etc/salt/master") print(opts)
Unicode in Salt Though Unicode handling in large projects can often be complex, Salt adheres to several basic rules to help developers handle Unicode correctly.
(For a basic introduction to this problem, see Ned Batchelder's excellent intoroduction to the topic <http://nedbatchelder.com/text/unipain/unipain.html>.
Salt's basic workflow for Unicode handling is as follows:
1. Salt should convert whatever data is passed on CLI/API to Unicode. Internally, everything that Salt does should be Unicode unless it is printing to the screen or writing to storage.
2. Modules and various Salt pluggable systems use incoming data assuming Unicode.
2.1) For Salt modules that query an API; the module should convert the data received from the API into Unicode.
2.2) For Salt modules that shell out to get output; the module should convert data received into Unicode. (This does not apply if using the cmd execution module, which should handle this for you.
2.3) For Salt modules which print directly to the console (not via an outputter) or which write directly to disk, a string should be encoded when appropriate. To handle this conversion, the global variable __salt_system_encoding__ is available, which declares the locale of the system that Salt is running on.
3. When a function in a Salt module returns a string, it should return a unicode type in Python 2.
4. When Salt delivers the data to an outputter or a returner, it is the job of the outputter or returner to encode the Unicode before displaying it on the console or writing it to storage.
Salt Community Projects This page contains links to Salt-related projects created by community members.  If you come across a useful project please add it to the list!
Hubblestack Hubble is a modular, open-source security compliance framework built on top of SaltStack. The project provides on-demand profile-based auditing, real-time security event notifications, automated remediation, alerting and reporting.
https://hubblestack.io/
alkali alkali is a collections of SaltStack states and pillar data that provide just the basics for provisioning Linux instances that may be built upon. alkali is a starter kit of sorts, to help new users to SaltStack get up-and-running quickly with the most commonly used, core packages.
https://github.com/zulily/alkali
buoyant buoyant leverages docker to provide an alternative to VM-centric SaltStack development environments. buoyant containers may be spun up nearly instantly, once an initial docker image has been built.
https://github.com/zulily/buoyant
Salt Sandbox Salt Sandbox is a multi-VM Vagrant-based Salt development environment used for creating and testing new Salt state modules outside of your production environment. It's also a great way to learn firsthand about Salt and its remote execution capabilities.
https://github.com/elasticdog/salt-sandbox
Salt Vagrant Demo A Salt Demo using Vagrant.
https://github.com/UtahDave/salt-vagrant-demo
See the version numbers page for more information about the version numbering scheme.
Latest Branch Release Release Candidate
Previous Releases Salt 3003 Release Notes - Codename Aluminium New Features SCRAM-SHA-256 support for PostgreSQL passwords Support for SCRAM-SHA-256 password hashes has been added to the postgres_user.present and postgres_group.present states. This allows migration away from the insecure and deprecated previous storage methods.
Added • Added "fips_mode" config option to master and minion configs. (#59427)
• Firewall groups support to Vultr Salt Cloud provider
• Adding the ability to clear and show the pillar cache enabled when pillar_cache is True. (#37080)
• SCRAM-SHA-256 support for PostgreSQL passwords.  Pass encrypted=scram-sha-256 to the postgres_user.present (or postgres_group.present) state. (#51271)
• The yumpkg module has been updated to support VMWare's Photon OS, which uses tdnf (a C implementation of dnf).  "VMware Photon OS" has been added to the "RedHat" os_family map as part of this change. (#51912)
• The pkgrepo state now supports VMware Photon OS. (#52550)
• Added firewallgroups to Vultr Salt Cloud provider (#53677)
• Added arbitrary kwarg support for tojson filter. (#56012)
• Add salt monitor beacon to execute salt execution module functions. (#56461)
• Allow the nameservers to be populated from systemd-resolve. (#57618)
• Adding reactor_niceness to the default minion configuration. (#57701)
• CPU model, topology and NUMA node tuning (#57880)
• Added pkg.services_need_restart which lists system services that should be restarted after package management operations. (#58261)
• Allow handling special first boot definition on virtual machine (#58589)
• Added vgcreate custom parameters to module call: addtag, alloc, autobackup, metadatatype, zero (#58747)
• Enhance console and serial support in virt module (#58844)
• Salt's versions report salt --versions-report now includes all installed salt extensions into its versions report. (#58938)
• Support loading entrypoints by passing a module instead of a function. (#58939)
• Added shadow.gen_password for BSD operating systems. (#59140)
• Add more network and PCI/USB host devices passthrough support to virt module and states (#59143)
• Add interface channels management support to rh_ip module. (#59147)
• Add new minion option return_retry_tries for dynamic return retry tries (#59236)
• Added salt-cloud support for Hetzner Cloud via the hcloud library of the provider. (#59301)
• "AlmaLinux" has been added to the "RedHat" os_family map (#59404)
• Added blocks and attachments params to the slack_notify.post_message function (#59428)
• Added tcp_reconnect_backoff minion config option for specifying reconnection backoff time for TCP transport (#59431)
• Added swapusage beacon to complement the existing memusage beacon. (#59460)
• The salt-run CLI now accepts --jid (#59527)
• Add bytes option for FreeBSD pkg-stats(8) module. (#59540)
• Adding mod_beacon function to pkg, service, and file state modules. This function will act similar to the mod_watch function. This will allow supported functions in those state modules to automatically add associated beacons to monitor for changes to the respective resources in the state file and fire events to the event bus when changes occur. (#59559)
• Add -B flag to FreeBSD pkgng.check() to regenerate the library dependency metadata for a package by extracting library requirement information from the binary ELF files in the package. (#59569)
Changed • The pkg module now supports tdnf used by VMWare Photon OS.  As part of this change, VMWare Photon OS's os_family grain will now resolve as RedHat.  This may require changes to existing uses of grains.filter_by
• The salt-run CLI now accepts --jid which allows scripting against it.
• Change brew cask --list to brew list --cask (#58381)
• Store git sha in salt/_version.py when installing from a tag so it can be found if needed later. (#59137)
• Changed package manager detection in yumpkg module (#59201)
• Updating the pkg beacon to fire the events when there are upgrades to packages, but also when watched packages are installed or removed. Breaking out the logic for listing pkgs from context into a separate function to aid in testing. Updating tests to ensure context is not used when use_context option to list_pkgs is False. (#59463)
Removed • Removed the deprecated glance state and execution module in favor of the glance_image state module and the glanceng execution module. (#59079)
• Removing the _ext_nodes deprecation warning and alias to the master_tops function.  This change will break compatibility with a Salt master running versions 2017.7.8 and older and Salt minions running versions 3003 and newer. (#59804)
• removed the arg managed_private_key from 'salt.states.x509.certificate_managed' (#59247)
• Drop support for python 3.5 on Windows (#59479)
• Removed support for Ubuntu 16.04 (#59913)
Deprecated • Added deprecation warning for grains.get_or_set_hash (#59425)
Fixed • When instantiating the loader grab values of grains and pillars if they are NamedLoaderContext instances. (#59773)
• Fixed installation on Apple Silicon Macs by checking $HOMEBREW_PREFIX for libcrypto instead of assuming /usr/local. (#59808)
• The Google Cloud Engine salt-cloud provider now requires apache-libcloud>=2.5.0. Service account authentication is broken on older versions.
• Fix incorrect documentation for pillar_source_merging_strategy (#26396)
• Don't iterate through cloud map errors (#34033)
• Supress noisy warnings when very old pyzmq is used. (#50327)
• Fixed glusterfs version parsing for pre-4.0 (#50707)
• Prevent traceback when trying to list reactors when none are configured. (#53334)
• Fixed zabbix_host.present to accept all Zabbix host properties (#53838)
• Binaries for the salt installer package for OSX are now signed and the installer package is notarized (#54513)
• Guard boto3_elasticsearch loading properly (#55848)
• Use a capitalized string version of the value of NodeState instead (#56589)
• Adding missing error case to the validation for service beacon. (#56623)
• The GCE cloud driver only works with apache-libcloud>=2.5.0, prior versions have authentication issues (#56862)
• zypperpkg add_lock and remove_lock examples do not work (#56922)
• Compare bytes to bytes so we don't overwrite a correct value (#57212)
• Fixing expand_repo_def in aptpkg module to include the architecture in the line attribute when it is passed in. (#57600)
• When passing arguments pass them as keyword arguments so that we can be sure the right value is going where. (#58006, #58579, #59075)
• Improve module whitelist logic for file backends (#58041)
• Fix behavior for "onlyif/unless" state conditionals when multiple declarations (#58085)
• Ensure data is a valid keyword argument for the event.wait function. (#58182)
• Do not raise "StreamClosedError" traceback on the master logs but only log it (#58301)
• Fixed issue with win_timezone when dst is turned off. This was causing the minion not to start Use default timezone offset in scheduler when correct timezone cannot be determined (#58379)
• Pop!_OS 20.04 and 20.10 now support using pkg.* / aptpkg.* (#58395)
• Restoring functionallity of the textfsm module when using textfsm_path argument (#58499)
• Invalidate file list cache when cache file has a future last modified time (#58529)
• Fix issue with setting permissions in combination with the win_perms_reset option (#58541)
• Adds support for Powershell 7. It is specified by passing shell="pwsh". Only valid if Powershell 7 is installed on the system. (#58598)
• Fixed the zabbix.host_create call on zabbix_host.present to include the optional parameter visible_name. Now working as documented. (#58602)
• Fixed some bugs to allow zabbix_host.present to update a host already existent on Zabbix server:
• Added checks before "pop" the elements "bulk" and "details" from hostinterfaces_get's response. Without that, the interface comparison didn't works with Zabbix >= 5.0
• Fixed the "inventory" comparison. It failed when both current and new inventory were missing.
• Rewrite of the update_interfaces routine to really "update" the interfaces and not trying to delete and recreate all interfaces, which almost always gives errors as interfaces with linked items can't be deleted. (#58603)
• Added the "details" mandatory object with the properly default values when creating a SNMP hostinterface in Zabbix 5.0 (#58620)
• Fixing an issue preventing running pillar.get against pillar values with integers as pillar keys. (#58714)
• Adding a new option to pass client_flags to MySQL connections, for example passing the option to support multiple statements in queries. (#58718)
• Fixed two performance bugs in the sysctl.present state.  Their impact is especially great on FreeBSD machines with large amounts of RAM. (#58732)
• Fixed an issue when pillar files are included in the top.sls and then later included in another pillar file. (#58736)
• Left over py2 code was causing windows encoding to misbehave (#58749)
• Return result=None from module.run state to indicate that changes would be made Return result=False from module.run state when called with no functions (#58752)
• Fix duplicate IP addresses in fqdn_ip4 and fqdn_ip6 grains (#58799)
• Rename salt.renderers.toml to salt.renderers.tomlmod which fixes the import error issues as described in #58822 Do note that, the renderer is still called toml. (#58822)
• Fixing unhold in yumpkg. Removing unnecessary code and relying on the code that handles dicts later. Adding tests when pkg.installed is called with hold=False. (#58883)
• Converts the given "grant" to upper case before compare to "ALL".  This fixes a problem granting "all privileges" to a MySQL user. (#58933)
• Strip trailing "/" from repo.uri when comparing repos in "apktpkg.mod_repo" (#58962)
• When we are checking requisites, run reconcile_procs just on those requisite states not all running states. (#58976)
• Allow the gpg module to use export_key, delete_key and create_key without a passphrase in GnuPG >= 2.1 (#58980)
• Updated the documentation, handling and error messages for what size units are allowed by "size" parameter in lvm.lv_present (#58985)
• Fixing the two failing tests when running on Photon OS. Python 3 installed on Photon OS does not support MD4 hashing, so don't load pdbedit module and skip the test_generate_nt_hash test. Default unmask for files and directories results in them having only user and group permissions so update the test_directory_max_depth test. (#58991)
• Fixes to netmiko module and proxy module to handle situations where the device is unreachable during the initial connection phase. (#59011)
• Correct comment when updating postrges users and groups.  Errors reported when removing postgres groups.  Partial group membership changes in postgres groups. (#59034)
• Fixed an error when running svn.latest in test mode and using the trust_failures option. (#59069)
• Fixes to storing schedule items in pillar, when refreshing pillar only update the schedule items if something has changed. (#59104)
• Fixed timezone module to work in Slackware Linux (#59130)
• Enforces pywinrm to be version 0.3.0 or higher and upgrade to latest (#59138)
• Fix a race condition in the ldx module which sometimes caused devices not to be created during container creation. (#59145)
• Fix issue where passed smb port was being passed to the smb connection when deploying Windows with salt-cloud (#59153)
• Fixed an error when running on CentOS Stream 8. (#59161)
• Fix event publish retry when using TCP transport (#59162)
• Fix docs for auth_timeout (#59175)
• virt.update doesn't update the definition if efi=True and a loader is already set (#59188)
• Fixed salt.modules.solaris_shadow failing on bytes-like object is require, not 'str'. (#59191)
• Added support for io2 volumes in ec2 cloud (#59218)
• When checking if the mode had changed in the file state module, only do so if the passed mode is not None. (#59276)
• Fixing _sanitze_comments to use sqlparse instead of re.sub. (#59336)
• Allow use of query parameters in cmd.script source url (#59362)
• Access user from global group if local group fails to find user. (#59412)
• Detect and fix grub.xen path (#59484)
• Stop raising StopIteration on generators (#59512)
• Fix minion race conditions handling SIGTERM signal when loading modules (#59524)
• Support new output of systemd systemctl list-unit-files in the following modules systemd_service.get_enabled, systemd_service.get_disabled and systemd_service.get_static (#59526)
• Fix pkg.upgrade with -U arg on FreeBSD, -L flag was deprecated long time. (#59565)
• Fixing the virtual function for the netimiko module to allow it to run outside of a proxy minion. Adding additional tests. (#59635)
• Allow "extra_filerefs" as sanitized kwargs for SSH client.  Fix regression on "cmd.run" when passing tuples as cmd. (#59664)
Salt 3003.1 Release Notes Version 3003.1 is a bug fix release for 3003.
Fixed • Fixed race condition in batch logic. Added listen option to LocalClient to prevent event subscriber from purging cached events during batch iteration. (#56273)
• Fixed dependencies for Amazon Linux 2 on https://repo.saltproject.io since Amazon Linux 2 now provides some of the python libraries in their repos. (#59982)
• IPCMessageSubscriber objects expose their connect method as a coroutine so they can be wrapped by SyncWrapper. (#60049)
• Import salt.utils.azurearm instead of using __utils__ from loader in azure cloud.  This fixes an issue where __utils__ would become unavailable when we are using the ThreadPool in azurearm. (#59744)
• Use contextvars libary from site-packages if it is intalled. Fixes salt ssh for targets with python <=3.6 (#59942)
• Add back support to load old entrypoints by iterating instead of type checking (#59961)
• Pass the value of the __grains__ NamedContext to salt.pillar.get_pillar, instead of the NamedContext object itself. (#59975)
• Fix pillar serialization in jinja templates (#60083)
Salt 3003.2 Release Notes Version 3003.2 is a bug fix release for 3003.
Fixed • Periodically restart the fileserver update process to avoid leaks (#50313)
• Add ssh_timeout to kwargs in deploy_script (#59901)
• Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5. (#60168)
• Use the right crypto libary for salt.utils.crypt.reinit_crypto (#60215)
• Stop SSH from hanging if connection is lost. Also added args to customize grace period. (#60216)
• Improve reliability of Terminal class (#60504)
• Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper, assume False (#60529)
Salt 3003.3 (2021-08-20) Version 3003.3 is a CVE security fix release for 3003.
Fixed • Fix issue introduced in https://github.com/saltstack/salt/pull/59648 (#60046)
Security • Verify the owner of an existing config before trusting it during install. If the owner cannot be verified, back it up and use defaults. (CVE-2021-22004)
• Ensure that sourced file is cached using its hash name (cve-2021-21996)
Salt 3002 Release Notes - Codename Magnesium New Features Network Teaming Support Added (RHEL/CentOS) Support for two new interface types (team and teamport) has been added to the network.managed state. See the documentation for example usage.
Execution Module Changes The ip.get_bond and ip.build_bond functions have been removed from the ip module for RHEL/CentOS. Configuring bonding opts in modprobe configurations has not been necessary since RHEL 4, and Salt was in fact redundantly both creating modprobe configurations and using the BONDING_OPTS interface configuration parameter.
Removed • removed boto_vpc.describe_route_table please use boto_vpc.describe_route_tables (#58636)
• removed show_ipv4 arg from all functions in from salt.runners.manage (#58638)
• removed kwargs from mandrill.send if you use "async" please use "asynchronous" (#58640)
• removed salt/modules/mac_brew_pkg.__fix_cask_namespace (#58641)
• zfs.mount Passing '-a' as name is deprecated please just pass 'None' (#58642)
• Remove include_localhost kwarg for connected_ids method in salt/utils/minions.py (#58224)
• deprecated opts default argument of none and removed deprecation warnings (#58635)
Deprecated • The ssh parameter of virt.migrate has been deprecated. Use a libvirt URI target value instead. Both virt.migrate_non_shared and virt.migrate_non_shared_inc have been deprecated. Use the copy_storage parameter with virt.migrate instead. (#57947)
Changed • Allow to specify a custom port for Proxmox connection (#50620)
• Changed the lvm.lv_present state to accept a resizefs switch. So, when the logical volume is resized, the filesystem will be resized too. (#55265)
• Change the enable_fqdns_grains setting to default to False on proxy minions as it is generally not needed and just slows down start up time.. (#57676)
• Adds network teaming support to network.managed state for RHEL-based distros. Removes ip.get_bond and ip.build_bond for the same, as is redundant and not needed for any current RHEL/CentOS/Fedora/etc. release. (#57775)
• The serializer argument has been added to the file.serialize state, as an alternative to formatter. This brings it more in line with the serializer_opts and deserializer_opts arguments. formatter is still supported, but using both serializer and formatter will cause the state to fail. (#57858)
Fixed • file.read exec module function no longer fails on binary data. (#58033)
• Remove py2 support from winrepo execution module and runner (#58596)
• Create ini file if does not exist when using ini.options_present state module. (#34236)
• Added an bool "strict" argument to sdb.get module to force module to fail if the sdb uri is not correct. (#39163)
• Fixed issue with postgres.has_privilege breaking on ALL. (#48465)
• check for azurearm username in config before adding username and password to the virtual machine properties (#49063)
• Fixes service.status to return True/False instead of empty strings or PIDs of the service. This brings macOS into parity with the other service modules. (#49237)
• fix frequent rest_tornado non-fatal tracebacks (#49572)
• Do not use reverse DNS of the target used in salt-ssh. Use the target the user provides. (#49840)
• Fixes startup issue where it tried to load the kernalparams grain on Windows (#49901)
• Fixed error in nilrt_ip.get_interfaces_details when loading config. (#50416)
• Doesn't remove underscore when sanitizing hostname in network salt util (#50527)
permit the use of int/float type for the version in:
• the state postgres_cluster.present
• the state postgres_cluster.absent
• the module postgres.cluster_create
• the module postgres.cluster_remove (#50899)
• Cleaned up a trackback in lvm.pv_present when the disk doesn't exist. (#52363)
• Fixed UnboundLocalError when using win_network.connect (#53371)
• Add accept_ra 2 option to modules.debian_ip (#54067)
• salt.runner test mode support (#54382)
• Fixed mkpart to allow the creation of a partition without filesystem (#54456)
• Fixes bogus warning message when an empty list is used for an environment in a topfile. This allows [] to be used as a placeholder in a topfile without needing to comment everything out as a workaround. (#54882)
• win_certutil state will no longer fail on non-English systems upon successful additions and deletions of a certificate. (#55024)
• Fixed file.directory state always showing mode change for symlinks. (#55878)
• check for a docker error that the swarm already exists when calling swarm.swarm_init on an existing docker swarm (#55949)
• Fixing stalekey engine so it deletes the keys when they are a list. (#55977)
• An invalid _schedule.conf configuration file is renamed to _schedule.confYAMLError.  This avoids disabling the minion and busy polling the CPU on Windows. (#56216, #58177)
• Proper calculation of tpldir and related context parameters (#56410)
• Make gpg.encrypt examples work (#56646)
• Artifactory encoding of headers fixed for py3 (#56660)
• Fixed handling of extents extended attribute in file.managed state. (#57189)
• Remove buggy start parameter from virt.pool_running docstring (#57275)
• Fixed saltcheck rendering of map.jinja files from saltenv (#57327)
• Fix for virt.get_profiles resolves an error that appears due to new parameters introduced with _disk_profile() (#57431)
• Accept nested namespaces in spacewalk.api runner function. (#57442)
• virt.init fix the disk target names (#57477)
• Fix volume name for disk-typed pools in virt.defined (#57497)
• Fixes an issue with filesystems options ordering which kept already applied NFS fstab entries being updated. (#57520)
• Do not allow python2 to be added to salt-ssh tar since Salt deprecated Python 2. (#57647)
• Fixed exception on loading custom zipped modules. (#57674)
• corrected support for app_id or local vault configurations (#57705)
• Fix the registration of libvirt pool and nodedev events (#57746)
• Pass cmd.run state arguments to unless and onlyif when they exist (#57760)
• The 2004 release of Windows 10 introduced a bug in the InstallationBehavior COM object where you can no longer get properties from that object. Calls to this object are now wrapped in a try/except block with sane defaults when it fails to read attributes.
Additionally, some pre-flight checks have been added to the win_wua module to make sure Windows Update can actually run. (#57762)
• Changed get_repo in yumpkg.py to use "repo" as first parameter.  This fixes #57778, a bug were every run of pkgrepo.managed state were marked as changed because the get_repo did fail to detect a previously applied run. (#57778)
• Raise SaltClientError in parse_host_port insted of ValueError so it is caught and handled properly when the minion is connecting to the master. (#57789)
• Fixed issue with the return dictionary from the workgroup() function in the salt.states.win_system module. This resulted in a windows-based minion logging an error and could also interfere with a highstate being applied. (#57790)
• Fixes broken block_device_mapping and block_device_mapping_v2 type checks in the OpenStack cloud driver. Salt was looking for a dict and the shade library was looking for a list of dicts. This made it impossible to use those params. (#57802)
• Fixed incorrect parsing of Set-Cookie response headers. (#57829)