# salt.modules.openbsdpkg

Package support for OpenBSD

Note

The package repository is configured on each host using `/etc/installurl` from OpenBSD 6.1 onwards. Earlier releases relied on `/etc/pkg.conf`.

Changed in version 2016.3.5: Package versions on OpenBSD are not normally specified explicitly; instead packages may be available in multiple flavors, and branches which are specified by the format of the package name. This module allows you to use the same formatting as `pkg_add(1)`, and will select the empty flavor and default branch by default. Examples:

    - rsync
    - vim--no_x11
    - ruby%2.3

salt.modules.openbsdpkg.install(name=None, pkgs=None, sources=None, **kwargs)

  Install the passed package

  Return a dict containing the new package names and versions:

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

  CLI Example, Install one package:

      salt '*' pkg.install <package name>

  CLI Example, Install more than one package:

      salt '*' pkg.install pkgs='["<package name>", "<package name>"]'

  CLI Example, Install more than one package from a alternate source (e.g. salt file-server, HTTP, FTP, local filesystem):

      salt '*' pkg.install sources='[{"<pkg name>": "salt://pkgs/<pkg filename>"}]'

salt.modules.openbsdpkg.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 Example:

      salt '*' pkg.latest_version <package name>

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

  List the packages currently installed as a dict:

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

  CLI Example:

      salt '*' pkg.list_pkgs

salt.modules.openbsdpkg.purge(name=None, pkgs=None, **kwargs)

  Remove a package and extra configuration files.

  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.

  New in version 0.16.0.

  Returns a dict containing the changes.

  CLI Example:

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

salt.modules.openbsdpkg.remove(name=None, pkgs=None, purge=False, **kwargs)

  Remove a single package with pkg_delete

  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.

  New in version 0.16.0.

  Returns a dict containing the changes.

  CLI Example:

      salt '*' pkg.remove <package name>
      salt '*' pkg.remove <package1>,<package2>,<package3>
      salt '*' pkg.remove pkgs='["foo", "bar"]'

salt.modules.openbsdpkg.upgrade(name=None, pkgs=None, **kwargs)

  Run a full package upgrade (`pkg_add -u`), or upgrade a specific package if `name` or `pkgs` is provided. `name` is ignored when `pkgs` is specified.

  Returns a dictionary containing the changes:

  New in version 2019.2.0.

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

  CLI Example:

      salt '*' pkg.upgrade
      salt '*' pkg.upgrade python%2.7

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

  Check whether or not an upgrade is available for a given package

  New in version 2019.2.0.

  CLI Example:

      salt '*' pkg.upgrade_available <package name>

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

  Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.

  CLI Example:

      salt '*' pkg.version <package name>
      salt '*' pkg.version <package1> <package2> <package3> ...