From ec1096d8c0d897ebd1ea445d9c5404a13c33ce2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 1 Sep 2017 00:22:47 +0200 Subject: Add install scripts --- python/ovh_helper.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 python/ovh_helper.py (limited to 'python/ovh_helper.py') diff --git a/python/ovh_helper.py b/python/ovh_helper.py new file mode 100644 index 0000000..a49a245 --- /dev/null +++ b/python/ovh_helper.py @@ -0,0 +1,19 @@ +import time + +def show_progress(client, vps, task_type): + running_task_id = client.get("/vps/{}/tasks?type={}".format(vps, task_type))[0] + + progress = 0 + state = "todo" + print(" 0 %", end='') + while state != "done": + old_progress = progress + task = client.get("/vps/{}/tasks/{}".format(vps, running_task_id)) + progress = task["progress"] + state = task["state"] + + if progress != old_progress: + print("\r{:>3} %".format(progress), end="") + time.sleep(3) + + print("\rFinished") -- cgit v1.2.3