summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Allen <pallen@perforce.com>2014-06-16 17:04:52 +0100
committerPaul Allen <pallen@perforce.com>2014-06-20 12:16:29 +0100
commit8256eff1800e1377c7cf2b961ef63074a2ede0d4 (patch)
treea6dc22ae3fd34aa618ce3af7f2ac363455902f14
parent58f9cb20657a7be01777c920a37279f30dc1fce6 (diff)
Add support for passing password/ticket
Uses param ‘p4passwd’ to set P4PASSWD environment to pass a valid ticket or password.
-rw-r--r--README.P4.markdown15
-rw-r--r--lib/puppet/provider/vcsrepo/p4.rb2
-rw-r--r--lib/puppet/type/vcsrepo.rb4
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']