From 49a899263df2ac0453be35613882fc7d90984adc Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 3 Sep 2018 06:59:00 +0200 Subject: [PATCH] [enh] new cli command to restart a job --- cli.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index afb56dd..3fd068a 100644 --- a/cli.py +++ b/cli.py @@ -113,7 +113,19 @@ def stop(job_id, domain=DOMAIN): def resume(job_id, domain=DOMAIN): pass -def restart(job_id, domain=DOMAIN): pass +def restart(job_id, domain=DOMAIN): + response = request_api( + path=f"job/{job_id}/restart", + verb="post", + domain=domain, + check_return_code=False + ) + + if response.status_code == 404: + print(f"Error: no job with the id '{job_id}'") + sys.exit(1) + + assert response.status_code == 200, response.content if __name__ == '__main__':