From 31a11fdf802edb8a06f9036b06c4b1cd962eb33d Mon Sep 17 00:00:00 2001 From: "Ariel T. Glenn" Date: Fri, 8 May 2015 20:05:24 +0300 Subject: [PATCH] update multiple args format to publish.runner, bump version this was changed to yaml-style lists in salt 2014.7.3 --- debian/changelog | 6 ++++++ setup.py | 4 ++-- trigger/drivers/trebuchet/local.py | 24 ++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 654ac9d..236281e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +trebuchet-trigger (0.5.5-1) precise; urgency=low + + * Update for yaml format args to publish.runner + + -- Ariel T. Glenn Sat, 09 May 2015 08:32:56 +0000 + trebuchet-trigger (0.5.4-1) precise; urgency=low * Catch exception for config when not in repo diff --git a/setup.py b/setup.py index 0712c10..d19b16f 100644 --- a/setup.py +++ b/setup.py @@ -15,9 +15,9 @@ setup( name="TrebuchetTrigger", - version="0.5.4", + version="0.5.5", packages=find_packages(), - install_requires=['GitPython>=0.3.2.RC1', 'PyYAML>=3.10', 'redis>=2.4.9'], + install_requires=['GitPython>=0.3.2.RC1', 'PyYAML>=3.10', 'redis>=2.4.9', 'salt'], author="Ryan Lane", author_email="ryan@ryandlane.com", diff --git a/trigger/drivers/trebuchet/local.py b/trigger/drivers/trebuchet/local.py index 3aa71c8..53ef5d2 100644 --- a/trigger/drivers/trebuchet/local.py +++ b/trigger/drivers/trebuchet/local.py @@ -19,6 +19,8 @@ import redis +import salt.version + from datetime import datetime from trigger.drivers import SyncDriverError from trigger.drivers import LockDriverError @@ -94,8 +96,17 @@ def _fetch(self, args): def _checkout(self, args): # TODO (ryan-lane): Check return values from these commands repo_name = self.conf.config['deploy.repo-name'] + if args.force: + # 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.force) + ']' + else: + runner_args = repo_name + ',' + str(args.force) + else: + runner_args = repo_name p = subprocess.Popen(['sudo','salt-call','-l','quiet','publish.runner', - 'deploy.checkout', repo_name+','+str(args.force)], + 'deploy.checkout', runner_args], stdout=subprocess.PIPE) p.communicate() @@ -206,9 +217,18 @@ def __init__(self, conf): def restart(self, args): repo_name = self.conf.config['deploy.repo-name'] + 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) + else: + runner_args = repo_name p = subprocess.Popen(['sudo','salt-call','-l','quiet','--out=json', 'publish.runner','deploy.restart', - repo_name+','+str(args.batch)], + runner_args], stdout=subprocess.PIPE) out = p.communicate()[0] ## Disabled until salt bug is fixed: