summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Allen <pallen@perforce.com>2014-06-23 16:22:35 +0100
committerPaul Allen <pallen@perforce.com>2014-06-23 16:22:35 +0100
commit457035ec1c15df0d53abf7232dad63b2722b1720 (patch)
treef629a9955235b81e6b16f69a7521fc8bcf6339d8
parent319f9fbe1954fd172da638f3ccd76e58c3ec8c7f (diff)
downloadpuppet-vcsrepo-457035ec1c15df0d53abf7232dad63b2722b1720.tar.gz
puppet-vcsrepo-457035ec1c15df0d53abf7232dad63b2722b1720.tar.bz2
Add hostname to Digest for default client name.
-rw-r--r--README.markdown2
-rw-r--r--lib/puppet/provider/vcsrepo/p4.rb3
-rw-r--r--spec/unit/puppet/provider/vcsrepo/p4_spec.rb2
3 files changed, 4 insertions, 3 deletions
diff --git a/README.markdown b/README.markdown
index 5f8aa9d..575950c 100644
--- a/README.markdown
+++ b/README.markdown
@@ -330,7 +330,7 @@ connection settings.
}
If no `P4CLIENT` environment name is provided a workspace generated name is calculated
-based on the Digest of path. For example:
+based on the Digest of path and hostname. For example:
puppet-91bc00640c4e5a17787286acbe2c021c
diff --git a/lib/puppet/provider/vcsrepo/p4.rb b/lib/puppet/provider/vcsrepo/p4.rb
index ec40cf3..612cc56 100644
--- a/lib/puppet/provider/vcsrepo/p4.rb
+++ b/lib/puppet/provider/vcsrepo/p4.rb
@@ -106,7 +106,8 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d
# default (generated) client name
path = @resource.value(:path)
- default = "puppet-" + Digest::MD5.hexdigest(path)
+ host = Facter.value('hostname')
+ default = "puppet-" + Digest::MD5.hexdigest(path + host)
# check config for client name
set_client = nil
diff --git a/spec/unit/puppet/provider/vcsrepo/p4_spec.rb b/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
index 2bb81c8..e45650a 100644
--- a/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
@@ -48,7 +48,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:p4) do
context "when a client and source are not given" do
it "should execute 'p4 client'" do
- provider.expects(:p4).with(['client', '-o', "puppet-51f0a4b45dbfc10614df94f0a189c16f"]).returns({})
+ provider.expects(:p4).with(['client', '-o', "puppet-1c5e7a8e4f702e5091dfba173bc0e7c0"]).returns({})
provider.expects(:p4).with(['client', '-i'], spec)
provider.create
end