From 457035ec1c15df0d53abf7232dad63b2722b1720 Mon Sep 17 00:00:00 2001 From: Paul Allen Date: Mon, 23 Jun 2014 16:22:35 +0100 Subject: Add hostname to Digest for default client name. --- README.markdown | 2 +- lib/puppet/provider/vcsrepo/p4.rb | 3 ++- spec/unit/puppet/provider/vcsrepo/p4_spec.rb | 2 +- 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 -- cgit v1.2.3