salt.modules.salt_version module

Access Salt's elemental release code-names.

New in version Neon.

Salt's feature release schedule is based on the Periodic Table, as described in the Version Numbers documentation.

Since deprecation notices often use the elemental release code-name when warning users about deprecated changes, it can be difficult to build out future-proof functionality that are dependent on a naming scheme that moves.

For example, a state syntax needs to change to support an option that will be removed in the future, but there are many Minion versions in use across an infrastructure. It would be handy to use some Jinja syntax to check for these instances to perform one state syntax over another.

A simple example might be something like the following:

{# a boolean check #}
{% set option_deprecated = salt['salt_version.is_older']("Sodium") %}

{% if option_deprecated %}
  <use old syntax>
{% else %}
  <use new syntax>
{% endif %}
salt.modules.salt_version.get_release_number(name)

Returns the release number of a given release code name in a <year>.<month> context.

If the release name has not been given an assigned release number, the function returns a string. If the release cannot be found, it returns None.

name

The release codename for which to find a release number.

CLI Example:

salt '*' salt_version.get_release_number 'Oxygen'
salt.modules.salt_version.is_equal(name)

Returns a boolean if the named version matches the minion's current Salt version.

name

The release codename to check the version against.

CLI Example:

salt '*' salt_version.is_equal 'Oxygen'
salt.modules.salt_version.is_newer(name)

Returns a boolean if the named version is newer that the minion's current Salt version.

name

The release codename to check the version against.

CLI Example:

salt '*' salt_version.is_newer 'Sodium'
salt.modules.salt_version.is_older(name)

Returns a boolean if the named version is older that the minion's current Salt version.

name

The release codename to check the version against.

CLI Example:

salt '*' salt_version.is_newer 'Sodium'