Add hostname to Digest for default client name.
authorPaul Allen <pallen@perforce.com>
Mon, 23 Jun 2014 15:22:35 +0000 (16:22 +0100)
committerPaul Allen <pallen@perforce.com>
Mon, 23 Jun 2014 15:22:35 +0000 (16:22 +0100)
README.markdown
lib/puppet/provider/vcsrepo/p4.rb
spec/unit/puppet/provider/vcsrepo/p4_spec.rb

index 5f8aa9d..575950c 100644 (file)
@@ -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
 
index ec40cf3..612cc56 100644 (file)
@@ -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
index 2bb81c8..e45650a 100644 (file)
@@ -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