diff options
author | Justin Ellison <justin.ellison@buckle.com> | 2011-08-17 10:07:40 -0500 |
---|---|---|
committer | Justin Ellison <justin.ellison@buckle.com> | 2011-08-17 10:07:40 -0500 |
commit | abdcd73c60eac610a23125ae12ec3d775013496a (patch) | |
tree | 819e16bec3e5bda5b65dd35a50939b85a5cd69b8 /lib/puppet/provider/vcsrepo | |
parent | f2806a17ad82f6e42f720d589cb6e19ab6e0c5f3 (diff) | |
download | puppet-vcsrepo-abdcd73c60eac610a23125ae12ec3d775013496a.tar.gz puppet-vcsrepo-abdcd73c60eac610a23125ae12ec3d775013496a.tar.bz2 |
Adding basic_auth feature and adding --non-interactive to all svn commands.
The basic_auth feature allows the manifest to specify an optional
basic_auth_username and basic_auth_password to be sent to the subversion
server over HTTP(S).
Adding --non-interactive to all svn commands just lets svn know that
there's not a user on the other end to send y/n questions.
Diffstat (limited to 'lib/puppet/provider/vcsrepo')
-rw-r--r-- | lib/puppet/provider/vcsrepo/svn.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/puppet/provider/vcsrepo/svn.rb b/lib/puppet/provider/vcsrepo/svn.rb index 680188c..53daf53 100644 --- a/lib/puppet/provider/vcsrepo/svn.rb +++ b/lib/puppet/provider/vcsrepo/svn.rb @@ -7,7 +7,7 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) :svnadmin => 'svnadmin' defaultfor :svn => :exists - has_features :filesystem_types, :reference_tracking + has_features :filesystem_types, :reference_tracking, :basic_auth def create if !@resource.value(:source) @@ -40,29 +40,42 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) end end end + + def buildargs + args = ['--non-interactive'] + if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password) + args.push('--username', @resource.value(:basic_auth_username)) + args.push('--password', @resource.value(:basic_auth_password)) + args.push('--no-auth-cache') + end + return args + end def latest + args = buildargs.push('info', '-r', 'HEAD') at_path do - svn('info', '-r', 'HEAD')[/^Revision:\s+(\d+)/m, 1] + svn(*args)[/^Revision:\s+(\d+)/m, 1] end end def revision + args = buildargs.push('info') at_path do - svn('info')[/^Revision:\s+(\d+)/m, 1] + svn(*args)[/^Revision:\s+(\d+)/m, 1] end end def revision=(desired) + args = buildargs.push('update', '-r', desired) at_path do - svn('update', '-r', desired) + svn(*args) end end private - def checkout_repository(source, path, revision = nil) - args = ['checkout'] + def checkout_repository(source, path, revision) + args = buildargs.push('checkout') if revision args.push('-r', revision) end |