aboutsummaryrefslogtreecommitdiffstats
path: root/userdata/conf/boardready.py
diff options
context:
space:
mode:
Diffstat (limited to 'userdata/conf/boardready.py')
-rw-r--r--userdata/conf/boardready.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/userdata/conf/boardready.py b/userdata/conf/boardready.py
new file mode 100644
index 0000000..ad3ddf5
--- /dev/null
+++ b/userdata/conf/boardready.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+import xmlrpclib
+import ssl
+import sys
+import time
+# bug, ssl chain cannot be verified (letsencrypt)
+ssl._create_default_https_context = ssl._create_unverified_context
+
+#server = xmlrpclib.ServerProxy("https://porter.agl.homelinux.org/RPC2")
+
+print "Starting ..."
+sys.stdout.flush()
+
+arg = None
+
+if len(sys.argv) > 1:
+ arg = sys.argv[1]
+
+if arg == None:
+ print("No argument, need lava jobnumber as argument.")
+ sys.exit(1)
+
+username = "FILL-IN-USERNAME"
+token = "FILL-IN-TOKEN"
+hostname = "porter.agl.homelinux.org"
+
+server = xmlrpclib.ServerProxy("https://%s:%s@%s/RPC2" % (username, token, hostname))
+
+#print(arg)
+#sys.stdout.flush()
+
+# Poll loop
+while True:
+ try:
+ x = server.scheduler.job_status(arg)['job_status']
+ except:
+ print("Error, quitting.")
+ sys.stdout.flush()
+ break
+ if 'Submitted' in x:
+ print("Job submitted - pending")
+ sys.stdout.flush()
+ time.sleep(20)
+ continue
+ if 'Running' in x:
+ print("Job Running now.")
+ print("Remote boot takes around 6 minutes to complete ...")
+ sys.stdout.flush()
+ time.sleep(360)
+ y = server.scheduler.job_status(arg)['job_status']
+ if 'Running' in y:
+ break
+ else:
+ continue
+ break
+ break
+
+# end \ No newline at end of file