salt.modules.solarisips

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.solarisips.available_version(name, **kwargs)

This function is an alias of latest_version.

The available version of the package in the repository. In case of multiple match, it returns list of all matched packages. Accepts full or partial FMRI. Please use pkg.latest_version as pkg.available_version is being deprecated.

CLI Example:

salt '*' pkg.latest_version pkg://solaris/entire
salt.modules.solarisips.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.solarisips.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.solarisips.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.solarisips.latest_version(name, **kwargs)

The available version of the package in the repository. In case of multiple match, it returns list of all matched packages. Accepts full or partial FMRI. Please use pkg.latest_version as pkg.available_version is being deprecated.

CLI Example:

salt '*' pkg.latest_version pkg://solaris/entire
salt.modules.solarisips.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.solarisips.list_upgrades(refresh=False, **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.

CLI Example:

salt '*' pkg.list_upgrades
salt '*' pkg.list_upgrades refresh=True
salt.modules.solarisips.normalize_name(name, **kwargs)

Internal function. Normalizes pkg name to full FMRI before running pkg.install. In case of multiple match or no match, it returns the name without modifications and lets the "pkg install" to decide what to do.

CLI Example:

salt '*' pkg.normalize_name vim
salt.modules.solarisips.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.solarisips.refresh_db(full=False)

Updates the remote repos database. You can force the full pkg DB refresh from all publishers regardless the last refresh time.

CLI Example:

salt '*' pkg.refresh_db
salt '*' pkg.refresh_db full=True
salt.modules.solarisips.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.solarisips.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.solarisips.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 also a raw output of "pkg update" command (because if update creates a new boot environment, no immediate changes are visible in "pkg list").

CLI Example:

salt '*' pkg.upgrade
salt.modules.solarisips.upgrade_available(name)

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.solarisips.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.

CLI Example:

salt '*' pkg.version vim
salt '*' pkg.version foo bar baz
salt '*' pkg_resource.version pkg://solaris/entire