Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created August 27, 2012 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtimberman/3491505 to your computer and use it in GitHub Desktop.
Save jtimberman/3491505 to your computer and use it in GitHub Desktop.
node.set['mything'] = "I am the resource's value"
file "/tmp/thing.erb" do
content '<%= node["mything"] %>'
end
template "/tmp/mything" do
source "/tmp/thing.erb"
local true
end
node.set['mything'] = "I changed, don't cross the streams!"
chef > recipe
chef:recipe > node.set['mything'] = "I am the resource's value"
=> "I am the resource's value"
chef:recipe >
chef:recipe > file "/tmp/thing.erb" do
chef:recipe > content '<%= node["mything"] %>'
chef:recipe ?> end
=> <file[/tmp/thing.erb] @name: "/tmp/thing.erb" @noop: nil @before: nil @params: {} @provider: Chef::Provider::File @allowed_actions: [:nothing, :create, :delete, :touch, :create_if_missing] @action: "create" @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @immediate_notifications: [] @delayed_notifications: [] @source_line: "(irb#1):3:in `irb_binding'" @resource_name: :file @path: "/tmp/thing.erb" @backup: 5 @cookbook_name: nil @recipe_name: nil @enclosing_provider: nil @content: "<%= node[\"mything\"] %>">
chef:recipe >
chef:recipe > template "/tmp/mything" do
chef:recipe > source "/tmp/thing.erb"
chef:recipe ?> local true
chef:recipe ?> end
=> <template[/tmp/mything] @name: "/tmp/mything" @noop: nil @before: nil @params: {} @provider: Chef::Provider::Template @allowed_actions: [:nothing, :create, :delete, :touch, :create_if_missing] @action: "create" @updated: false @updated_by_last_action: false @supports: {} @ignore_failure: false @retries: 0 @retry_delay: 2 @immediate_notifications: [] @delayed_notifications: [] @source_line: "(irb#1):7:in `irb_binding'" @resource_name: :template @path: "/tmp/mything" @backup: 5 @source: "/tmp/thing.erb" @cookbook: nil @local: true @variables: {} @cookbook_name: nil @recipe_name: nil @enclosing_provider: nil>
chef:recipe >
chef:recipe > node.set['mything'] = "I changed, don't cross the streams!"
=> "I changed, don't cross the streams!"
chef:recipe > run_chef
[Mon, 27 Aug 2012 13:21:59 -0600] DEBUG: Processing file[/tmp/thing.erb] on virt1test.int.housepub.org
[Mon, 27 Aug 2012 13:21:59 -0600] INFO: Processing file[/tmp/thing.erb] action create ((irb#1) line 3)
[Mon, 27 Aug 2012 13:21:59 -0600] INFO: file[/tmp/thing.erb] created file /tmp/thing.erb
[Mon, 27 Aug 2012 13:21:59 -0600] DEBUG: Processing template[/tmp/mything] on virt1test.int.housepub.org
[Mon, 27 Aug 2012 13:21:59 -0600] INFO: Processing template[/tmp/mything] action create ((irb#1) line 7)
[Mon, 27 Aug 2012 13:21:59 -0600] DEBUG: Current content's checksum:
[Mon, 27 Aug 2012 13:21:59 -0600] DEBUG: Rendered content's checksum: 248c76057edea1f14efb8b421520128c8451fdff257866fca23867a139e2f01d
[Mon, 27 Aug 2012 13:21:59 -0600] INFO: template[/tmp/mything] updated content
=> true
chef:recipe > IO.read("/tmp/mything")
=> "I changed, don't cross the streams!"
chef:recipe >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment