Skip to content

Commit 85b6fe0

Browse files
committed
Merge branch 'CHEF-1057' of git://github.com/thommay/chef into thommay/CHEF-1057
2 parents 4a9278b + 6ee52ea commit 85b6fe0

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

‎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-
ifChef::Config[:solo]
45+
if@new_resource.local
46+
cache_file_name=@new_resource.source
47+
elsifChef::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+
deflocal(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

‎chef/spec/unit/resource/template_spec.rb‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,16 @@
6565
@resource.cookbook.should == nil
6666
end
6767
end
68+
69+
describe"local"do
70+
it"should accept a boolean for whether a template is local or remote"do
71+
@resource.local(true)
72+
@resource.local.should == true
73+
end
74+
75+
it"should default to false"do
76+
@resource.local.should == false
77+
end
78+
end
6879

6980
end

0 commit comments

Comments
(0)