summaryrefslogtreecommitdiff
path: root/lib/chef/provider/apt_update.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-08-05 10:19:43 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-08-05 10:19:43 -0700
commit72e3cfdbc9626755f48f614ae3afec0a875a5cd8 (patch)
tree104172b9ce665ae53ab69f120552abf4487e539d /lib/chef/provider/apt_update.rb
parent81a47cccbaf7ad71e735abccde10b78144b00fe2 (diff)
downloadchef-72e3cfdbc9626755f48f614ae3afec0a875a5cd8.tar.gz
noop apt_update similar to apt_repository
makes apt_update behave similarly to apt_repository
Diffstat (limited to 'lib/chef/provider/apt_update.rb')
-rw-r--r--lib/chef/provider/apt_update.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/chef/provider/apt_update.rb b/lib/chef/provider/apt_update.rb
index d2dd5cfb14..03598280c8 100644
--- a/lib/chef/provider/apt_update.rb
+++ b/lib/chef/provider/apt_update.rb
@@ -16,15 +16,17 @@
# limitations under the License.
#
-require "chef/resource"
-require "chef/dsl/declare_resource"
+require "chef/provider"
+require "chef/provider/noop"
class Chef
class Provider
class AptUpdate < Chef::Provider
use_inline_resources
- provides :apt_update, os: "linux"
+ provides :apt_update do
+ uses_apt?
+ end
APT_CONF_DIR = "/etc/apt/apt.conf.d"
STAMP_DIR = "/var/lib/apt/periodic"
@@ -75,6 +77,13 @@ class Chef
declare_resource(:execute, "apt-get -q update")
end
+ def self.uses_apt?
+ ENV["PATH"] ||= ""
+ paths = %w{ /bin /usr/bin /sbin /usr/sbin } + ENV["PATH"].split(::File::PATH_SEPARATOR)
+ paths.any? { |path| ::File.executable?(::File.join(path, "apt-get")) }
+ end
end
end
end
+
+Chef::Provider::Noop.provides :apt_update