Sanjay D
Sanjay D

Reputation: 265

Chef Recipe to do a SVN Checkout

I am trying to run a chef recipe that will install SVN on an Ubuntu client and then checkout a SVN subversion repository to the client machine. The following is the code:

#Installing svn
package "subversion" do
action :install
end

#Checkout SVN repo
bash "Checking out Antitheft Repository" do
cwd "#{Chef::Config[:file_cache_path]}"
code <<-EOH
svn co --username 'userxxx' --password 'passxxx' 'http://example.com/svn/trunk/yyy'
EOH
end

The command

svn co --username 'userxxx' --password 'passxxx' 'http://example.com/svn/trunk/yyy'

works perfectly well when run on a terminal on the client, but when the same command is executed through the recipe no errors are displayed nor is the checkout done.

What is wrong here?

Upvotes: 2

Views: 2585

Answers (1)

StephenKing
StephenKing

Reputation: 37620

Just use the built-in scm resource:

package "subversion"

subversion "Antitheft" do
  repository "http://example.com/svn/trunk/yyy"
  destination "#{Chef::Config[:file_cache_path]}/antitheft"
  svn_username "userxxx"
  svn_password "passxxx"
end

Upvotes: 2

Related Questions