From d68399d21fa63d62281cbb9e0c86154202394e21 Mon Sep 17 00:00:00 2001 From: Adam Edwards Date: Tue, 19 Aug 2014 06:52:36 -0700 Subject: Add configurationdata attribute support --- lib/chef/resource/dsc_script.rb | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'lib/chef/resource') diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb index 10d90bd065..37546c3b6a 100644 --- a/lib/chef/resource/dsc_script.rb +++ b/lib/chef/resource/dsc_script.rb @@ -25,16 +25,16 @@ class Chef def initialize(name, run_context=nil) super @allowed_actions.push(:run) - @action = 'run' + @action = :run provider(Chef::Provider::DscScript) end def code(arg=nil) if arg && command - raise ArgumentError, "Only one of 'code' and 'command' properties may be specified" + raise ArgumentError, "Only one of 'code' and 'command' attributes may be specified" end if arg && configuration_name - raise ArgumentError, "Attribute `code` may not be set if `configuration_name` is set" + raise ArgumentError, "The 'code' and 'command' attributes may not be used together" end set_or_return( :code, @@ -56,7 +56,7 @@ class Chef def command(arg=nil) if arg && code - raise ArgumentError, "Only one of 'code' and 'command' properties may be specified" + raise ArgumentError, "The 'code' and 'command' attributes may not be used together" end set_or_return( :command, @@ -65,6 +65,28 @@ class Chef ) end + def configuration_data(arg=nil) + if arg && configuration_data_script + raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' attributes may not be used together" + end + set_or_return( + :configuration_data, + arg, + :kind_of => [ String ] + ) + end + + def configuration_data_script(arg=nil) + if arg && configuration_data + raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' attributes may not be used together" + end + set_or_return( + :configuration_data_script, + arg, + :kind_of => [ String ] + ) + end + def flags(arg=nil) set_or_return( :flags, -- cgit v1.2.1