diff options
-rw-r--r-- | kitchen-tests/Berksfile.lock | 1 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/base/metadata.rb | 1 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/base/recipes/default.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/apt_repository.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/apt_update.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/support/yum_repo.erb | 125 | ||||
-rw-r--r-- | lib/chef/provider/yum_repository.rb | 121 | ||||
-rw-r--r-- | lib/chef/providers.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/yum_repository.rb | 76 | ||||
-rw-r--r-- | lib/chef/resources.rb | 1 | ||||
-rw-r--r-- | spec/spec_helper.rb | 1 | ||||
-rw-r--r-- | spec/support/platform_helpers.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/yum_repository_spec.rb | 35 | ||||
-rw-r--r-- | spec/unit/resource/apt_repository_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/apt_update_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/yum_repository_spec.rb | 49 |
16 files changed, 436 insertions, 25 deletions
diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock index ba701180a8..767867c321 100644 --- a/kitchen-tests/Berksfile.lock +++ b/kitchen-tests/Berksfile.lock @@ -29,7 +29,6 @@ GRAPH sudo (>= 0.0.0) ubuntu (>= 0.0.0) users (>= 0.0.0) - yum-epel (>= 0.0.0) build-essential (6.0.3) compat_resource (>= 12.10) mingw (>= 1.1) diff --git a/kitchen-tests/cookbooks/base/metadata.rb b/kitchen-tests/cookbooks/base/metadata.rb index 3811fe914d..32ea03916f 100644 --- a/kitchen-tests/cookbooks/base/metadata.rb +++ b/kitchen-tests/cookbooks/base/metadata.rb @@ -22,4 +22,3 @@ depends "selinux" depends "sudo" depends "ubuntu" depends "users" -depends "yum-epel" diff --git a/kitchen-tests/cookbooks/base/recipes/default.rb b/kitchen-tests/cookbooks/base/recipes/default.rb index 053a689b27..2499dcb814 100644 --- a/kitchen-tests/cookbooks/base/recipes/default.rb +++ b/kitchen-tests/cookbooks/base/recipes/default.rb @@ -16,8 +16,14 @@ if %w{rhel fedora}.include?(node["platform_family"]) include_recipe "selinux::disabled" end -if node["platform_family"] == "rhel" - include_recipe "yum-epel" +yum_repository "epel" do + enabled true + description "Extra Packages for Enterprise Linux #{node['platform_version'].to_i} - $basearch" + failovermethod "priority" + gpgkey "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}" + gpgcheck true + mirrorlist "https://mirrors.fedoraproject.org/metalink?repo=epel-#{node['platform_version'].to_i}&arch=$basearch" + only_if { node["platform_family"] == "rhel" } end include_recipe "build-essential" diff --git a/lib/chef/provider/apt_repository.rb b/lib/chef/provider/apt_repository.rb index 3a1b247d17..9e077c8cbb 100644 --- a/lib/chef/provider/apt_repository.rb +++ b/lib/chef/provider/apt_repository.rb @@ -19,6 +19,7 @@ require "chef/resource" require "chef/dsl/declare_resource" require "chef/mixin/shell_out" +require "chef/mixin/which" require "chef/http/simple" require "chef/provider/noop" @@ -28,9 +29,10 @@ class Chef use_inline_resources include Chef::Mixin::ShellOut + extend Chef::Mixin::Which provides :apt_repository do - uses_apt? + which("apt-get") end def whyrun_supported? @@ -104,12 +106,6 @@ class Chef end 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 - def is_key_id?(id) id = id[2..-1] if id.start_with?("0x") id =~ /^\h+$/ && [8, 16, 40].include?(id.length) diff --git a/lib/chef/provider/apt_update.rb b/lib/chef/provider/apt_update.rb index 03598280c8..0320e9a83f 100644 --- a/lib/chef/provider/apt_update.rb +++ b/lib/chef/provider/apt_update.rb @@ -18,14 +18,17 @@ require "chef/provider" require "chef/provider/noop" +require "chef/mixin/which" class Chef class Provider class AptUpdate < Chef::Provider use_inline_resources + extend Chef::Mixin::Which + provides :apt_update do - uses_apt? + which("apt-get") end APT_CONF_DIR = "/etc/apt/apt.conf.d" @@ -77,11 +80,6 @@ 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 diff --git a/lib/chef/provider/support/yum_repo.erb b/lib/chef/provider/support/yum_repo.erb new file mode 100644 index 0000000000..7d9a2d09e2 --- /dev/null +++ b/lib/chef/provider/support/yum_repo.erb @@ -0,0 +1,125 @@ +# This file was generated by Chef +# Do NOT modify this file by hand. + +[<%= @config.repositoryid %>] +name=<%= @config.description %> +<% if @config.baseurl %> +baseurl=<%= @config.baseurl %> +<% end %> +<% if @config.cost %> +cost=<%= @config.cost %> +<% end %> +<% if @config.enabled %> +enabled=1 +<% else %> +enabled=0 +<% end %> +<% if @config.enablegroups %> +enablegroups=1 +<% end %> +<% if @config.exclude %> +exclude=<%= @config.exclude %> +<% end %> +<% if @config.failovermethod %> +failovermethod=<%= @config.failovermethod %> +<% end %> +<% if @config.fastestmirror_enabled %> +fastestmirror_enabled=<%= @config.fastestmirror_enabled %> +<% end %> +<% if @config.gpgcheck %> +gpgcheck=1 +<% else %> +gpgcheck=0 +<% end %> +<% if @config.gpgkey %> +gpgkey=<%= case @config.gpgkey + when Array + @config.gpgkey.join("\n ") + else + @config.gpgkey + end %> +<% end -%> +<% if @config.http_caching %> +http_caching=<%= @config.http_caching %> +<% end %> +<% if @config.include_config %> +include=<%= @config.include_config %> +<% end %> +<% if @config.includepkgs %> +includepkgs=<%= @config.includepkgs %> +<% end %> +<% if @config.keepalive %> +keepalive=1 +<% end %> +<% if @config.metadata_expire %> +metadata_expire=<%= @config.metadata_expire %> +<% end %> +<% if @config.mirrorlist %> +mirrorlist=<%= @config.mirrorlist %> +<% end %> +<% if @config.mirror_expire %> +mirror_expire=<%= @config.mirror_expire %> +<% end %> +<% if @config.mirrorlist_expire %> +mirrorlist_expire=<%= @config.mirrorlist_expire %> +<% end %> +<% if @config.priority %> +priority=<%= @config.priority %> +<% end %> +<% if @config.proxy %> +proxy=<%= @config.proxy %> +<% end %> +<% if @config.proxy_username %> +proxy_username=<%= @config.proxy_username %> +<% end %> +<% if @config.proxy_password %> +proxy_password=<%= @config.proxy_password %> +<% end %> +<% if @config.username %> +username=<%= @config.username %> +<% end %> +<% if @config.password %> +password=<%= @config.password %> +<% end %> +<% if @config.repo_gpgcheck %> +repo_gpgcheck=1 +<% end %> +<% if @config.max_retries %> +retries=<%= @config.max_retries %> +<% end %> +<% if @config.report_instanceid %> +report_instanceid=<%= @config.report_instanceid %> +<% end %> +<% if @config.skip_if_unavailable %> +skip_if_unavailable=1 +<% end %> +<% if @config.sslcacert %> +sslcacert=<%= @config.sslcacert %> +<% end %> +<% if @config.sslclientcert %> +sslclientcert=<%= @config.sslclientcert %> +<% end %> +<% if @config.sslclientkey %> +sslclientkey=<%= @config.sslclientkey %> +<% end %> +<% unless @config.sslverify.nil? %> +sslverify=<%= ( @config.sslverify ) ? 'true' : 'false' %> +<% end %> +<% if @config.timeout %> +timeout=<%= @config.timeout %> +<% end %> +<% if @config.options -%> +<% @config.options.each do |key, value| -%> +<%= key %>=<%= + case value + when Array + value.join("\n ") + when TrueClass + '1' + when FalseClass + '0' + else + value + end %> +<% end -%> +<% end -%> diff --git a/lib/chef/provider/yum_repository.rb b/lib/chef/provider/yum_repository.rb new file mode 100644 index 0000000000..09ff2c5512 --- /dev/null +++ b/lib/chef/provider/yum_repository.rb @@ -0,0 +1,121 @@ +# +# Author:: Thom May (<thom@chef.io>) +# Copyright:: Copyright (c) 2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "chef/resource" +require "chef/dsl/declare_resource" +require "chef/mixin/shell_out" +require "chef/mixin/which" +require "chef/http/simple" +require "chef/provider/noop" + +class Chef + class Provider + class YumRepository < Chef::Provider + use_inline_resources + + extend Chef::Mixin::Which + + provides :yum_repository do + which "yum" + end + + def whyrun_supported?; true; end + + def load_current_resource; end + + action :create do + declare_resource(:template, "/etc/yum.repos.d/#{new_resource.repositoryid}.repo") do + if template_available?(new_resource.source) + source new_resource.source + else + source ::File.expand_path("../support/yum_repo.erb", __FILE__) + local true + end + sensitive new_resource.sensitive + variables(config: new_resource) + mode new_resource.mode + if new_resource.make_cache + notifies :run, "execute[yum clean metadata #{new_resource.repositoryid}]", :immediately if new_resource.clean_metadata || new_resource.clean_headers + notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately + notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately + end + end + + declare_resource(:execute, "yum clean metadata #{new_resource.repositoryid}") do + command "yum clean metadata --disablerepo=* --enablerepo=#{new_resource.repositoryid}" + action :nothing + end + + # get the metadata for this repo only + declare_resource(:execute, "yum-makecache-#{new_resource.repositoryid}") do + command "yum -q -y makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}" + action :nothing + only_if { new_resource.enabled } + end + + # reload internal Chef yum cache + declare_resource(:ruby_block, "yum-cache-reload-#{new_resource.repositoryid}") do + block { Chef::Provider::Package::Yum::YumCache.instance.reload } + action :nothing + end + end + + action :delete do + declare_resource(:file, "/etc/yum.repos.d/#{new_resource.repositoryid}.repo") do + action :delete + notifies :run, "execute[yum clean all #{new_resource.repositoryid}]", :immediately + notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately + end + + declare_resource(:execute, "yum clean all #{new_resource.repositoryid}") do + command "yum clean all --disablerepo=* --enablerepo=#{new_resource.repositoryid}" + only_if "yum repolist | grep -P '^#{new_resource.repositoryid}([ \t]|$)'" + action :nothing + end + + declare_resource(:ruby_block, "yum-cache-reload-#{new_resource.repositoryid}") do + block { Chef::Provider::Package::Yum::YumCache.instance.reload } + action :nothing + end + end + + action :makecache do + declare_resource(:execute, "yum-makecache-#{new_resource.repositoryid}") do + command "yum -q -y makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}" + action :run + only_if { new_resource.enabled } + end + + declare_resource(:ruby_block, "yum-cache-reload-#{new_resource.repositoryid}") do + block { Chef::Provider::Package::Yum::YumCache.instance.reload } + action :run + end + end + + alias_method :action_add, :action_create + alias_method :action_remove, :action_delete + + def template_available?(path) + !path.nil? && run_context.has_template_in_cookbook?(new_resource.cookbook_name, path) + end + + end + end +end + +Chef::Provider::Noop.provides :yum_repository diff --git a/lib/chef/providers.rb b/lib/chef/providers.rb index 9e2a914b71..affa5ca2c1 100644 --- a/lib/chef/providers.rb +++ b/lib/chef/providers.rb @@ -58,6 +58,7 @@ require "chef/provider/systemd_unit" require "chef/provider/template" require "chef/provider/user" require "chef/provider/whyrun_safe_ruby_block" +require "chef/provider/yum_repository" require "chef/provider/env/windows" diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb new file mode 100644 index 0000000000..4b3c6edfb7 --- /dev/null +++ b/lib/chef/resource/yum_repository.rb @@ -0,0 +1,76 @@ +# +# Author:: Thom May (<thom@chef.io>) +# Copyright:: Copyright (c) 2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "chef/resource" + +class Chef + class Resource + class YumRepository < Chef::Resource + resource_name :yum_repository + provides :yum_repository + + # http://linux.die.net/man/5/yum.conf + property :baseurl, String, regex: /.*/ + property :cost, String, regex: /^\d+$/ + property :clean_headers, [TrueClass, FalseClass], default: false # deprecated + property :clean_metadata, [TrueClass, FalseClass], default: true + property :description, String, regex: /.*/, default: "Ye Ole Rpm Repo" + property :enabled, [TrueClass, FalseClass], default: true + property :enablegroups, [TrueClass, FalseClass] + property :exclude, String, regex: /.*/ + property :failovermethod, String, equal_to: %w{priority roundrobin} + property :fastestmirror_enabled, [TrueClass, FalseClass] + property :gpgcheck, [TrueClass, FalseClass] + property :gpgkey, [String, Array], regex: /.*/ + property :http_caching, String, equal_to: %w{packages all none} + property :include_config, String, regex: /.*/ + property :includepkgs, String, regex: /.*/ + property :keepalive, [TrueClass, FalseClass] + property :make_cache, [TrueClass, FalseClass], default: true + property :max_retries, [String, Integer] + property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/] + property :mirrorexpire, String, regex: /.*/ + property :mirrorlist, String, regex: /.*/ + property :mirror_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/] + property :mirrorlist_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/] + property :mode, default: "0644" + property :priority, String, regex: /^(\d?[0-9]|[0-9][0-9])$/ + property :proxy, String, regex: /.*/ + property :proxy_username, String, regex: /.*/ + property :proxy_password, String, regex: /.*/ + property :username, String, regex: /.*/ + property :password, String, regex: /.*/ + property :repo_gpgcheck, [TrueClass, FalseClass] + property :report_instanceid, [TrueClass, FalseClass] + property :repositoryid, String, regex: /.*/, name_attribute: true + property :sensitive, [TrueClass, FalseClass], default: false + property :skip_if_unavailable, [TrueClass, FalseClass] + property :source, String, regex: /.*/ + property :sslcacert, String, regex: /.*/ + property :sslclientcert, String, regex: /.*/ + property :sslclientkey, String, regex: /.*/ + property :sslverify, [TrueClass, FalseClass] + property :timeout, String, regex: /^\d+$/ + + property :options, Hash + + default_action :create + allowed_actions :create, :remove, :make_cache, :add + end + end +end diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb index 0e73264832..2afd47a8f4 100644 --- a/lib/chef/resources.rb +++ b/lib/chef/resources.rb @@ -91,6 +91,7 @@ require "chef/resource/user/windows_user" require "chef/resource/whyrun_safe_ruby_block" require "chef/resource/windows_package" require "chef/resource/yum_package" +require "chef/resource/yum_repository" require "chef/resource/lwrp_base" require "chef/resource/bff_package" require "chef/resource/zypper_package" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ba44f7c3f7..47a5ec7f9f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -152,6 +152,7 @@ RSpec.configure do |config| config.filter_run_excluding :solaris_only => true unless solaris? config.filter_run_excluding :system_windows_service_gem_only => true unless system_windows_service_gem? config.filter_run_excluding :unix_only => true unless unix? + config.filter_run_excluding :linux_only => true unless linux? config.filter_run_excluding :aix_only => true unless aix? config.filter_run_excluding :debian_family_only => true unless debian_family? config.filter_run_excluding :supports_cloexec => true unless supports_cloexec? diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb index 4b727a18ca..62b262b8a7 100644 --- a/spec/support/platform_helpers.rb +++ b/spec/support/platform_helpers.rb @@ -126,6 +126,10 @@ def unix? !windows? end +def linux? + !!(RUBY_PLATFORM =~ /linux/) +end + def os_x? !!(RUBY_PLATFORM =~ /darwin/) end diff --git a/spec/unit/provider/yum_repository_spec.rb b/spec/unit/provider/yum_repository_spec.rb new file mode 100644 index 0000000000..5b019f7d3e --- /dev/null +++ b/spec/unit/provider/yum_repository_spec.rb @@ -0,0 +1,35 @@ +# +# Author:: Thom May (<thom@chef.io>) +# Copyright:: Copyright (c) 2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "spec_helper" + +describe Chef::Provider::YumRepository do + let(:new_resource) { Chef::Resource::YumRepository.new("multiverse") } + + let(:provider) do + node = Chef::Node.new + events = Chef::EventDispatch::Dispatcher.new + run_context = Chef::RunContext.new(node, {}, events) + Chef::Provider::YumRepository.new(new_resource, run_context) + end + + it "responds to load_current_resource" do + expect(provider).to respond_to(:load_current_resource) + end + +end diff --git a/spec/unit/resource/apt_repository_spec.rb b/spec/unit/resource/apt_repository_spec.rb index cd21873fed..0b0c0c5d26 100644 --- a/spec/unit/resource/apt_repository_spec.rb +++ b/spec/unit/resource/apt_repository_spec.rb @@ -38,13 +38,13 @@ describe Chef::Resource::AptRepository do expect(resource.distribution).to eql(nil) end - it "should resolve to a Noop class when uses_apt? is false" do - expect(Chef::Provider::AptRepository).to receive(:uses_apt?).and_return(false) + it "should resolve to a Noop class when apt-get is not found" do + expect(Chef::Provider::AptRepository).to receive(:which).with("apt-get").and_return(false) expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop) end - it "should resolve to a AptRepository class when uses_apt? is true" do - expect(Chef::Provider::AptRepository).to receive(:uses_apt?).and_return(true) + it "should resolve to a AptRepository class when apt-get is found" do + expect(Chef::Provider::AptRepository).to receive(:which).with("apt-get").and_return(true) expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptRepository) end end diff --git a/spec/unit/resource/apt_update_spec.rb b/spec/unit/resource/apt_update_spec.rb index 6fcba4adce..dd72b18063 100644 --- a/spec/unit/resource/apt_update_spec.rb +++ b/spec/unit/resource/apt_update_spec.rb @@ -38,13 +38,13 @@ describe Chef::Resource::AptUpdate do expect(resource.frequency).to eql(400) end - it "should resolve to a Noop class when uses_apt? is false" do - expect(Chef::Provider::AptUpdate).to receive(:uses_apt?).and_return(false) + it "should resolve to a Noop class when apt-get is not found" do + expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(false) expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop) end - it "should resolve to a AptUpdate class when uses_apt? is true" do - expect(Chef::Provider::AptUpdate).to receive(:uses_apt?).and_return(true) + it "should resolve to a AptUpdate class when apt-get is found" do + expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(true) expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptUpdate) end end diff --git a/spec/unit/resource/yum_repository_spec.rb b/spec/unit/resource/yum_repository_spec.rb new file mode 100644 index 0000000000..afd6c6739a --- /dev/null +++ b/spec/unit/resource/yum_repository_spec.rb @@ -0,0 +1,49 @@ +# +# Author:: Thom May (<thom@chef.io>) +# Copyright:: Copyright (c) 2016 Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "spec_helper" + +describe Chef::Resource::YumRepository do + let(:node) { Chef::Node.new } + let(:events) { Chef::EventDispatch::Dispatcher.new } + let(:run_context) { Chef::RunContext.new(node, {}, events) } + let(:resource) { Chef::Resource::YumRepository.new("multiverse", run_context) } + + context "on linux", :linux_only do + it "should create a new Chef::Resource::YumRepository" do + expect(resource).to be_a_kind_of(Chef::Resource) + expect(resource).to be_a_kind_of(Chef::Resource::YumRepository) + end + + it "should resolve to a Noop class when yum is not found" do + expect(Chef::Provider::YumRepository).to receive(:which).with("yum").and_return(false) + expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop) + end + + it "should resolve to a YumRepository class when yum is found" do + expect(Chef::Provider::YumRepository).to receive(:which).with("yum").and_return(true) + expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::YumRepository) + end + end + + context "on windows", :windows_only do + it "should resolve to a NoOp provider" do + expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop) + end + end +end |