summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-08-19 06:52:36 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-19 12:47:31 -0700
commitd68399d21fa63d62281cbb9e0c86154202394e21 (patch)
tree143b19ac5b452348e81ea600a69c2e0992090092 /lib/chef/resource
parent5f91bff0d9ca8c745f47f950860d8d7663aede42 (diff)
downloadchef-d68399d21fa63d62281cbb9e0c86154202394e21.tar.gz
Add configurationdata attribute support
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/dsc_script.rb30
1 files changed, 26 insertions, 4 deletions
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,