diff options
author | Phil Dibowitz <phil@ipom.com> | 2013-11-21 14:10:16 -0800 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2013-11-21 14:10:16 -0800 |
commit | 05aa115ac5e8accb20888cbd2c3d682284024c5c (patch) | |
tree | 2d563c33c3aaa70f98c46ffc3a05b4468babe15e /lib/chef | |
parent | 12258c744290c58fc72036a486b4df8adb2886d6 (diff) | |
download | chef-05aa115ac5e8accb20888cbd2c3d682284024c5c.tar.gz |
[CHEF-4110] Add whyrun_safe_ruby_block resource
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/platform/provider_mapping.rb | 1 | ||||
-rw-r--r-- | lib/chef/provider/whyrun_safe_ruby_block.rb | 30 | ||||
-rw-r--r-- | lib/chef/providers.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/whyrun_safe_ruby_block.rb | 31 | ||||
-rw-r--r-- | lib/chef/resources.rb | 1 |
5 files changed, 64 insertions, 0 deletions
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index a252bdc100..92a7278d2f 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -369,6 +369,7 @@ class Chef :route => Chef::Provider::Route, :ifconfig => Chef::Provider::Ifconfig, :ruby_block => Chef::Provider::RubyBlock, + :whyrun_safe_ruby_block => Chef::Provider::WhyrunSafeRubyBlock, :erl_call => Chef::Provider::ErlCall, :log => Chef::Provider::Log::ChefLog } diff --git a/lib/chef/provider/whyrun_safe_ruby_block.rb b/lib/chef/provider/whyrun_safe_ruby_block.rb new file mode 100644 index 0000000000..4b491a4f60 --- /dev/null +++ b/lib/chef/provider/whyrun_safe_ruby_block.rb @@ -0,0 +1,30 @@ +# +# Author:: Phil Dibowitz (<phild@fb.com>) +# Copyright:: Copyright (c) 2013 Facebook +# 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. +# + +class Chef + class Provider + class WhyrunSafeRubyBlock < Chef::Provider::RubyBlock + def action_create + @new_resource.block.call + @new_resource.updated_by_last_action(true) + @run_context.events.resource_update_applied(@new_resource, :create, "execute the whyrun_safe_ruby_block #{@new_resource.name}") + Chef::Log.info("#{@new_resource} called") + end + end + end +end diff --git a/lib/chef/providers.rb b/lib/chef/providers.rb index 50099e8afc..6cfd12827a 100644 --- a/lib/chef/providers.rb +++ b/lib/chef/providers.rb @@ -48,6 +48,7 @@ require 'chef/provider/service' require 'chef/provider/subversion' require 'chef/provider/template' require 'chef/provider/user' +require 'chef/provider/whyrun_safe_ruby_block' require 'chef/provider/env/windows' diff --git a/lib/chef/resource/whyrun_safe_ruby_block.rb b/lib/chef/resource/whyrun_safe_ruby_block.rb new file mode 100644 index 0000000000..ddb9d91dc3 --- /dev/null +++ b/lib/chef/resource/whyrun_safe_ruby_block.rb @@ -0,0 +1,31 @@ +# +# Author:: Phil Dibowitz (<phild@fb.com>) +# Copyright:: Copyright (c) 2013 Facebook +# 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. +# + +class Chef + class Resource + class WhyrunSafeRubyBlock < Chef::Resource::RubyBlock + + def initialize(name, run_context=nil) + super + @resource_name = :whyrun_safe_ruby_block + @provider = Chef::Provider::WhyrunSafeRubyBlock + end + + end + end +end diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb index d0a27d8922..76adb6f1e1 100644 --- a/lib/chef/resources.rb +++ b/lib/chef/resources.rb @@ -68,6 +68,7 @@ require 'chef/resource/smartos_package' require 'chef/resource/template' require 'chef/resource/timestamped_deploy' require 'chef/resource/user' +require 'chef/resource/whyrun_safe_ruby_block' require 'chef/resource/yum_package' require 'chef/resource/lwrp_base' require 'chef/resource/bff_package' |