diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-31 11:07:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-31 11:07:54 -0700 |
commit | 6cbe0249fe5f62da513d4da5504d93fdf0992105 (patch) | |
tree | 59420309ef9683e4a2e5902bab0c2047fcc3cd80 /lib/chef/provider | |
parent | 01ce0a00f61e7d7e47d3f83e5c0f70bbcf4faf69 (diff) | |
parent | 07e9ce2574c0cba3f812c7c7b891d23aca58e67c (diff) | |
download | chef-6cbe0249fe5f62da513d4da5504d93fdf0992105.tar.gz |
Merge pull request #7313 from chef/lcg/remove-use-of-a_to_s
convert a_to_s to shell_out_compact in DNF/yum
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/package/dnf.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/package/yum.rb | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb index 90a5596727..b18a284116 100644 --- a/lib/chef/provider/package/dnf.rb +++ b/lib/chef/provider/package/dnf.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016-2017, Chef Software Inc. +# Copyright:: Copyright 2016-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -95,10 +95,10 @@ class Chef def install_package(names, versions) if new_resource.source - dnf(options, "-y install", new_resource.source) + dnf(options, "-y", "install", new_resource.source) else resolved_names = names.each_with_index.map { |name, i| available_version(i).to_s unless name.nil? } - dnf(options, "-y install", resolved_names) + dnf(options, "-y", "install", resolved_names) end flushcache end @@ -108,7 +108,7 @@ class Chef def remove_package(names, versions) resolved_names = names.each_with_index.map { |name, i| installed_version(i).to_s unless name.nil? } - dnf(options, "-y remove", resolved_names) + dnf(options, "-y", "remove", resolved_names) flushcache end @@ -167,7 +167,7 @@ class Chef end def dnf(*args) - shell_out_with_timeout!(a_to_s("dnf", *args)) + shell_out_compact_timeout!("dnf", *args) end def safe_version_array diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 805a74d013..ab206bb858 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -117,10 +117,10 @@ class Chef end if new_resource.source - yum(options, "-y #{method}", new_resource.source) + yum(options, "-y", method, new_resource.source) else resolved_names = names.each_with_index.map { |name, i| available_version(i).to_s unless name.nil? } - yum(options, "-y #{method}", resolved_names) + yum(options, "-y", method, resolved_names) end flushcache end @@ -130,7 +130,7 @@ class Chef def remove_package(names, versions) resolved_names = names.each_with_index.map { |name, i| installed_version(i).to_s unless name.nil? } - yum(options, "-y remove", resolved_names) + yum(options, "-y", "remove", resolved_names) flushcache end @@ -143,14 +143,14 @@ class Chef # NB: the yum_package provider manages individual single packages, please do not submit issues or PRs to try to add wildcard # support to lock / unlock. The best solution is to write an execute resource which does a not_if `yum versionlock | grep '^pattern`` kind of approach def lock_package(names, versions) - yum("-d0 -e0 -y", options, "versionlock add", resolved_package_lock_names(names)) + yum("-d0", "-e0", "-y", options, "versionlock", "add", resolved_package_lock_names(names)) end # NB: the yum_package provider manages individual single packages, please do not submit issues or PRs to try to add wildcard # support to lock / unlock. The best solution is to write an execute resource which does a only_if `yum versionlock | grep '^pattern`` kind of approach def unlock_package(names, versions) # yum versionlock delete on rhel6 needs the glob nonsense in the following command - yum("-d0 -e0 -y", options, "versionlock delete", resolved_package_lock_names(names).map { |n| "'*:#{n}-*'" }) + yum("-d0", "-e0", "-y", options, "versionlock", "delete", resolved_package_lock_names(names).map { |n| "'*:#{n}-*'" }) end private @@ -171,7 +171,7 @@ class Chef def locked_packages @locked_packages ||= begin - locked = shell_out_with_timeout!("yum versionlock list") + locked = yum("versionlock", "list") locked.stdout.each_line.map do |line| line.sub(/-[^-]*-[^-]*$/, "").split(":").last.strip end @@ -260,7 +260,7 @@ class Chef end def yum(*args) - shell_out_with_timeout!(a_to_s(yum_binary, *args)) + shell_out_compact_timeout!(yum_binary, *args) end def safe_version_array |