Filippo Giunchedi has submitted this change and it was merged.

Change subject: git deploy: don't fetch/checkout/restart on the deployment 
server
......................................................................


git deploy: don't fetch/checkout/restart on the deployment server

Bug: T67549
Change-Id: Ib206f3820e5aa11ff6d26e777609b5692f74dd4f
---
M modules/deployment/files/runners/deploy.py
1 file changed, 17 insertions(+), 7 deletions(-)

Approvals:
  Thcipriani: Looks good to me, but someone else must approve
  Filippo Giunchedi: Verified; Looks good to me, approved



diff --git a/modules/deployment/files/runners/deploy.py 
b/modules/deployment/files/runners/deploy.py
index 5bfde5c..22f579a 100755
--- a/modules/deployment/files/runners/deploy.py
+++ b/modules/deployment/files/runners/deploy.py
@@ -12,12 +12,15 @@
     '''
     Fetch from a master, for the specified repo
     '''
-    grain = "deployment_target:" + repo
+    deployment_target = "deployment_target:" + repo
+    deployment_server = "deployment_server:*"
+    targets = "G@{0} and not G@{1}".format(deployment_target,
+                                           deployment_server)
     client = salt.client.LocalClient(__opts__['conf_file'])
     cmd = 'deploy.fetch'
     # comma in the tuple is a workaround for a bug in salt
     arg = (repo,)
-    client.cmd(grain, cmd, expr_form='grain', arg=arg, timeout=1,
+    client.cmd(targets, cmd, expr_form='compound', arg=arg, timeout=1,
                ret='deploy_redis')
     print "Fetch completed"
 
@@ -26,11 +29,14 @@
     '''
     Checkout from a master, for the specified repo
     '''
-    grain = "deployment_target:" + repo
+    deployment_target = "deployment_target:" + repo
+    deployment_server = "deployment_server:*"
+    targets = "G@{0} and not G@{1}".format(deployment_target,
+                                           deployment_server)
     client = salt.client.LocalClient(__opts__['conf_file'])
     cmd = 'deploy.checkout'
     arg = (repo, reset)
-    client.cmd(grain, cmd, expr_form='grain', arg=arg, timeout=1,
+    client.cmd(targets, cmd, expr_form='compound', arg=arg, timeout=1,
                ret='deploy_redis')
     print "Checkout completed"
 
@@ -40,14 +46,18 @@
     Restart the service associated with this repo. If no service is associated
     this call will do nothing.
     '''
-    grain = "deployment_target:" + repo
+    deployment_target = "deployment_target:" + repo
+    deployment_server = "deployment_server:*"
+    targets = "G@{0} and not G@{1}".format(deployment_target,
+                                           deployment_server)
     client = salt.client.LocalClient(__opts__['conf_file'])
     cmd = 'deploy.restart'
     # comma in the tuple is a workaround for a bug in salt
     arg = (repo,)
     ret = []
-    for data in client.cmd_batch(grain, cmd, expr_form='grain', arg=arg,
-                                 timeout=60, ret='deploy_redis', batch=batch):
+    for data in client.cmd_batch(targets, cmd, expr_form='compound',
+                                 arg=arg, timeout=60,
+                                 ret='deploy_redis', batch=batch):
         ret.append(data)
     print "Restart completed"
     return ret

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib206f3820e5aa11ff6d26e777609b5692f74dd4f
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: ArielGlenn <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[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

Reply via email to