forked from batrick/ceph-linode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinode-wait.py
More file actions
35 lines (27 loc) · 806 Bytes
/
linode-wait.py
File metadata and controls
35 lines (27 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import binascii
import logging
import os
import time
import linode.api as linapi
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s')
with open("LINODE_GROUP") as f:
GROUP = unicode(f.read().strip())
def wait(key):
client = linapi.Api(key = key, batching = False)
notdone = True
while notdone:
linodes = client.linode_list()
print(linodes)
notdone = False
for linode in linodes:
if linode[u'LPM_DISPLAYGROUP'] == GROUP:
if linode[u'STATUS'] != 1:
notdone = True
time.sleep(5)
def main():
key = os.getenv("LINODE_API_KEY")
if key is None:
raise RuntimeError("please specify Linode API key")
wait(key)
if __name__ == "__main__":
main()