IPS pkg support for Solaris
Important
If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to 'pkg.install' is not available), see here.
This module provides support for Solaris 11 new package management - IPS (Image Packaging System). This is the default pkg module for Solaris 11 (and later).
If you want to use also other packaging module (e.g. pkgutil) together with IPS, you need to override the pkg
provider
in sls for each package:
mypackage:
pkg.installed:
- provider: pkgutil
Or you can override it globally by setting the providers
parameter in your Minion config file like this:
providers:
pkg: pkgutil
Or you can override it globally by setting the providers
parameter in your Minion config file like this:
providers:
pkg: pkgutil
This function is an alias of latest_version
.
The available version of packages in the repository. Accepts full or partial FMRI. Partial FMRI is returned if the full FMRI could not be resolved.
If the latest version of a given package is already installed, an empty string will be returned for that package.
Please use pkg.latest_version as pkg.available_version is being deprecated.
Changed in version 2019.2.0: Support for multiple package names added.
CLI Example:
salt '*' pkg.latest_version bash salt '*' pkg.latest_version pkg://solaris/entire salt '*' pkg.latest_version postfix sendmail
Returns FMRI from partial name. Returns empty string ('') if not found. In case of multiple match, the function returns list of all matched packages.
CLI Example:
salt '*' pkg.get_fmri bash
Install the named package using the IPS pkg command. Accepts full or partial FMRI.
Returns a dict containing the new package names and versions:
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
Multiple Package Installation Options:
A list of packages to install. Must be passed as a python list.
CLI Example:
salt '*' pkg.install vim
salt '*' pkg.install pkg://solaris/editor/vim
salt '*' pkg.install pkg://solaris/editor/vim refresh=True
salt '*' pkg.install pkgs='["foo", "bar"]'
Returns True if the package is installed. Otherwise returns False. Name can be full or partial FMRI. In case of multiple match from partial FMRI name, it returns True.
CLI Example:
salt '*' pkg.is_installed bash
The available version of packages in the repository. Accepts full or partial FMRI. Partial FMRI is returned if the full FMRI could not be resolved.
If the latest version of a given package is already installed, an empty string will be returned for that package.
Please use pkg.latest_version as pkg.available_version is being deprecated.
Changed in version 2019.2.0: Support for multiple package names added.
CLI Example:
salt '*' pkg.latest_version bash
salt '*' pkg.latest_version pkg://solaris/entire
salt '*' pkg.latest_version postfix sendmail
List the currently installed packages as a dict:
{'<package_name>': '<version>'}
CLI Example:
salt '*' pkg.list_pkgs
Lists all packages available for update.
When run in global zone, it reports only upgradable packages for the global zone.
When run in non-global zone, it can report more upgradable packages than
pkg update -vn
, because pkg update
hides packages that require
newer version of pkg://solaris/entire
(which means that they can be
upgraded only from the global zone). If pkg://solaris/entire
is found
in the list of upgrades, then the global zone should be updated to get all
possible updates. Use refresh=True
to refresh the package database.
Runs a full package database refresh before listing. Set to False
to
disable running the refresh.
Changed in version 2017.7.0.
In previous versions of Salt, refresh
defaulted to False
. This was
changed to default to True
in the 2017.7.0 release to make the behavior
more consistent with the other package modules, which all default to True
.
CLI Example:
salt '*' pkg.list_upgrades
salt '*' pkg.list_upgrades refresh=False
Internal function. Normalizes pkg name to full FMRI before running pkg.install. In case of multiple matches or no match, it returns the name without modifications.
CLI Example:
salt '*' pkg.normalize_name vim
Remove specified package. Accepts full or partial FMRI.
Returns a list containing the removed packages.
CLI Example:
salt '*' pkg.purge <package name>
Updates the remote repos database.
full : False
Set to
True
to force a refresh of the pkg DB from all publishers, regardless of the last refresh time.
CLI Example:
salt '*' pkg.refresh_db
salt '*' pkg.refresh_db full=True
Remove specified package. Accepts full or partial FMRI. In case of multiple match, the command fails and won't modify the OS.
The name of the package to be deleted.
Multiple Package Options:
A list of packages to delete. Must be passed as a python list. The
name
parameter will be ignored if this option is passed.
Returns a list containing the removed packages.
CLI Example:
salt '*' pkg.remove <package name>
salt '*' pkg.remove tcsh
salt '*' pkg.remove pkg://solaris/shell/tcsh
salt '*' pkg.remove pkgs='["foo", "bar"]'
Searches the repository for given pkg name. The name can be full or partial FMRI. All matches are printed. Globs are also supported.
CLI Example:
salt '*' pkg.search bash
Upgrade all packages to the latest possible version. When run in global zone, it updates also all non-global zones. In non-global zones upgrade is limited by dependency constrains linked to the version of pkg://solaris/entire.
Returns a dictionary containing the changes:
{'<package>': {'old': '<old-version>',
'new': '<new-version>'}}
When there is a failure, an explanation is also included in the error
message, based on the return code of the pkg update
command.
CLI Example:
salt '*' pkg.upgrade
Check if there is an upgrade available for a certain package Accepts full or partial FMRI. Returns all matches found.
CLI Example:
salt '*' pkg.upgrade_available apache-22
Common interface for obtaining the version of installed packages. Accepts full or partial FMRI. If called using pkg_resource, full FMRI is required. Partial FMRI is returned if the package is not installed.
CLI Example:
salt '*' pkg.version vim
salt '*' pkg.version foo bar baz
salt '*' pkg_resource.version pkg://solaris/entire