salt.modules.pkgutil

Pkgutil support for Solaris

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

Install packages using the pkgutil tool.

CLI 范例:

salt '*' pkg.install <package_name>
salt '*' pkg.install SMClgcc346

Multiple Package Installation Options:

pkgs

A list of packages to install from OpenCSW. Must be passed as a python list.

CLI 范例:

salt '*' pkg.install pkgs='["foo", "bar"]'
salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3"}]'

Returns a dict containing the new package names and versions:

{'<package>': {'old': '<old-version>',
               'new': '<new-version>'}}
salt.modules.pkgutil.latest_version(*names, **kwargs)

Return the latest version of the named package available for upgrade or installation. If more than one package name is specified, a dict of name/version pairs is returned.

If the latest version of a given package is already installed, an empty string will be returned for that package.

CLI 范例:

salt '*' pkgutil.latest_version CSWpython
salt '*' pkgutil.latest_version <package1> <package2> <package3> ...
salt.modules.pkgutil.list_pkgs(versions_as_list=False, **kwargs)

List the packages currently installed as a dict:

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

CLI 范例:

salt '*' pkg.list_pkgs
salt '*' pkg.list_pkgs versions_as_list=True
salt.modules.pkgutil.list_upgrades(refresh=True)

List all available package upgrades on this system

CLI 范例:

salt '*' pkgutil.list_upgrades
salt.modules.pkgutil.purge(name=None, pkgs=None, **kwargs)

Package purges are not supported, this function is identical to remove().

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.

0.16.0 新版功能.

Returns a dict containing the changes.

CLI 范例:

salt '*' pkg.purge <package name>
salt '*' pkg.purge <package1>,<package2>,<package3>
salt '*' pkg.purge pkgs='["foo", "bar"]'
salt.modules.pkgutil.refresh_db()

Updates the pkgutil repo database (pkgutil -U)

CLI 范例:

salt '*' pkgutil.refresh_db
salt.modules.pkgutil.remove(name=None, pkgs=None, **kwargs)

Remove a package and all its dependencies which are not in use by other packages.

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.

0.16.0 新版功能.

Returns a dict containing the changes.

CLI 范例:

salt '*' pkg.remove <package name>
salt '*' pkg.remove <package1>,<package2>,<package3>
salt '*' pkg.remove pkgs='["foo", "bar"]'
salt.modules.pkgutil.upgrade(refresh=True)

Upgrade all of the packages to the latest available version.

Returns a dict containing the changes:

{'<package>': {'old': '<old-version>',
               'new': '<new-version>'}}

CLI 范例:

salt '*' pkgutil.upgrade
salt.modules.pkgutil.upgrade_available(name)

Check if there is an upgrade available for a certain package

CLI 范例:

salt '*' pkgutil.upgrade_available CSWpython
salt.modules.pkgutil.version(*names, **kwargs)

Returns a version if the package is installed, else returns an empty string

CLI 范例:

salt '*' pkgutil.version CSWpython