Ottomata has submitted this change and it was merged.

Change subject: Ensure submodules are checked out on the deployment server
......................................................................


Ensure submodules are checked out on the deployment server

If checkout_submodules is enabled on minions at any point and the
deployment server doesn't have the submodules checked out then the
minions will enter an unrecoverable state after the initial deploy.

This change always does a submodule recursive init for repos to
ensure this condition can't happen.

Change-Id: I125e9275d813dc34baed10878c19be94e4a0251e
---
M modules/deployment/files/modules/deploy.py
1 file changed, 17 insertions(+), 2 deletions(-)

Approvals:
  Ottomata: Verified; Looks good to me, approved



diff --git a/modules/deployment/files/modules/deploy.py 
b/modules/deployment/files/modules/deploy.py
index 6ea62cb..21ad4d1 100644
--- a/modules/deployment/files/modules/deploy.py
+++ b/modules/deployment/files/modules/deploy.py
@@ -116,10 +116,25 @@
             if config['upstream']:
                 cmd = '/usr/bin/git clone %s/.git %s' % (config['upstream'],
                                                          config['location'])
+                status = __salt__['cmd.retcode'](cmd, runas=deploy_user,
+                                                 umask=002)
+                if status != 0:
+                    ret_status = 1
+                    continue
+                # We don't check the checkout_submodules config flag here
+                # on purpose. The deployment server should always have a
+                # fully recursive clone and minions should decide whether
+                # or not they'll use the submodules. This avoids consistency
+                # issues in the case where submodules are later enabled, but
+                # someone forgets to check them out.
+                cmd = '/usr/bin/git submodule update --init --recursive'
+                status = __salt__['cmd.retcode'](cmd, runas=deploy_user,
+                                                 umask=002,
+                                                 cwd=config['location'])
             else:
                 cmd = '/usr/bin/git init %s' % (config['location'])
-            status = __salt__['cmd.retcode'](cmd, runas=deploy_user,
-                                             umask=002)
+                status = __salt__['cmd.retcode'](cmd, runas=deploy_user,
+                                                 umask=002)
             if status != 0:
                 ret_status = 1
                 continue

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I125e9275d813dc34baed10878c19be94e4a0251e
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ryan Lane <rl...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ottomata <o...@wikimedia.org>
Gerrit-Reviewer: Ryan Lane <rl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to