salt.modules.rpm

Support for rpm

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

2015.8.0 新版功能.

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

path
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.
saltenv : base
Salt fileserver envrionment from which to retrieve the package. Ignored if path is a local file path on the minion.

CLI 范例:

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
salt.modules.rpm.diff(package, 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 -- The name of the package
  • path -- Full path to the installed file
返回:

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

CLI example:

salt '*' lowpkg.diff apache2 /etc/apache2/httpd.conf
salt.modules.rpm.file_dict(*packages)

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范例:

salt '*' lowpkg.file_dict httpd
salt '*' lowpkg.file_dict httpd postfix
salt '*' lowpkg.file_dict
salt.modules.rpm.file_list(*packages)

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范例:

salt '*' lowpkg.file_list httpd
salt '*' lowpkg.file_list httpd postfix
salt '*' lowpkg.file_list
salt.modules.rpm.info(*packages, **attr)

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.
返回:

CLI example:

salt '*' lowpkg.info apache2 bash
salt '*' lowpkg.info apache2 bash attr=version
salt '*' lowpkg.info apache2 bash attr=version,build_date_iso,size
salt.modules.rpm.list_pkgs(*packages)

List the packages currently installed in a dict:

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

CLI 范例:

salt '*' lowpkg.list_pkgs
salt.modules.rpm.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.

2015.5.0 新版功能.

CLI examples:

salt '*' lowpkg.modified httpd
salt '*' lowpkg.modified httpd postfix
salt '*' lowpkg.modified
salt.modules.rpm.owner(*paths)

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范例:

salt '*' lowpkg.owner /usr/bin/apachectl
salt '*' lowpkg.owner /usr/bin/apachectl /etc/httpd/conf/httpd.conf
salt.modules.rpm.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 范例:

salt '*' lowpkg.verify
salt '*' lowpkg.verify httpd
salt '*' lowpkg.verify httpd postfix
salt '*' lowpkg.verify httpd postfix ignore_types=['config','doc']