Skip to content

Commit 6ee52ea

Browse files
author
Thom May
committed
CHEF-1057: allow templates from the local node to be processed
1 parent b7ce9b5 commit 6ee52ea

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎chef/lib/chef/provider/template.rb‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def action_create
4242
cache_file_name = "cookbooks/#{cookbook_name}/templates/default/#{@new_resource.source}"
4343
template_cache_name = "#{cookbook_name}_#{@new_resource.source}"
4444

45-
if Chef::Config[:solo]
45+
if @new_resource.local
46+
cache_file_name = @new_resource.source
47+
elsif Chef::Config[:solo]
4648
cache_file_name = solo_cache_file_name
4749
else
4850
raw_template_file = fetch_template_via_rest(cache_file_name, template_cache_name)

‎chef/lib/chef/resource/template.rb‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def initialize(name, collection=nil, node=nil)
2828
@action = "create"
2929
@source = "#{::File.basename(name)}.erb"
3030
@cookbook = nil
31+
@local = false
3132
@variables = Hash.new
3233
end
3334

@@ -55,6 +56,14 @@ def cookbook(args=nil)
5556
)
5657
end
5758

59+
def local(args=nil)
60+
set_or_return(
61+
:local,
62+
args,
63+
:kind_of => [ TrueClass, FalseClass ]
64+
)
65+
end
66+
5867
end
5968
end
6069
end

0 commit comments

Comments
 (0)