summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2015-08-25 16:33:34 -0700
committerHunter Haugen <hunter@puppetlabs.com>2015-08-25 16:33:34 -0700
commit181e448d234e3ef78481e3f05b5a22e942304fa2 (patch)
tree475978aa099a30b76d56c0209047178dab2a972b
parentac6e22e56067cb4c7f525b12670068fa19be3cba (diff)
parentba9d0cf6c1d98ea70270faa5cf4e70997ea75595 (diff)
Merge pull request #265 from mhaskel/MODULES-1232
MODULES-1232 Make sure HOME is set correctly
-rw-r--r--.sync.yml6
-rw-r--r--.travis.yml4
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb7
3 files changed, 5 insertions, 12 deletions
diff --git a/.sync.yml b/.sync.yml
index 02c6c83..f4b637c 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -1,11 +1,5 @@
---
.travis.yml:
- script: "\"bundle exec rake spec SPEC_OPTS='--format documentation'\""
- extras:
- - rvm: 1.8.7
- env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- - rvm: 1.8.7
- env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
Rakefile:
unmanaged: true
spec/spec_helper.rb:
diff --git a/.travis.yml b/.travis.yml
index 727f6e7..1155a2d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,10 +16,6 @@ matrix:
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.6
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
- - rvm: 1.8.7
- env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- - rvm: 1.8.7
- env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
allow_failures:
- rvm: 2.1.6
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 4623f8e..a34b154 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -3,7 +3,9 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) do
desc "Supports Git repositories"
- commands :git => 'git'
+ has_command(:git, 'git') do
+ environment({ 'HOME' => ENV['HOME'] })
+ end
has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth, :branch, :submodules
@@ -457,7 +459,8 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
return ret
end
elsif @resource.value(:user) and @resource.value(:user) != Facter['id'].value
- Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true)
+ env = Etc.getpwnam(@resource.value(:user))
+ Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true, :custom_environment => {'HOME' => env['dir']})
else
git(*args)
end