Skip to content

Commit 8ee3c17

Browse files
committed
deploy resource accomodates multiple providers
1 parent 74e7eae commit 8ee3c17

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

chef/lib/chef/resource/deploy.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class Resource
5050
#
5151
class Deploy < Chef::Resource
5252

53+
provider_base Chef::Provider::Deploy
54+
5355
def initialize(name, collection=nil, node=nil)
5456
super(name, collection, node)
5557
@resource_name = :deploy
@@ -69,7 +71,7 @@ def initialize(name, collection=nil, node=nil)
6971
@shallow_clone = false
7072
@force_deploy = false
7173
@scm_provider = Chef::Provider::Git
72-
@provider = Chef::Provider::Deploy
74+
@provider = Chef::Provider::Deploy::Timestamped
7375
@allowed_actions.push(:deploy, :rollback)
7476
end
7577

chef/spec/unit/resource/deploy_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,23 @@ def resource_has_a_callback_attribute(attr_name)
177177
@resource.restart.should == restart_like_this
178178
end
179179

180+
it "defaults to using the Deploy::Timestamped provider" do
181+
@resource.provider.should == Chef::Provider::Deploy::Timestamped
182+
end
183+
184+
it "allows providers to be set with a full class name" do
185+
@resource.provider Chef::Provider::Deploy::Timestamped
186+
@resource.provider.should == Chef::Provider::Deploy::Timestamped
187+
end
188+
189+
it "allows deploy providers to be set via symbol" do
190+
@resource.provider :revision
191+
@resource.provider.should == Chef::Provider::Deploy::Revision
192+
end
193+
194+
it "allows deploy providers to be set via string" do
195+
@resource.provider "revision"
196+
@resource.provider.should == Chef::Provider::Deploy::Revision
197+
end
198+
180199
end

0 commit comments

Comments
 (0)