From 5107996e4df13658e57a6076981eefe64ee5c4f3 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 19 Dec 2019 13:47:36 +0100 Subject: [PATCH] use drone binary path from config --- cleanupagents/Cli.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cleanupagents/Cli.py b/cleanupagents/Cli.py index 4437d74..cc45bbe 100644 --- a/cleanupagents/Cli.py +++ b/cleanupagents/Cli.py @@ -95,8 +95,8 @@ class AgentCleanup: self.logger.info("{dryrun_msg}Cleanup agents for scaler '{scaler}'".format( scaler=scaler, dryrun_msg=dryrun_msg)) - res = run_command("drone -s {server} -t {token} --autoscaler {scaler} server ls --format '{{{{ . | jsonify }}}}'".format( - server=self.config["drone_server"], token=self.config["drone_token"], scaler=scaler)) + res = run_command("{binfile} -s {server} -t {token} --autoscaler {scaler} server ls --format '{{{{ . | jsonify }}}}'".format( + server=self.config["drone_server"], token=self.config["drone_token"], scaler=scaler, binfile=self.config["drone_bin"])) if res.returncode > 0: self.log.sysexit_with_message("Command error:\n{}".format(humanize(res.stdout))) @@ -123,8 +123,9 @@ class AgentCleanup: agent=e, triage=control[e] or 3, force=force_msg)) if not dry: - res = run_command("drone -s {server} -t {token} --autoscaler {scaler} server destroy {force} {agent}".format( - server=self.config["drone_server"], token=self.config["drone_token"], scaler=scaler, agent=e, force=force)) + res = run_command("{binfile} -s {server} -t {token} --autoscaler {scaler} server destroy {force} {agent}".format( + server=self.config["drone_server"], token=self.config["drone_token"], scaler=scaler, agent=e, force=force, + binfile=self.config["drone_bin"])) if res.returncode > 0: self.log.sysexit_with_message("Command error:\n{}".format(humanize(res.stdout))) @@ -144,6 +145,6 @@ class AgentCleanup: self.log.sysexit_with_message("Environment variable '{}' is required but empty or unset".format(c.upper())) if not self.config["drone_bin"]: - self.log.sysexit_with_message("Drone binary not found in PATH or not defined by '{}'".format(c.upper())) + self.log.sysexit_with_message("Drone binary not found in PATH or not defined by 'DRONE_BIN'") self._clean()