Sha256: 3207f4afb041d1c2dca864da47e65bf2aa7be18cbb36a5ccb3df21f44f36db67
Contents?: true
Size: 1.14 KB
Versions: 5
Compression:
Stored size: 1.14 KB
Contents
require 'open3' require 'wright/provider' require 'wright/provider/package' module Wright class Provider class Package # Yum package provider. Used as a provider for # {Resource::Package} on Fedora-based systems. class Yum < Wright::Provider::Package # @return [Array<String>] the installed package versions def installed_versions version_format = '%{VERSION}-%{RELEASE}' rpm_args = %W(-q #{package_name} --qf #{version_format}) stdout, _, status = Open3.capture3(env, 'rpm', *rpm_args) status.success? ? [stdout] : [] end private def install_package yum(:install, package_options, package_name, package_version) end def remove_package yum(:remove, package_options, package_name) end def yum(action, options, package, version = nil) cmd = 'yum' package_version = version.nil? ? '' : "-#{version}" args = [*options, action.to_s, '-y', package + package_version] exec_or_fail(cmd, args, "cannot #{action} package '#{package}'") end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems