More debugging
This commit is contained in:
parent
3059b1d504
commit
dff83ac7b8
|
|
@ -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,27 +155,34 @@ 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()
|
||||||
for mac in locmac:
|
if not len(locmac):
|
||||||
try:
|
print('[N] No network interfaces - No net deploy.')
|
||||||
instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac))
|
else:
|
||||||
except urllib.error.HTTPError:
|
for mac in locmac:
|
||||||
print('[N] No instructions for this box on this mac: {}'.format(mac))
|
try:
|
||||||
continue
|
instructions = grab_url_data('https://raw.githubusercontent.com/Torxed/archinstall/net-deploy/deployments/{}.json'.format(mac))
|
||||||
|
except urllib.error.HTTPError:
|
||||||
#print('Decoding:', instructions)
|
print('[N] No instructions for this box on this mac: {}'.format(mac))
|
||||||
try:
|
continue
|
||||||
instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
|
|
||||||
except:
|
#print('Decoding:', instructions)
|
||||||
print('[E] JSON instructions failed to load for {}'.format(mac))
|
try:
|
||||||
instructions = {}
|
instructions = json.loads(instructions.decode('UTF-8'), object_pairs_hook=oDict)
|
||||||
sleep(5)
|
except:
|
||||||
continue
|
print('[E] JSON instructions failed to load for {}'.format(mac))
|
||||||
|
traceback.print_exc()
|
||||||
|
instructions = {}
|
||||||
|
sleep(5)
|
||||||
|
continue
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue