More debugging

This commit is contained in:
Lord Anton Hvornum 2018-04-08 13:06:52 +02:00
parent 3059b1d504
commit dff83ac7b8
1 changed files with 26 additions and 18 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
import traceback
import psutil, os, re, struct, sys, json import psutil, os, re, struct, sys, json
import urllib.request, urllib.parse import urllib.request, urllib.parse
from glob import glob from glob import glob
@ -154,8 +155,12 @@ if __name__ == '__main__':
## == If we got networking, ## == If we got networking,
# Try fetching instructions for this box and execute them. # Try fetching instructions for this box and execute them.
instructions = {}
if get_default_gateway_linux(): if get_default_gateway_linux():
locmac = get_local_MACs() locmac = get_local_MACs()
if not len(locmac):
print('[N] No network interfaces - No net deploy.')
else:
for mac in locmac: for mac in locmac:
try: try:
instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac)) instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac))
@ -168,6 +173,7 @@ if __name__ == '__main__':
instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict) instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
except: except:
print('[E] JSON instructions failed to load for {}'.format(mac)) print('[E] JSON instructions failed to load for {}'.format(mac))
traceback.print_exc()
instructions = {} instructions = {}
sleep(5) sleep(5)
continue continue
@ -175,6 +181,8 @@ if __name__ == '__main__':
if 'args' in instructions: if 'args' in instructions:
for key, val in instructions['args'].items(): for key, val in instructions['args'].items():
args[key] = val args[key] = val
else:
print('[N] No gateway - No net deploy')
print(args) print(args)