use drone binary path from config
This commit is contained in:
parent
4da8d2ea87
commit
5107996e4d
@ -95,8 +95,8 @@ class AgentCleanup:
|
|||||||
self.logger.info("{dryrun_msg}Cleanup agents for scaler '{scaler}'".format(
|
self.logger.info("{dryrun_msg}Cleanup agents for scaler '{scaler}'".format(
|
||||||
scaler=scaler, dryrun_msg=dryrun_msg))
|
scaler=scaler, dryrun_msg=dryrun_msg))
|
||||||
|
|
||||||
res = run_command("drone -s {server} -t {token} --autoscaler {scaler} server ls --format '{{{{ . | jsonify }}}}'".format(
|
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))
|
server=self.config["drone_server"], token=self.config["drone_token"], scaler=scaler, binfile=self.config["drone_bin"]))
|
||||||
|
|
||||||
if res.returncode > 0:
|
if res.returncode > 0:
|
||||||
self.log.sysexit_with_message("Command error:\n{}".format(humanize(res.stdout)))
|
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))
|
agent=e, triage=control[e] or 3, force=force_msg))
|
||||||
|
|
||||||
if not dry:
|
if not dry:
|
||||||
res = run_command("drone -s {server} -t {token} --autoscaler {scaler} server destroy {force} {agent}".format(
|
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))
|
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:
|
if res.returncode > 0:
|
||||||
self.log.sysexit_with_message("Command error:\n{}".format(humanize(res.stdout)))
|
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()))
|
self.log.sysexit_with_message("Environment variable '{}' is required but empty or unset".format(c.upper()))
|
||||||
|
|
||||||
if not self.config["drone_bin"]:
|
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()
|
self._clean()
|
||||||
|
Reference in New Issue
Block a user