diff options
author | Stuart Preston <stuart@chef.io> | 2018-06-20 14:26:32 +0100 |
---|---|---|
committer | Stuart Preston <stuart@chef.io> | 2018-06-20 14:26:32 +0100 |
commit | eaac3e8f2fb695b47cde9b595e87d83e3b23d984 (patch) | |
tree | 42455e9b395ecc14fc7f3aaa9f875abefd620cbf /lib/chef/provider/package | |
parent | 08bd853e9fe52a92c310e1ff2a5171324998b593 (diff) | |
parent | f960c7f3b7c58c80a2e104ed631d97190b272b4e (diff) | |
download | chef-eaac3e8f2fb695b47cde9b595e87d83e3b23d984.tar.gz |
Merge branch 'master' into sp/ffi-powershell
Signed-off-by: <>
Diffstat (limited to 'lib/chef/provider/package')
23 files changed, 91 insertions, 91 deletions
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb index b644848442..f245e481a3 100644 --- a/lib/chef/provider/package/apt.rb +++ b/lib/chef/provider/package/apt.rb @@ -81,7 +81,7 @@ class Chef def locked_packages @locked_packages ||= begin - locked = shell_out_compact!("apt-mark", "showhold") + locked = shell_out!("apt-mark", "showhold") locked.stdout.each_line.map do |line| line.strip end @@ -140,9 +140,9 @@ class Chef # # @return [Integer] 1 if v1 > v2. 0 if they're equal. -1 if v1 < v2 def version_compare(v1, v2) - if !shell_out_compact("dpkg", "--compare-versions", v1.to_s, "gt", v2.to_s).error? + if !shell_out("dpkg", "--compare-versions", v1.to_s, "gt", v2.to_s).error? 1 - elsif !shell_out_compact("dpkg", "--compare-versions", v1.to_s, "eq", v2.to_s).error? + elsif !shell_out("dpkg", "--compare-versions", v1.to_s, "eq", v2.to_s).error? 0 else -1 @@ -153,7 +153,7 @@ class Chef # interactive prompts. Command is run with default localization rather # than forcing locale to "C", so command output may not be stable. def run_noninteractive(*args) - shell_out_compact!(*args, env: { "DEBIAN_FRONTEND" => "noninteractive" }) + shell_out!(*args, env: { "DEBIAN_FRONTEND" => "noninteractive" }) end def default_release_options diff --git a/lib/chef/provider/package/bff.rb b/lib/chef/provider/package/bff.rb index 256a1499eb..652fad447b 100644 --- a/lib/chef/provider/package/bff.rb +++ b/lib/chef/provider/package/bff.rb @@ -49,7 +49,7 @@ class Chef if package_source_found? logger.trace("#{new_resource} checking pkg status") - ret = shell_out_compact("installp", "-L", "-d", new_resource.source) + ret = shell_out("installp", "-L", "-d", new_resource.source) ret.stdout.each_line do |line| case line when /:#{new_resource.package_name}:/ @@ -65,7 +65,7 @@ class Chef end logger.trace("#{new_resource} checking install state") - ret = shell_out_compact("lslpp", "-lcq", current_resource.package_name) + ret = shell_out("lslpp", "-lcq", current_resource.package_name) ret.stdout.each_line do |line| case line when /#{current_resource.package_name}/ @@ -85,7 +85,7 @@ class Chef def candidate_version return @candidate_version if @candidate_version if package_source_found? - ret = shell_out_compact("installp", "-L", "-d", new_resource.source) + ret = shell_out("installp", "-L", "-d", new_resource.source) ret.stdout.each_line do |line| case line when /\w:#{Regexp.escape(new_resource.package_name)}:(.*)/ @@ -112,10 +112,10 @@ class Chef def install_package(name, version) logger.trace("#{new_resource} package install options: #{options}") if options.nil? - shell_out_compact!("installp", "-aYF", "-d", new_resource.source, new_resource.package_name) + shell_out!("installp", "-aYF", "-d", new_resource.source, new_resource.package_name) logger.trace("#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}") else - shell_out_compact!("installp", "-aYF", options, "-d", new_resource.source, new_resource.package_name) + shell_out!("installp", "-aYF", options, "-d", new_resource.source, new_resource.package_name) logger.trace("#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}") end end @@ -124,10 +124,10 @@ class Chef def remove_package(name, version) if options.nil? - shell_out_compact!("installp", "-u", name) + shell_out!("installp", "-u", name) logger.trace("#{new_resource} removed version #{new_resource.version}") else - shell_out_compact!("installp", "-u", options, name) + shell_out!("installp", "-u", options, name) logger.trace("#{new_resource} removed version #{new_resource.version}") end end diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb index a6abdd5b46..c60483d0dc 100644 --- a/lib/chef/provider/package/chocolatey.rb +++ b/lib/chef/provider/package/chocolatey.rb @@ -171,7 +171,7 @@ EOS # @param args [String] variable number of string arguments # @return [Mixlib::ShellOut] object returned from shell_out! def choco_command(*args) - shell_out_with_timeout!(args_to_string(choco_exe, *args), returns: new_resource.returns) + shell_out!(args_to_string(choco_exe, *args), returns: new_resource.returns) end # Use the available_packages Hash helper to create an array suitable for diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb index 0233c0a838..2339b4cabe 100644 --- a/lib/chef/provider/package/dnf.rb +++ b/lib/chef/provider/package/dnf.rb @@ -121,7 +121,7 @@ class Chef private def resolve_source_to_version_obj - shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line| + shell_out!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line| # this is another case of committing the sin of doing some lightweight mangling of RPM versions in ruby -- but the output of the rpm command # does not match what the dnf library accepts. case line @@ -167,7 +167,7 @@ class Chef end def dnf(*args) - shell_out_compact!("dnf", *args) + shell_out!("dnf", *args) end def safe_version_array diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb index 0b6a9c8ba2..de5b2858e7 100644 --- a/lib/chef/provider/package/dpkg.rb +++ b/lib/chef/provider/package/dpkg.rb @@ -113,9 +113,9 @@ class Chef # # @return [Integer] 1 if v1 > v2. 0 if they're equal. -1 if v1 < v2 def version_compare(v1, v2) - if !shell_out_compact("dpkg", "--compare-versions", v1.to_s, "gt", v2.to_s).error? + if !shell_out("dpkg", "--compare-versions", v1.to_s, "gt", v2.to_s).error? 1 - elsif !shell_out_compact("dpkg", "--compare-versions", v1.to_s, "eq", v2.to_s).error? + elsif !shell_out("dpkg", "--compare-versions", v1.to_s, "eq", v2.to_s).error? 0 else -1 @@ -124,7 +124,7 @@ class Chef def read_current_version_of_package(package_name) logger.trace("#{new_resource} checking install state of #{package_name}") - status = shell_out_compact!("dpkg", "-s", package_name, returns: [0, 1]) + status = shell_out!("dpkg", "-s", package_name, returns: [0, 1]) package_installed = false status.stdout.each_line do |line| case line @@ -149,10 +149,10 @@ class Chef end end - # Runs command via shell_out_with_timeout with magic environment to disable + # Runs command via shell_out with magic environment to disable # interactive prompts. def run_noninteractive(*command) - shell_out_compact!(*command, env: { "DEBIAN_FRONTEND" => "noninteractive" }) + shell_out!(*command, env: { "DEBIAN_FRONTEND" => "noninteractive" }) end # Returns true if all sources exist. Returns false if any do not, or if no @@ -192,7 +192,7 @@ class Chef begin pkginfos = resolved_source_array.map do |src| logger.trace("#{new_resource} checking #{src} dpkg status") - status = shell_out_compact!("dpkg-deb", "-W", src) + status = shell_out!("dpkg-deb", "-W", src) status.stdout end Hash[*package_name_array.zip(pkginfos).flatten] diff --git a/lib/chef/provider/package/freebsd/base.rb b/lib/chef/provider/package/freebsd/base.rb index c9b3bf222b..bf704a5cae 100644 --- a/lib/chef/provider/package/freebsd/base.rb +++ b/lib/chef/provider/package/freebsd/base.rb @@ -47,7 +47,7 @@ class Chef # Otherwise look up the path to the ports directory using 'whereis' else - whereis = shell_out_compact!("whereis", "-s", port, env: nil) + whereis = shell_out!("whereis", "-s", port, env: nil) unless path = whereis.stdout[/^#{Regexp.escape(port)}:\s+(.+)$/, 1] raise Chef::Exceptions::Package, "Could not find port with the name #{port}" end @@ -57,7 +57,7 @@ class Chef def makefile_variable_value(variable, dir = nil) options = dir ? { cwd: dir } : {} - make_v = shell_out_compact!("make", "-V", variable, options.merge!(env: nil, returns: [0, 1])) + make_v = shell_out!("make", "-V", variable, options.merge!(env: nil, returns: [0, 1])) make_v.exitstatus == 0 ? make_v.stdout.strip.split($OUTPUT_RECORD_SEPARATOR).first : nil # $\ is the line separator, i.e. newline. end end diff --git a/lib/chef/provider/package/freebsd/pkg.rb b/lib/chef/provider/package/freebsd/pkg.rb index 800bca681c..c847ae5658 100644 --- a/lib/chef/provider/package/freebsd/pkg.rb +++ b/lib/chef/provider/package/freebsd/pkg.rb @@ -34,24 +34,24 @@ class Chef case new_resource.source when /^http/, /^ftp/ if new_resource.source =~ /\/$/ - shell_out_compact!("pkg_add", "-r", package_name, env: { "PACKAGESITE" => new_resource.source, "LC_ALL" => nil }).status + shell_out!("pkg_add", "-r", package_name, env: { "PACKAGESITE" => new_resource.source, "LC_ALL" => nil }).status else - shell_out_compact!("pkg_add", "-r", package_name, env: { "PACKAGEROOT" => new_resource.source, "LC_ALL" => nil }).status + shell_out!("pkg_add", "-r", package_name, env: { "PACKAGEROOT" => new_resource.source, "LC_ALL" => nil }).status end logger.trace("#{new_resource} installed from: #{new_resource.source}") when /^\// - shell_out_compact!("pkg_add", file_candidate_version_path, env: { "PKG_PATH" => new_resource.source, "LC_ALL" => nil }).status + shell_out!("pkg_add", file_candidate_version_path, env: { "PKG_PATH" => new_resource.source, "LC_ALL" => nil }).status logger.trace("#{new_resource} installed from: #{new_resource.source}") else - shell_out_compact!("pkg_add", "-r", latest_link_name, env: nil).status + shell_out!("pkg_add", "-r", latest_link_name, env: nil).status end end end def remove_package(name, version) - shell_out_compact!("pkg_delete", "#{package_name}-#{version || current_resource.version}", env: nil).status + shell_out!("pkg_delete", "#{package_name}-#{version || current_resource.version}", env: nil).status end # The name of the package (without the version number) as understood by pkg_add and pkg_info. @@ -72,7 +72,7 @@ class Chef end def current_installed_version - pkg_info = shell_out_compact!("pkg_info", "-E", "#{package_name}*", env: nil, returns: [0, 1]) + pkg_info = shell_out!("pkg_info", "-E", "#{package_name}*", env: nil, returns: [0, 1]) pkg_info.stdout[/^#{Regexp.escape(package_name)}-(.+)/, 1] end diff --git a/lib/chef/provider/package/freebsd/pkgng.rb b/lib/chef/provider/package/freebsd/pkgng.rb index ab64753e88..250baf0fac 100644 --- a/lib/chef/provider/package/freebsd/pkgng.rb +++ b/lib/chef/provider/package/freebsd/pkgng.rb @@ -28,21 +28,21 @@ class Chef unless current_resource.version case new_resource.source when /^(http|ftp|\/)/ - shell_out_compact!("pkg", "add", options, new_resource.source, env: { "LC_ALL" => nil }).status + shell_out!("pkg", "add", options, new_resource.source, env: { "LC_ALL" => nil }).status logger.trace("#{new_resource} installed from: #{new_resource.source}") else - shell_out_compact!("pkg", "install", "-y", options, name, env: { "LC_ALL" => nil }).status + shell_out!("pkg", "install", "-y", options, name, env: { "LC_ALL" => nil }).status end end end def remove_package(name, version) options_dup = options && options.map { |str| str.sub(repo_regex, "") }.reject!(&:empty?) - shell_out_compact!("pkg", "delete", "-y", options_dup, "#{name}#{version ? '-' + version : ''}", env: nil).status + shell_out!("pkg", "delete", "-y", options_dup, "#{name}#{version ? '-' + version : ''}", env: nil).status end def current_installed_version - pkg_info = shell_out_compact!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 70]) + pkg_info = shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 70]) pkg_info.stdout[/^Version +: (.+)$/, 1] end @@ -61,7 +61,7 @@ class Chef options = $1.split(" ") end - pkg_query = shell_out_compact!("pkg", "rquery", options, "%v", new_resource.package_name, env: nil) + pkg_query = shell_out!("pkg", "rquery", options, "%v", new_resource.package_name, env: nil) pkg_query.exitstatus == 0 ? pkg_query.stdout.strip.split(/\n/).last : nil end diff --git a/lib/chef/provider/package/freebsd/port.rb b/lib/chef/provider/package/freebsd/port.rb index 96a96ad030..7a46bbaf97 100644 --- a/lib/chef/provider/package/freebsd/port.rb +++ b/lib/chef/provider/package/freebsd/port.rb @@ -26,18 +26,18 @@ class Chef include PortsHelper def install_package(name, version) - shell_out_compact!("make", "-DBATCH", "install", "clean", timeout: 1800, env: nil, cwd: port_dir).status + shell_out!("make", "-DBATCH", "install", "clean", timeout: 1800, env: nil, cwd: port_dir).status end def remove_package(name, version) - shell_out_compact!("make", "deinstall", timeout: 300, env: nil, cwd: port_dir).status + shell_out!("make", "deinstall", timeout: 300, env: nil, cwd: port_dir).status end def current_installed_version pkg_info = if new_resource.supports_pkgng? - shell_out_compact!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 70]) + shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 70]) else - shell_out_compact!("pkg_info", "-E", "#{new_resource.package_name}*", env: nil, returns: [0, 1]) + shell_out!("pkg_info", "-E", "#{new_resource.package_name}*", env: nil, returns: [0, 1]) end pkg_info.stdout[/^#{Regexp.escape(new_resource.package_name)}-(.+)/, 1] end diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb index 319ce992f7..1a7407486b 100644 --- a/lib/chef/provider/package/homebrew.rb +++ b/lib/chef/provider/package/homebrew.rb @@ -128,7 +128,7 @@ class Chef logger.trace "Executing '#{command.join(' ')}' as user '#{homebrew_user.name}'" # FIXME: this 1800 second default timeout should be deprecated - output = shell_out_compact!(*command, timeout: 1800, user: homebrew_uid, environment: { "HOME" => homebrew_user.dir, "RUBYOPT" => nil, "TMPDIR" => nil }) + output = shell_out!(*command, timeout: 1800, user: homebrew_uid, environment: { "HOME" => homebrew_user.dir, "RUBYOPT" => nil, "TMPDIR" => nil }) output.stdout.chomp end diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb index 11455ce9cd..f7fdb95e4d 100644 --- a/lib/chef/provider/package/ips.rb +++ b/lib/chef/provider/package/ips.rb @@ -1,7 +1,7 @@ # # Author:: Jason J. W. Williams (<williamsjj@digitar.com>) # Author:: Stephen Nelson-Smith (<sns@chef.io>) -# Copyright:: Copyright 2011-2017, Chef Software Inc. +# Copyright:: Copyright 2011-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,14 +42,14 @@ class Chef end def get_current_version - shell_out_compact("pkg", "info", new_resource.package_name).stdout.each_line do |line| + shell_out("pkg", "info", new_resource.package_name).stdout.each_line do |line| return $1.split[0] if line =~ /^\s+Version: (.*)/ end nil end def get_candidate_version - shell_out_compact!("pkg", "info", "-r", new_resource.package_name).stdout.each_line do |line| + shell_out!("pkg", "info", "-r", new_resource.package_name).stdout.each_line do |line| return $1.split[0] if line =~ /Version: (.*)/ end nil @@ -68,7 +68,7 @@ class Chef command = [ "pkg", options, "install", "-q" ] command << "--accept" if new_resource.accept_license command << "#{name}@#{version}" - shell_out_compact!(command) + shell_out!(command) end def upgrade_package(name, version) @@ -77,7 +77,7 @@ class Chef def remove_package(name, version) package_name = "#{name}@#{version}" - shell_out_compact!( "pkg", options, "uninstall", "-q", package_name ) + shell_out!( "pkg", options, "uninstall", "-q", package_name ) end end end diff --git a/lib/chef/provider/package/macports.rb b/lib/chef/provider/package/macports.rb index 11113baf6f..384435778d 100644 --- a/lib/chef/provider/package/macports.rb +++ b/lib/chef/provider/package/macports.rb @@ -49,21 +49,21 @@ class Chef unless current_resource.version == version command = [ "port", options, "install", name ] command << "@#{version}" if version && !version.empty? - shell_out_compact!(command) + shell_out!(command) end end def purge_package(name, version) command = [ "port", options, "uninstall", name ] command << "@#{version}" if version && !version.empty? - shell_out_compact!(command) + shell_out!(command) end def remove_package(name, version) command = [ "port", options, "deactivate", name ] command << "@#{version}" if version && !version.empty? - shell_out_compact!(command) + shell_out!(command) end def upgrade_package(name, version) @@ -76,7 +76,7 @@ class Chef # that hasn't been installed. install_package(name, version) elsif current_version != version - shell_out_compact!( "port", options, "upgrade", name, "@#{version}" ) + shell_out!( "port", options, "upgrade", name, "@#{version}" ) end end @@ -84,7 +84,7 @@ class Chef def get_response_from_command(command) output = nil - status = shell_out_compact(command) + status = shell_out(command) begin output = status.stdout rescue Exception diff --git a/lib/chef/provider/package/msu.rb b/lib/chef/provider/package/msu.rb index c4e53a0fdf..9dbea31c82 100644 --- a/lib/chef/provider/package/msu.rb +++ b/lib/chef/provider/package/msu.rb @@ -125,7 +125,7 @@ class Chef def extract_msu_contents(msu_file, destination) with_os_architecture(nil) do - shell_out_with_timeout!("#{ENV['SYSTEMROOT']}\\system32\\expand.exe -f:* #{msu_file} #{destination}") + shell_out!("#{ENV['SYSTEMROOT']}\\system32\\expand.exe -f:* #{msu_file} #{destination}") end end diff --git a/lib/chef/provider/package/openbsd.rb b/lib/chef/provider/package/openbsd.rb index d8c12c6f6c..3408aef944 100644 --- a/lib/chef/provider/package/openbsd.rb +++ b/lib/chef/provider/package/openbsd.rb @@ -72,7 +72,7 @@ class Chef if parts = name.match(/^(.+?)--(.+)/) # use double-dash for stems with flavors, see man page for pkg_add name = parts[1] end - shell_out_compact!("pkg_add", "-r", package_string(name, version), env: { "PKG_PATH" => pkg_path }).status + shell_out!("pkg_add", "-r", package_string(name, version), env: { "PKG_PATH" => pkg_path }).status logger.trace("#{new_resource.package_name} installed") end end @@ -81,7 +81,7 @@ class Chef if parts = name.match(/^(.+?)--(.+)/) name = parts[1] end - shell_out_compact!("pkg_delete", package_string(name, version), env: nil).status + shell_out!("pkg_delete", package_string(name, version), env: nil).status end private @@ -92,7 +92,7 @@ class Chef else new_resource.package_name end - pkg_info = shell_out_compact!("pkg_info", "-e", "#{name}->0", env: nil, returns: [0, 1]) + pkg_info = shell_out!("pkg_info", "-e", "#{name}->0", env: nil, returns: [0, 1]) result = pkg_info.stdout[/^inst:#{Regexp.escape(name)}-(.+?)\s/, 1] logger.trace("installed_version of '#{new_resource.package_name}' is '#{result}'") result @@ -101,7 +101,7 @@ class Chef def candidate_version @candidate_version ||= begin results = [] - shell_out_compact!("pkg_info", "-I", package_string(new_resource.package_name, new_resource.version), env: nil, returns: [0, 1]).stdout.each_line do |line| + shell_out!("pkg_info", "-I", package_string(new_resource.package_name, new_resource.version), env: nil, returns: [0, 1]).stdout.each_line do |line| results << if parts = new_resource.package_name.match(/^(.+?)--(.+)/) line[/^#{Regexp.escape(parts[1])}-(.+?)\s/, 1] else diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb index 2f08ee7d28..4a3b795700 100644 --- a/lib/chef/provider/package/pacman.rb +++ b/lib/chef/provider/package/pacman.rb @@ -32,7 +32,7 @@ class Chef current_resource.package_name(new_resource.package_name) logger.trace("#{new_resource} checking pacman for #{new_resource.package_name}") - status = shell_out_compact("pacman", "-Qi", new_resource.package_name) + status = shell_out("pacman", "-Qi", new_resource.package_name) status.stdout.each_line do |line| case line when /^Version(\s?)*: (.+)$/ @@ -60,7 +60,7 @@ class Chef package_repos = repos.map { |r| Regexp.escape(r) }.join("|") - status = shell_out_compact("pacman", "-Sl") + status = shell_out("pacman", "-Sl") status.stdout.each_line do |line| case line when /^(#{package_repos}) #{Regexp.escape(new_resource.package_name)} (.+)$/ @@ -82,7 +82,7 @@ class Chef end def install_package(name, version) - shell_out_compact!( "pacman", "--sync", "--noconfirm", "--noprogressbar", options, name) + shell_out!( "pacman", "--sync", "--noconfirm", "--noprogressbar", options, name) end def upgrade_package(name, version) @@ -90,7 +90,7 @@ class Chef end def remove_package(name, version) - shell_out_compact!( "pacman", "--remove", "--noconfirm", "--noprogressbar", options, name ) + shell_out!( "pacman", "--remove", "--noconfirm", "--noprogressbar", options, name ) end def purge_package(name, version) diff --git a/lib/chef/provider/package/paludis.rb b/lib/chef/provider/package/paludis.rb index 50267610c2..3550b155d5 100644 --- a/lib/chef/provider/package/paludis.rb +++ b/lib/chef/provider/package/paludis.rb @@ -35,7 +35,7 @@ class Chef installed = false re = Regexp.new("(.*)[[:blank:]](.*)[[:blank:]](.*)$") - shell_out_compact!("cave", "-L", "warning", "print-ids", "-M", "none", "-m", new_resource.package_name, "-f", "%c/%p %v %r\n").stdout.each_line do |line| + shell_out!("cave", "-L", "warning", "print-ids", "-M", "none", "-m", new_resource.package_name, "-f", "%c/%p %v %r\n").stdout.each_line do |line| res = re.match(line) next if res.nil? case res[3] @@ -58,7 +58,7 @@ class Chef else new_resource.package_name.to_s end - shell_out_compact!("cave", "-L", "warning", "resolve", "-x", options, pkg) + shell_out!("cave", "-L", "warning", "resolve", "-x", options, pkg) end def upgrade_package(name, version) @@ -72,7 +72,7 @@ class Chef new_resource.package_name.to_s end - shell_out_compact!("cave", "-L", "warning", "uninstall", "-x", options, pkg) + shell_out!("cave", "-L", "warning", "uninstall", "-x", options, pkg) end def purge_package(name, version) diff --git a/lib/chef/provider/package/portage.rb b/lib/chef/provider/package/portage.rb index 4676f0ace4..11cbe99d18 100644 --- a/lib/chef/provider/package/portage.rb +++ b/lib/chef/provider/package/portage.rb @@ -66,7 +66,7 @@ class Chef def candidate_version return @candidate_version if @candidate_version - pkginfo = shell_out_compact("portageq", "best_visible", "/", new_resource.package_name) + pkginfo = shell_out("portageq", "best_visible", "/", new_resource.package_name) if pkginfo.exitstatus != 0 pkginfo.stderr.each_line do |line| @@ -106,7 +106,7 @@ class Chef pkg = "~#{name}-#{$1}" end - shell_out_compact!( "emerge", "-g", "--color", "n", "--nospinner", "--quiet", options, pkg ) + shell_out!( "emerge", "-g", "--color", "n", "--nospinner", "--quiet", options, pkg ) end def upgrade_package(name, version) @@ -120,7 +120,7 @@ class Chef new_resource.package_name.to_s end - shell_out_compact!( "emerge", "--unmerge", "--color", "n", "--nospinner", "--quiet", options, pkg ) + shell_out!( "emerge", "--unmerge", "--color", "n", "--nospinner", "--quiet", options, pkg ) end def purge_package(name, version) diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb index 8e3de23a14..3d070cee17 100644 --- a/lib/chef/provider/package/rpm.rb +++ b/lib/chef/provider/package/rpm.rb @@ -57,7 +57,7 @@ class Chef end logger.trace("#{new_resource} checking rpm status") - shell_out_compact!("rpm", "-qp", "--queryformat", "%{NAME} %{VERSION}-%{RELEASE}\n", new_resource.source).stdout.each_line do |line| + shell_out!("rpm", "-qp", "--queryformat", "%{NAME} %{VERSION}-%{RELEASE}\n", new_resource.source).stdout.each_line do |line| case line when /^(\S+)\s(\S+)$/ current_resource.package_name($1) @@ -73,7 +73,7 @@ class Chef end logger.trace("#{new_resource} checking install state") - @rpm_status = shell_out_compact("rpm", "-q", "--queryformat", "%{NAME} %{VERSION}-%{RELEASE}\n", current_resource.package_name) + @rpm_status = shell_out("rpm", "-q", "--queryformat", "%{NAME} %{VERSION}-%{RELEASE}\n", current_resource.package_name) @rpm_status.stdout.each_line do |line| case line when /^(\S+)\s(\S+)$/ @@ -88,12 +88,12 @@ class Chef def install_package(name, version) if current_resource.version if allow_downgrade - shell_out_compact!("rpm", options, "-U", "--oldpackage", new_resource.source) + shell_out!("rpm", options, "-U", "--oldpackage", new_resource.source) else - shell_out_compact!("rpm", options, "-U", new_resource.source) + shell_out!("rpm", options, "-U", new_resource.source) end else - shell_out_compact!("rpm", options, "-i", new_resource.source) + shell_out!("rpm", options, "-i", new_resource.source) end end @@ -101,9 +101,9 @@ class Chef def remove_package(name, version) if version - shell_out_compact!("rpm", options, "-e", "#{name}-#{version}") + shell_out!("rpm", options, "-e", "#{name}-#{version}") else - shell_out_compact!("rpm", options, "-e", name) + shell_out!("rpm", options, "-e", name) end end diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 6b04af547b..d99dce8972 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -547,9 +547,9 @@ class Chef end src_str = src.empty? ? "" : " #{src.join(" ")}" if !version.nil? && !version.empty? - shell_out_with_timeout!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src_str}#{opts}", env: nil) + shell_out!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src_str}#{opts}", env: nil) else - shell_out_with_timeout!("#{gem_binary_path} install \"#{name}\" -q --no-rdoc --no-ri #{src_str}#{opts}", env: nil) + shell_out!("#{gem_binary_path} install \"#{name}\" -q --no-rdoc --no-ri #{src_str}#{opts}", env: nil) end end @@ -573,9 +573,9 @@ class Chef def uninstall_via_gem_command(name, version) if version - shell_out_with_timeout!("#{gem_binary_path} uninstall #{name} -q -x -I -v \"#{version}\"#{opts}", env: nil) + shell_out!("#{gem_binary_path} uninstall #{name} -q -x -I -v \"#{version}\"#{opts}", env: nil) else - shell_out_with_timeout!("#{gem_binary_path} uninstall #{name} -q -x -I -a#{opts}", env: nil) + shell_out!("#{gem_binary_path} uninstall #{name} -q -x -I -a#{opts}", env: nil) end end diff --git a/lib/chef/provider/package/smartos.rb b/lib/chef/provider/package/smartos.rb index e78fcec580..4623196c13 100644 --- a/lib/chef/provider/package/smartos.rb +++ b/lib/chef/provider/package/smartos.rb @@ -43,7 +43,7 @@ class Chef def check_package_state(name) logger.trace("#{new_resource} checking package #{name}") version = nil - info = shell_out_compact!("/opt/local/sbin/pkg_info", "-E", "#{name}*", env: nil, returns: [0, 1]) + info = shell_out!("/opt/local/sbin/pkg_info", "-E", "#{name}*", env: nil, returns: [0, 1]) if info.stdout version = info.stdout[/^#{new_resource.package_name}-(.+)/, 1] @@ -58,7 +58,7 @@ class Chef return @candidate_version if @candidate_version name = nil version = nil - pkg = shell_out_compact!("/opt/local/bin/pkgin", "se", new_resource.package_name, env: nil, returns: [0, 1]) + pkg = shell_out!("/opt/local/bin/pkgin", "se", new_resource.package_name, env: nil, returns: [0, 1]) pkg.stdout.each_line do |line| case line when /^#{new_resource.package_name}/ @@ -72,7 +72,7 @@ class Chef def install_package(name, version) logger.trace("#{new_resource} installing package #{name} version #{version}") package = "#{name}-#{version}" - out = shell_out_compact!("/opt/local/bin/pkgin", "-y", "install", package, env: nil) + out = shell_out!("/opt/local/bin/pkgin", "-y", "install", package, env: nil) end def upgrade_package(name, version) @@ -83,7 +83,7 @@ class Chef def remove_package(name, version) logger.trace("#{new_resource} removing package #{name} version #{version}") package = name.to_s - out = shell_out_compact!("/opt/local/bin/pkgin", "-y", "remove", package, env: nil) + out = shell_out!("/opt/local/bin/pkgin", "-y", "remove", package, env: nil) end end diff --git a/lib/chef/provider/package/solaris.rb b/lib/chef/provider/package/solaris.rb index 1acc25d242..01958df1ee 100644 --- a/lib/chef/provider/package/solaris.rb +++ b/lib/chef/provider/package/solaris.rb @@ -55,7 +55,7 @@ class Chef @package_source_found = ::File.exist?(new_resource.source) if @package_source_found logger.trace("#{new_resource} checking pkg status") - shell_out_compact("pkginfo", "-l", "-d", new_resource.source, new_resource.package_name).stdout.each_line do |line| + shell_out("pkginfo", "-l", "-d", new_resource.source, new_resource.package_name).stdout.each_line do |line| case line when /VERSION:\s+(.+)/ new_resource.version($1) @@ -65,7 +65,7 @@ class Chef end logger.trace("#{new_resource} checking install state") - status = shell_out_compact("pkginfo", "-l", current_resource.package_name) + status = shell_out("pkginfo", "-l", current_resource.package_name) status.stdout.each_line do |line| case line when /VERSION:\s+(.+)/ @@ -83,7 +83,7 @@ class Chef def candidate_version return @candidate_version if @candidate_version - status = shell_out_compact("pkginfo", "-l", "-d", new_resource.source, new_resource.package_name) + status = shell_out("pkginfo", "-l", "-d", new_resource.source, new_resource.package_name) status.stdout.each_line do |line| case line when /VERSION:\s+(.+)/ @@ -106,7 +106,7 @@ class Chef else [ "pkgadd", "-n", "-d", new_resource.source, "all" ] end - shell_out_compact!(command) + shell_out!(command) logger.trace("#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}") else command = if ::File.directory?(new_resource.source) # CHEF-4469 @@ -114,7 +114,7 @@ class Chef else [ "pkgadd", "-n", options, "-d", new_resource.source, "all" ] end - shell_out_compact!(*command) + shell_out!(*command) logger.trace("#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}") end end @@ -123,10 +123,10 @@ class Chef def remove_package(name, version) if options.nil? - shell_out_compact!( "pkgrm", "-n", name ) + shell_out!( "pkgrm", "-n", name ) logger.trace("#{new_resource} removed version #{new_resource.version}") else - shell_out_compact!( "pkgrm", "-n", options, name ) + shell_out!( "pkgrm", "-n", options, name ) logger.trace("#{new_resource} removed version #{new_resource.version}") end end diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 325ffc9584..42dd11b43f 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -210,7 +210,7 @@ class Chef end def resolve_source_to_version_obj - shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line| + shell_out!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line| # this is another case of committing the sin of doing some lightweight mangling of RPM versions in ruby -- but the output of the rpm command # does not match what the yum library accepts. case line @@ -260,7 +260,7 @@ class Chef end def yum(*args) - shell_out_compact!(yum_binary, *args) + shell_out!(yum_binary, *args) end def safe_version_array diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb index 5aa4ec7762..058fcf1a6b 100644 --- a/lib/chef/provider/package/zypper.rb +++ b/lib/chef/provider/package/zypper.rb @@ -35,7 +35,7 @@ class Chef candidate_version = current_version = nil is_installed = false logger.trace("#{new_resource} checking zypper") - status = shell_out_compact!("zypper", "--non-interactive", "info", package_name) + status = shell_out!("zypper", "--non-interactive", "info", package_name) status.stdout.each_line do |line| case line when /^Version *: (.+) *$/ @@ -86,7 +86,7 @@ class Chef def locked_packages @locked_packages ||= begin - locked = shell_out_compact!("zypper", "locks") + locked = shell_out!("zypper", "locks") locked.stdout.each_line.map do |line| line.split("|").shift(2).last.strip end @@ -144,9 +144,9 @@ class Chef def zypper_package(command, *options, names, versions) zipped_names = zip(names, versions) if zypper_version < 1.0 - shell_out_compact!("zypper", gpg_checks, command, *options, "-y", names) + shell_out!("zypper", gpg_checks, command, *options, "-y", names) else - shell_out_compact!("zypper", "--non-interactive", gpg_checks, command, *options, zipped_names) + shell_out!("zypper", "--non-interactive", gpg_checks, command, *options, zipped_names) end end |