ArielGlenn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269465

Change subject: adapt trebuchet-trigger for timeout to restart function
......................................................................

adapt trebuchet-trigger for timeout to restart function

WIP: the timeout should be different to the batch command
and to publish.runner, one calculated from the other. Ouch.

Bug: T63882
Change-Id: I6e13b7be04fddff47790312b0c0d144b39bd91b5
---
M trigger/drivers/trebuchet/local.py
M trigger/shell.py
2 files changed, 17 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/software/deployment/trebuchet-trigger
 refs/changes/65/269465/1

diff --git a/trigger/drivers/trebuchet/local.py 
b/trigger/drivers/trebuchet/local.py
index 53ef5d2..8897b1f 100644
--- a/trigger/drivers/trebuchet/local.py
+++ b/trigger/drivers/trebuchet/local.py
@@ -217,17 +217,21 @@
 
     def restart(self, args):
         repo_name = self.conf.config['deploy.repo-name']
+        # see https://github.com/saltstack/salt/issues/18317
+        _version_ = 
salt.version.SaltStackVersion(*salt.version.__version_info__)
         if args.batch:
-            # see https://github.com/saltstack/salt/issues/18317
-            _version_ = 
salt.version.SaltStackVersion(*salt.version.__version_info__)
-            if (_version_ >= "2014.7.3"):
-                runner_args = '[' + repo_name + ',' + str(args.batch) + ']'
-            else:
-                runner_args = repo_name +',' + str(args.batch)
+            runner_args = repo_name +',' + str(args.batch)
         else:
-           runner_args = repo_name
+            runner_args = repo_name
+        if not args.timeout:
+            timeout = 60
+        else:
+            timeout = str(args.timeout)
+        runner_args = runner_args +',' + timeout
+        if (_version_ >= "2014.7.3"):
+            runner_args = '[' + runner_args + ']'
         p = subprocess.Popen(['sudo','salt-call','-l','quiet','--out=json',
-                              'publish.runner','deploy.restart',
+                              'publish.runner','--timeout', timeout, 
'deploy.restart',
                               runner_args],
                              stdout=subprocess.PIPE)
         out = p.communicate()[0]
diff --git a/trigger/shell.py b/trigger/shell.py
index 111f64c..c145b71 100755
--- a/trigger/shell.py
+++ b/trigger/shell.py
@@ -210,6 +210,11 @@
                default='10%',
                help='Number or percentage of targets to target for'
                     ' batch processing.')
+    @utils.arg('--timeout',
+               dest='timeout',
+               default='60',
+               help='Number or percentage of targets to target for'
+                    ' batch processing.')
     def do_service(self, args):
         """
         Manage the service associated with this repository.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e13b7be04fddff47790312b0c0d144b39bd91b5
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/deployment/trebuchet-trigger
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn <[email protected]>

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

Reply via email to