Support for rpm

salt.modules.rpm_lowpkg.bin_pkg_info(path, saltenv='base')

New in version 2015.8.0.

Parses RPM metadata and returns a dictionary of information about the package (name, version, etc.).


Path to the file. Can either be an absolute path to a file on the minion, or a salt fileserver URL (e.g. salt://path/to/file.rpm). If a salt fileserver URL is passed, the file will be cached to the minion so that it can be examined.


Salt fileserver envrionment from which to retrieve the package. Ignored if path is a local file path on the minion.

CLI Example:

salt '*' lowpkg.bin_pkg_info /root/salt-2015.5.1-2.el7.noarch.rpm
salt '*' lowpkg.bin_pkg_info salt://salt-2015.5.1-2.el7.noarch.rpm

Return if the signature of a RPM file is valid.

CLI Example:

salt '*' lowpkg.checksum /path/to/package1.rpm
salt '*' lowpkg.checksum /path/to/package1.rpm /path/to/package2.rpm
salt.modules.rpm_lowpkg.diff(package_path, path)

Return a formatted diff between current file and original in a package. NOTE: this function includes all files (configuration and not), but does not work on binary content.

  • package -- Full pack of the RPM file

  • path -- Full path to the installed file


Difference or empty string. For binary files only a notification.

CLI example:

salt '*' lowpkg.diff /path/to/apache2.rpm /etc/apache2/httpd.conf

List the files that belong to a package, sorted by group. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended).

CLI Examples:

salt '*' lowpkg.file_dict httpd
salt '*' lowpkg.file_dict httpd postfix
salt '*' lowpkg.file_dict

List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's rpm database (not generally recommended).

CLI Examples:

salt '*' lowpkg.file_list httpd
salt '*' lowpkg.file_list httpd postfix
salt '*' lowpkg.file_list*packages, **kwargs)

Return a detailed package(s) summary information. If no packages specified, all packages will be returned.

  • packages --

  • attr --

    Comma-separated package attributes. If no 'attr' is specified, all available attributes returned.

    Valid attributes are:

    version, vendor, release, build_date, build_date_time_t, install_date, install_date_time_t, build_host, group, source_rpm, arch, epoch, size, license, signature, packager, url, summary, description.

  • all_versions -- Return information for all installed versions of the packages


CLI example:

salt '*' apache2 bash
salt '*' apache2 bash attr=version
salt '*' apache2 bash attr=version,build_date_iso,size
salt '*' apache2 bash attr=version,build_date_iso,size all_versions=True

List the packages currently installed in a dict:

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

CLI Example:

salt '*' lowpkg.list_pkgs
salt.modules.rpm_lowpkg.modified(*packages, **flags)

List the modified files that belong to a package. Not specifying any packages will return a list of _all_ modified files on the system's RPM database.

New in version 2015.5.0.

CLI examples:

salt '*' lowpkg.modified httpd
salt '*' lowpkg.modified httpd postfix
salt '*' lowpkg.modified

Return the name of the package that owns the file. Multiple file paths can be passed. If a single path is passed, a string will be returned, and if multiple paths are passed, a dictionary of file/package name pairs will be returned.

If the file is not owned by a package, or is not present on the minion, then an empty string will be returned for that path.

CLI Examples:

salt '*' lowpkg.owner /usr/bin/apachectl
salt '*' lowpkg.owner /usr/bin/apachectl /etc/httpd/conf/httpd.conf
salt.modules.rpm_lowpkg.verify(*packages, **kwargs)

Runs an rpm -Va on a system, and returns the results in a dict

Files with an attribute of config, doc, ghost, license or readme in the package header can be ignored using the ignore_types keyword argument

CLI Example:

salt '*' lowpkg.verify
salt '*' lowpkg.verify httpd
salt '*' lowpkg.verify httpd postfix
salt '*' lowpkg.verify httpd postfix ignore_types=['config','doc']
salt.modules.rpm_lowpkg.version_cmp(ver1, ver2, ignore_epoch=False)

New in version 2015.8.9.

Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison.


Set to True to ignore the epoch when comparing versions

New in version 2015.8.10,2016.3.2.

CLI Example:

salt '*' pkg.version_cmp '0.2-001' ''