Alexandros Kosiaris has submitted this change and it was merged.
Change subject: Scap3: chown the target root dir if owned by root
......................................................................
Scap3: chown the target root dir if owned by root
Switching from Trebuchet to Scap3 requires the repository on the target
node to be owned by the user Scap3 is using for its operation. Alas, in
the current state of affairs, the repository is still owned by root
after switching the deployment method. This patch represents a temporary
hack in scap::target that checks whether the target dir is owned by
root, and if so recursively chowns it to $deploy_user. Once all of the
repositories have been switched to actively use Scap3 for deployment,
the hack can be removed, even though this code fragment will become a
no-op at that point.
Change-Id: I5e303a24ffa461758a203c7f6302b17573a04b19
Note: the hack is extremely ugly, but Puppet ...
---
M modules/scap/manifests/target.pp
1 file changed, 19 insertions(+), 0 deletions(-)
Approvals:
Alexandros Kosiaris: Verified; Looks good to me, approved
diff --git a/modules/scap/manifests/target.pp b/modules/scap/manifests/target.pp
index 234c6ac..0173063 100644
--- a/modules/scap/manifests/target.pp
+++ b/modules/scap/manifests/target.pp
@@ -90,6 +90,25 @@
}
}
+ # XXX: Temporary work-around for switching services from Trebuchet to Scap3
+ # The Scap3 provider doesn't touch the target dir if it's already a git
repo
+ # which means that even after switching the provider we end up with the
+ # wrong user (root) owning it. Therefore, as a temporary measure we chown
+ # the target dir's parent so that the subsequent invocation of deploy-local
+ # is able to create the needed dirs and symlinks
+ $chown_user = "${deploy_user}:${deploy_user}"
+ $name_array = split($package_name, '/')
+ $pkg_root = inline_template(
+ '<%= @name_array[0,@name_array.size - 1].join("/") %>'
+ )
+ $chown_target = "/srv/deployment/${pkg_root}"
+ exec { "chown ${chown_target} for ${deploy_user}":
+ command => "/bin/chown -R ${chown_user} ${chown_target}",
+ # perform the chown only if root is the effective owner
+ onlyif => "/usr/bin/test -O /srv/deployment/${package_name}",
+ require => [User[$deploy_user], Group[$deploy_user]]
+ }
+
# Allow deploy user user to sudo -u $user, and to sudo /usr/sbin/service
# if $service_name is defined.
#
--
To view, visit https://gerrit.wikimedia.org/r/279415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5e303a24ffa461758a203c7f6302b17573a04b19
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: Thcipriani <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits