summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2014-07-14 17:02:07 -0700
committerHunter Haugen <hunter@puppetlabs.com>2014-07-14 17:02:07 -0700
commit96b7e5552f6ee0e5d4be527803b6d3009709c3c7 (patch)
tree3fec00785eb8a76f196d934fa095174eadd3ed13
parentf87608e828f97ff79be39ebaf11ca2647763f2f1 (diff)
parentd37ba2f14e958e57ed34abe1797c78b4663e211a (diff)
downloadpuppet-vcsrepo-96b7e5552f6ee0e5d4be527803b6d3009709c3c7.tar.gz
puppet-vcsrepo-96b7e5552f6ee0e5d4be527803b6d3009709c3c7.tar.bz2
Merge branch 'master' into 1.0.x
-rw-r--r--README.markdown10
-rw-r--r--lib/puppet/provider/vcsrepo/p4.rb56
-rw-r--r--spec/unit/puppet/provider/vcsrepo/p4_spec.rb2
3 files changed, 38 insertions, 30 deletions
diff --git a/README.markdown b/README.markdown
index 570f166..6d03a7c 100644
--- a/README.markdown
+++ b/README.markdown
@@ -459,6 +459,7 @@ The vcsrepo module is slightly unusual in that it is simply a type and providers
* `cvs` - Supports the CVS VCS. (Contains features: `cvs_rsh`, `gzip_compression`, `modules`,`reference_tracking`.)
* `dummy` -
* `hg` - Supports the Mercurial VCS. (Contains features: `reference_tracking`, `ssh_identity`, `user`.)
+* `p4` - Supports the Perforce VCS. (Contains features: `reference_tracking`, `filesystem_types`, `p4config`.)
* `svn` - Supports the Subversion VCS. (Contains features: `basic_auth`, `configuration`, `filesystem_types`, `reference_tracking`.)
####Features
@@ -477,6 +478,7 @@ The vcsrepo module is slightly unusual in that it is simply a type and providers
* `reference_tracking` - The provider supports tracking revision references that can change over time (e.g. some VCS tags and branch names). (Available with `bar`, `cvs`, `git`, `hg`, `svn`.)
* `ssh_identity` - The provider supports a configurable SSH identity file. (Available with `git` and `hg`.)
* `user` - The provider can run as a different user. (Available with `git` and `hg`.)
+* `p4config` - The provider support setting the P4CONFIG environment. (Available with `p4`.)
####Parameters
@@ -494,12 +496,13 @@ The vcsrepo module is slightly unusual in that it is simply a type and providers
* `identity` - Specifies the SSH identity file. (Requires the `ssh_identity` feature.)
* `module` - Specifies the repository module to manage. (Requires the `modules` feature.)
* `owner` - Specifies the user/uid that owns the repository files.
-* `path` - Specifies the absolute path to the repository. If omitted, the value defaults to the resource's title.
+* `path` - Specifies the absolute path to the repository. If omitted, the value defaults to the resource's title.
* `provider` - Specifies the backend to use for this vcsrepo resource.
* `remote` - Specifies the remote repository to track. (Requires the `multiple_remotes` feature.)
* `revision` - Sets the revision of the repository. Values can match /^\S+$/.
* `source` - Specifies the source URI for the repository.
* `user` - Specifies the user to run as for repository operations.
+* `p4config` - Specifies the P4CONFIG environment used for Perforce connection configuration.
####Features and Parameters by Provider
@@ -523,6 +526,11 @@ The vcsrepo module is slightly unusual in that it is simply a type and providers
**Parameters**: `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `revision`, `source`, `user`
+#####`p4`
+**Features**: `reference_tracking`, `filesystem_types`, `p4config`
+
+**Parameters**: `ensure`, `group`, `owner`, `path`, `provider`, `revision`, `source`, `p4config`
+
#####`svn`
**Features**: `basic_auth`, `configuration`, `filesystem_types`, `reference_tracking`
diff --git a/lib/puppet/provider/vcsrepo/p4.rb b/lib/puppet/provider/vcsrepo/p4.rb
index 4f53415..63d3df2 100644
--- a/lib/puppet/provider/vcsrepo/p4.rb
+++ b/lib/puppet/provider/vcsrepo/p4.rb
@@ -68,12 +68,12 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d
revision = 0
if hash && hash['code'] != 'error'
- hash['data'].each do |c|
- if c['status'] == 'have'
- change = c['change'].to_i
- revision = change if change > revision
- end
- end
+ hash['data'].each do |c|
+ if c['status'] == 'have'
+ change = c['change'].to_i
+ revision = change if change > revision
+ end
+ end
end
return revision
end
@@ -180,7 +180,7 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d
view = "\nView:\n"
hash.keys.sort.each do |k|
- v = hash[k]
+ v = hash[k]
next if( k == "code" )
if(k.to_s =~ /View/ )
view += "\t#{v}\n"
@@ -251,28 +251,28 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d
# helper method as cstat does not Marshal
def marshal_cstat(hash)
- data = hash['data']
- code = 'error'
-
- list = Array.new
- change = Hash.new
- data.each_line do |l|
- p = /^\.\.\. (.*) (.*)$/
- m = p.match(l)
- if m
+ data = hash['data']
+ code = 'error'
+
+ list = Array.new
+ change = Hash.new
+ data.each_line do |l|
+ p = /^\.\.\. (.*) (.*)$/
+ m = p.match(l)
+ if m
change[m[1]] = m[2]
- if m[1] == 'status'
- code = 'stat'
- list.push change
- change = Hash.new
- end
- end
- end
-
- hash = Hash.new
- hash.store 'code', code
- hash.store 'data', list
- return hash
+ if m[1] == 'status'
+ code = 'stat'
+ list.push change
+ change = Hash.new
+ end
+ end
+ end
+
+ hash = Hash.new
+ hash.store 'code', code
+ hash.store 'data', list
+ return hash
end
end
diff --git a/spec/unit/puppet/provider/vcsrepo/p4_spec.rb b/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
index 2d382da..abbd9ec 100644
--- a/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
@@ -51,7 +51,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:p4) do
ENV['P4CLIENT'] = nil
path = resource.value(:path)
- host = Facter.value('hostname')
+ host = Facter.value('hostname')
default = "puppet-" + Digest::MD5.hexdigest(path + host)
provider.expects(:p4).with(['client', '-o', default]).returns({})