summaryrefslogtreecommitdiffstats
path: root/lava-slave/scripts/getworkertoken.py
blob: f538960e7b95d0b8ac7c574cfc7dd2f2034df1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python3

import xmlrpc.client
import sys

if len(sys.argv) < 3:
    print("ERROR: Usage: %s URI workername" % sys.argv[0])
    sys.exit(1)

server = xmlrpc.client.ServerProxy("%s" % sys.argv[1])
wdet = server.scheduler.workers.show("%s" % sys.argv[2])
if "token" in wdet:
    print(wdet["token"])
    sys.exit(0)
sys.exit(1)