salt.modules.solarisipspkg

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

salt.modules.solarisipspkg.available_version(*names, **kwargs)

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

salt.modules.solarisipspkg.get_fmri(name, **kwargs)

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

salt.modules.solarisipspkg.install(name=None, refresh=False, pkgs=None, version=None, test=False, **kwargs)

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:

pkgs

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"]'

salt.modules.solarisipspkg.is_installed(name, **kwargs)

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

salt.modules.solarisipspkg.latest_version(*names, **kwargs)

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

salt.modules.solarisipspkg.list_pkgs(versions_as_list=False, **kwargs)

List the currently installed packages as a dict:

{'<package_name>': '<version>'}

CLI Example:

salt '*' pkg.list_pkgs

salt.modules.solarisipspkg.list_upgrades(refresh=True, **kwargs)

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.

refreshTrue

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

salt.modules.solarisipspkg.normalize_name(name, **kwargs)

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

salt.modules.solarisipspkg.purge(name, **kwargs)

Remove specified package. Accepts full or partial FMRI.

Returns a list containing the removed packages.

CLI Example:

salt '*' pkg.purge <package name>

salt.modules.solarisipspkg.refresh_db(full=False, **kwargs)

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

salt.modules.solarisipspkg.remove(name=None, pkgs=None, **kwargs)

Remove specified package. Accepts full or partial FMRI. In case of multiple match, the command fails and won't modify the OS.

name

The name of the package to be deleted.

Multiple Package Options:

pkgs

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"]'

salt.modules.solarisipspkg.search(name, versions_as_list=False, **kwargs)

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

salt.modules.solarisipspkg.upgrade(refresh=False, **kwargs)

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

salt.modules.solarisipspkg.upgrade_available(name, **kwargs)

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

salt.modules.solarisipspkg.version(*names, **kwargs)

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

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.solarisipspkg.html