Rush has submitted this change and it was merged.

Change subject: Deployment group for trebuchet
......................................................................


Deployment group for trebuchet

Bug: T97775
Change-Id: I4486fd5e69a4cbca1a02817f59a12546ad6c9e4b
---
M modules/deployment/files/modules/deploy.py
M modules/deployment/manifests/deployment_server.pp
2 files changed, 27 insertions(+), 0 deletions(-)

Approvals:
  Rush: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/deployment/files/modules/deploy.py 
b/modules/deployment/files/modules/deploy.py
index 932c821..afd860b 100644
--- a/modules/deployment/files/modules/deploy.py
+++ b/modules/deployment/files/modules/deploy.py
@@ -149,6 +149,10 @@
     # for services without allowing end-users the ability to restart all
     # services on the targets.
     config.setdefault('service_name', None)
+    # deployment_repo_group is the group that will own the repository
+    # after deployment_server_init. This option overrides the
+    # deployment_repo_group grain set for all repositories
+    config.setdefault('deployment_repo_group', None)
     return config
 
 
@@ -167,6 +171,7 @@
     if not is_deployment_server:
         return ret_status
     deploy_user = __grains__.get('deployment_repo_user')
+    deploy_group = __grains__.get('deployment_repo_group')
     repo_config = __pillar__.get('repo_config')
     for repo in repo_config:
         config = get_config(repo)
@@ -251,6 +256,22 @@
                                              runas=deploy_user, umask=002)
             if status != 0:
                 ret_status = 1
+                continue
+
+            # Override deploy_group with repo specific value set
+            # in deployment_config pillar
+            if config['deployment_repo_group']:
+                deploy_group = config['deployment_repo_group']
+
+            if deploy_group is not None:
+                cmd = 'chown -R %s:%s %s' % (deploy_user,
+                                             deploy_group,
+                                             config['location'])
+                status = __salt__['cmd.retcode'](cmd,
+                                                 cwd=config['location'])
+                if status != 0:
+                    ret_status = 1
+
     return ret_status
 
 
diff --git a/modules/deployment/manifests/deployment_server.pp 
b/modules/deployment/manifests/deployment_server.pp
index 25737ec..c30ce93 100644
--- a/modules/deployment/manifests/deployment_server.pp
+++ b/modules/deployment/manifests/deployment_server.pp
@@ -71,6 +71,12 @@
         replace => true,
     }
 
+    salt::grain { 'deployment_repo_group':
+        grain   => 'deployment_repo_group',
+        value   => $deployer_groups[0],
+        replace => true,
+    }
+
     exec { 'deployment_server_sync_all':
         refreshonly => true,
         path        => ['/usr/bin'],

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4486fd5e69a4cbca1a02817f59a12546ad6c9e4b
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Thcipriani <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Rush <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to