From 8256eff1800e1377c7cf2b961ef63074a2ede0d4 Mon Sep 17 00:00:00 2001 From: Paul Allen Date: Mon, 16 Jun 2014 17:04:52 +0100 Subject: Add support for passing password/ticket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses param ‘p4passwd’ to set P4PASSWD environment to pass a valid ticket or password. --- README.P4.markdown | 15 ++++++++++++--- lib/puppet/provider/vcsrepo/p4.rb | 2 ++ lib/puppet/type/vcsrepo.rb | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.P4.markdown b/README.P4.markdown index 39fffd2..f92f616 100644 --- a/README.P4.markdown +++ b/README.P4.markdown @@ -71,9 +71,18 @@ You can set `p4port` to specify a Perforce server: p4port => 'ssl:perforce.com:1666' } -If `p4port`, `p4user`, `p4charset` or `p4client` are specified they will override the -environment variabels P4PORT, P4USER, etc... If a P4CONFIG file is defined, the config -file settings will take precedence. +You can set `p4passwd` for authentication : + + vcsrepo { "/path/to/repo": + ensure => present, + provider => p4, + source => '//depot/branch/...', + p4port => 'ssl:perforce.com:1666' + } + +If `p4port`, `p4user`, `p4charset`, `p4passwd` or `p4client` are specified they will +override the environment variabels P4PORT, P4USER, etc... If a P4CONFIG file is +defined, the config file settings will take precedence. More Examples diff --git a/lib/puppet/provider/vcsrepo/p4.rb b/lib/puppet/provider/vcsrepo/p4.rb index 2fdae70..df1ec21 100644 --- a/lib/puppet/provider/vcsrepo/p4.rb +++ b/lib/puppet/provider/vcsrepo/p4.rb @@ -162,12 +162,14 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d p4port = @resource.value(:p4port) p4user = @resource.value(:p4user) p4charset = @resource.value(:p4charset) + p4passwd = @resource.value(:p4passwd) p4client = @resource.value(:p4client) || client_name cfg = Hash.new cfg.store 'P4USER', p4user if p4user cfg.store 'P4PORT', p4port if p4port cfg.store 'P4CHARSET', p4charset if p4charset + cfg.store 'P4PASSWD', p4passwd if p4passwd cfg.store 'P4CLIENT', p4client if p4client return cfg diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb index ad964c5..649789a 100644 --- a/lib/puppet/type/vcsrepo.rb +++ b/lib/puppet/type/vcsrepo.rb @@ -227,6 +227,10 @@ Puppet::Type.newtype(:vcsrepo) do newparam :p4charset, :required_features => [:p4_config] do desc "The Perforce P4CHARSET environment." end + + newparam :p4passwd, :required_features => [:p4_config] do + desc "The Perforce P4PASSWD environment." + end autorequire(:package) do ['git', 'git-core'] -- cgit v1.2.3