diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-09-01 00:22:47 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2017-09-01 00:42:25 +0200 |
commit | ec1096d8c0d897ebd1ea445d9c5404a13c33ce2e (patch) | |
tree | 2f81f476207059287c991e19d390f89e4bb5c5ab /python/ovh_helper.py | |
parent | 548061112d2e2627317f9379d2f501fcf3f6ea54 (diff) | |
download | Puppet-ec1096d8c0d897ebd1ea445d9c5404a13c33ce2e.tar.gz Puppet-ec1096d8c0d897ebd1ea445d9c5404a13c33ce2e.tar.zst Puppet-ec1096d8c0d897ebd1ea445d9c5404a13c33ce2e.zip |
Add install scripts
Diffstat (limited to 'python/ovh_helper.py')
-rw-r--r-- | python/ovh_helper.py | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ | |||
1 | import time | ||
2 | |||
3 | def show_progress(client, vps, task_type): | ||
4 | running_task_id = client.get("/vps/{}/tasks?type={}".format(vps, task_type))[0] | ||
5 | |||
6 | progress = 0 | ||
7 | state = "todo" | ||
8 | print(" 0 %", end='') | ||
9 | while state != "done": | ||
10 | old_progress = progress | ||
11 | task = client.get("/vps/{}/tasks/{}".format(vps, running_task_id)) | ||
12 | progress = task["progress"] | ||
13 | state = task["state"] | ||
14 | |||
15 | if progress != old_progress: | ||
16 | print("\r{:>3} %".format(progress), end="") | ||
17 | time.sleep(3) | ||
18 | |||
19 | print("\rFinished") | ||