diff --git a/chef.gemspec b/chef.gemspec index c171bda880a..2193a1d7b05 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.add_dependency "mixlib-log", "~> 1.3" s.add_dependency "mixlib-authentication", "~> 1.3" s.add_dependency "mixlib-shellout", "~> 1.4" - s.add_dependency "ohai", "= 7.2.0.rc.1" + s.add_dependency "ohai", "~> 7.2" s.add_dependency "ffi-yajl", "~> 1.0" s.add_dependency "net-ssh", "~> 2.6" diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb index b293b859447..5b67941a8bd 100644 --- a/lib/chef/resource/lwrp_base.rb +++ b/lib/chef/resource/lwrp_base.rb @@ -92,9 +92,16 @@ def #{attr_name}(arg=nil) # Sets the default action def self.default_action(action_name=NULL_ARG) unless action_name.equal?(NULL_ARG) - action = action_name.to_sym - actions.push(action) unless actions.include?(action) - @default_action = action + @actions ||= [] + if action_name.is_a?(Array) + action = action_name.map { |arg| arg.to_sym } + @actions = actions | action + @default_action = action + else + action = action_name.to_sym + @actions.push(action) unless @actions.include?(action) + @default_action = action + end end @default_action ||= from_superclass(:default_action) diff --git a/pedant.gemfile b/pedant.gemfile index 8f223defdee..2ce3ed27fbd 100644 --- a/pedant.gemfile +++ b/pedant.gemfile @@ -1,8 +1,8 @@ source "https://rubygems.org" gemspec :name => "chef" -gem 'rest-client', :github => 'opscode/rest-client' -gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => '4744d7f318b629ff60a0d22cf02296df36936397' +gem 'rest-client', :github => 'opscode/rest-client', :branch => 'lcg/1.6.7-version-lying' +gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => 'd12864964a18994b467908daa91811eee1f1bf68' # TODO figure out how to grab this stuff from the main Gemfile gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby" diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index 9a775f2dff6..960aff3c363 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -180,6 +180,19 @@ module LwrpConstScopingConflict end end + describe "when #default_action is an array" do + let(:lwrp) do + Class.new(Chef::Resource::LWRPBase) do + actions :eat, :sleep + default_action [:eat, :sleep] + end + end + + it "returns the array of default actions" do + expect(lwrp.default_action).to eq([:eat, :sleep]) + end + end + describe "when inheriting from LWRPBase" do let(:parent) do Class.new(Chef::Resource::LWRPBase) do