jenkins-bot has submitted this change and it was merged.

Change subject: Set $HOME when git-cloning
......................................................................


Set $HOME when git-cloning

As of git 1.8.1.1 and above, if the home directory can't be accessed, it
results in a fatal error. This becomes a problem if we sudo -u vagrant
git-clone, because sudo does not set $HOME and the vagrant user tries to
read/write /root/.config (which fails).

I thought about this for a while and concluded that the very best thing to do
would be to drop the pretense of generality and simply omit the 'user'
parameter from git::clone, electing instead to always git-clone as 'vagrant'.

Bug: 50143
Bug: 50384

Change-Id: If6a066d0f077e0ea37ef0031ae8a901d3e1b3513
---
M puppet/modules/git/manifests/clone.pp
1 file changed, 7 insertions(+), 9 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/puppet/modules/git/manifests/clone.pp 
b/puppet/modules/git/manifests/clone.pp
index da9b2a2..27ab7df 100644
--- a/puppet/modules/git/manifests/clone.pp
+++ b/puppet/modules/git/manifests/clone.pp
@@ -12,9 +12,6 @@
 #   Remote URL for the repository. If unspecified, the resource title
 #   will be interpolated into $git::urlformat.
 #
-# [*user*]
-#   Execute git-clone as this user. Defaults to 'vagrant'.
-#
 # === Examples
 #
 #  Clone VisualEditor to MediaWiki extension path:
@@ -23,7 +20,7 @@
 #      directory => '/vagrant/mediawiki/extensions/VisualEditor',
 #  }
 #
-define git::clone($directory, $remote=undef, $user='vagrant') {
+define git::clone($directory, $remote=undef) {
        include git
 
        $url = $remote ? {
@@ -32,10 +29,11 @@
        }
 
        exec { "git clone ${title}":
-               command   => "git clone ${url} ${directory}",
-               creates   => "${directory}/.git/refs/remotes",
-               require   => Package['git'],
-               user      => $user,
-               timeout   => 0,
+               command     => "git clone ${url} ${directory}",
+               creates     => "${directory}/.git/refs/remotes",
+               require     => Package['git'],
+               user        => 'vagrant',
+               environment => 'HOME=/home/vagrant',
+               timeout     => 0,
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/71165
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If6a066d0f077e0ea37ef0031ae8a901d3e1b3513
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to