|
19 | 19 |
|
20 | 20 | import redis |
21 | 21 |
|
| 22 | +import salt.version |
| 23 | + |
22 | 24 | from datetime import datetime |
23 | 25 | from trigger.drivers import SyncDriverError |
24 | 26 | from trigger.drivers import LockDriverError |
@@ -94,8 +96,17 @@ def _fetch(self, args): |
94 | 96 | def _checkout(self, args): |
95 | 97 | # TODO (ryan-lane): Check return values from these commands |
96 | 98 | repo_name = self.conf.config['deploy.repo-name'] |
| 99 | + if args.force: |
| 100 | + # see https://github.com/saltstack/salt/issues/18317 |
| 101 | + _version_ = salt.version.SaltStackVersion(*salt.version.__version_info__) |
| 102 | + if (_version_ >= "2014.7.3"): |
| 103 | + runner_args = '[' + repo_name + ',' + str(args.force) + ']' |
| 104 | + else: |
| 105 | + runner_args = repo_name + ',' + str(args.force) |
| 106 | + else: |
| 107 | + runner_args = repo_name |
97 | 108 | p = subprocess.Popen(['sudo','salt-call','-l','quiet','publish.runner', |
98 | | - 'deploy.checkout', repo_name+','+str(args.force)], |
| 109 | + 'deploy.checkout', runner_args], |
99 | 110 | stdout=subprocess.PIPE) |
100 | 111 | p.communicate() |
101 | 112 |
|
@@ -206,9 +217,18 @@ def __init__(self, conf): |
206 | 217 |
|
207 | 218 | def restart(self, args): |
208 | 219 | repo_name = self.conf.config['deploy.repo-name'] |
| 220 | + if args.batch: |
| 221 | + # see https://github.com/saltstack/salt/issues/18317 |
| 222 | + _version_ = salt.version.SaltStackVersion(*salt.version.__version_info__) |
| 223 | + if (_version_ >= "2014.7.3"): |
| 224 | + runner_args = '[' + repo_name + ',' + str(args.batch) + ']' |
| 225 | + else: |
| 226 | + runner_args = repo_name +',' + str(args.batch) |
| 227 | + else: |
| 228 | + runner_args = repo_name |
209 | 229 | p = subprocess.Popen(['sudo','salt-call','-l','quiet','--out=json', |
210 | 230 | 'publish.runner','deploy.restart', |
211 | | - repo_name+','+str(args.batch)], |
| 231 | + runner_args], |
212 | 232 | stdout=subprocess.PIPE) |
213 | 233 | out = p.communicate()[0] |
214 | 234 | ## Disabled until salt bug is fixed: |
|
0 commit comments