Switched to api
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
d5471dacf5
commit
f113d3e779
2 changed files with 20 additions and 11 deletions
|
@ -18,10 +18,10 @@
|
|||
import socket
|
||||
import re
|
||||
import sys
|
||||
from common import send_status, get_status
|
||||
from common import api_send_status, api_get_status
|
||||
|
||||
host = socket.gethostname()
|
||||
port = 12345
|
||||
api = None
|
||||
api_token = None
|
||||
tile = ""
|
||||
status = ""
|
||||
verbose = False
|
||||
|
@ -30,12 +30,12 @@ argc = len(sys.argv)
|
|||
first = True
|
||||
i = 1
|
||||
while i < argc:
|
||||
if sys.argv[i] == "--port":
|
||||
if sys.argv[i] == "-a" or sys.argv[i] == "--api":
|
||||
i += 1
|
||||
port = int(sys.argv[i])
|
||||
elif sys.argv[i] == "--host":
|
||||
api = sys.argv[i]
|
||||
elif sys.argv[i] == "-t" or sys.argv[i] == "--api-token":
|
||||
i += 1
|
||||
host = sys.argv[i]
|
||||
api_token = sys.argv[i]
|
||||
elif sys.argv[i] == "-v" or sys.argv[i] == "--verbose":
|
||||
verbose = True
|
||||
elif sys.argv[i] == "-h" or sys.argv[i] == "--help":
|
||||
|
@ -44,8 +44,8 @@ while i < argc:
|
|||
print("")
|
||||
print(" <file> Terrasync log file")
|
||||
print("OPTIONS")
|
||||
print(" , --host Manager host")
|
||||
print(" , --port Manager port")
|
||||
print(" -a, --api Manager api url")
|
||||
print(" -t, --api-token Manager api token")
|
||||
print(" -v, --verbose Verbose printouts")
|
||||
print(" -h, --help Shows this help and exit")
|
||||
sys.exit(0)
|
||||
|
@ -61,6 +61,14 @@ if lfile == "":
|
|||
print("ERROR: No file given")
|
||||
sys.exit(1)
|
||||
|
||||
if not api:
|
||||
print("ERROR: No api given")
|
||||
sys.exit(1)
|
||||
|
||||
if not api_token:
|
||||
print("ERROR: No api token given")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
tiles = []
|
||||
with open(lfile) as f:
|
||||
|
@ -75,10 +83,10 @@ except IOError:
|
|||
tiles = set(tiles)
|
||||
|
||||
for tile in tiles:
|
||||
status = get_status(tile, host, port)
|
||||
status = api_get_status(tile, api, api_token)
|
||||
if status == "done" or status == "packaged":
|
||||
if verbose:
|
||||
print("Flagging " + tile)
|
||||
send_status(tile, "rebuild", host, port)
|
||||
api_send_status(tile, "rebuild", api, api_token)
|
||||
elif verbose:
|
||||
print("Skipping " + tile + ". Not yet build")
|
||||
|
|
|
@ -82,6 +82,7 @@ if not api:
|
|||
|
||||
if not api_token:
|
||||
print("ERROR: No api token given")
|
||||
sys.exit(1)
|
||||
|
||||
def get_sha1(fname):
|
||||
if os.path.isfile(fname):
|
||||
|
|
Loading…
Reference in a new issue