Fixing offline deployment a bit
This commit is contained in:
parent
d89bacdf9f
commit
a83b21ec01
|
|
@ -696,29 +696,37 @@ def get_application_instructions(target):
|
||||||
|
|
||||||
return instructions
|
return instructions
|
||||||
|
|
||||||
|
def get_local_instructions(target):
|
||||||
|
instructions = oDict()
|
||||||
|
local_path = './deployments' if os.path.isfile('./archinstall.py') else './archinstall/deployments' # Dangerous assumption
|
||||||
|
if os.path.isfile(f'{local_path}/{target}.json'):
|
||||||
|
with open(f'{local_path}/{target}.json', 'r') as fh:
|
||||||
|
instructions = fh.read()
|
||||||
|
|
||||||
|
print('[N] Found local instructions called: {}'.format(target))
|
||||||
|
else:
|
||||||
|
print('[N] No instructions found called: {}'.format(target))
|
||||||
|
return instructions
|
||||||
|
|
||||||
def get_instructions(target, *positionals, **kwargs):
|
def get_instructions(target, *positionals, **kwargs):
|
||||||
instructions = oDict()
|
instructions = oDict()
|
||||||
try:
|
if get_default_gateway_linux():
|
||||||
instructions = grab_url_data('{}/{}.json'.format(args['profiles-path'], target)).decode('UTF-8')
|
try:
|
||||||
print('[N] Found net-deploy instructions called: {}'.format(target))
|
instructions = grab_url_data('{}/{}.json'.format(args['profiles-path'], target)).decode('UTF-8')
|
||||||
except urllib.error.HTTPError:
|
print('[N] Found net-deploy instructions called: {}'.format(target))
|
||||||
print('[N] Could not find remote instructions. Trying local instructions under ./deployments')
|
except urllib.error.HTTPError:
|
||||||
local_path = './deployments' if os.path.isfile('./archinstall.py') else './archinstall/deployments' # Dangerous assumption
|
print('[N] Could not find remote instructions. Trying local instructions under ./deployments')
|
||||||
if os.path.isfile(f'{local_path}/{target}.json'):
|
isntructions = get_local_instructions(target, *positionals)
|
||||||
with open(f'{local_path}/{target}.json', 'r') as fh:
|
else:
|
||||||
instructions = fh.read()
|
isntructions = get_local_instructions(target, *positionals)
|
||||||
|
|
||||||
print('[N] Found local instructions called: {}'.format(target))
|
if type(instructions) in (dict, oDict):
|
||||||
else:
|
try:
|
||||||
print('[N] No instructions found called: {}'.format(target))
|
instructions = json.loads(instructions, object_pairs_hook=oDict)
|
||||||
return instructions
|
except:
|
||||||
|
print('[E] JSON syntax error in {}'.format('{}/{}.json'.format(args['profiles-path'], target)))
|
||||||
try:
|
traceback.print_exc()
|
||||||
instructions = json.loads(instructions, object_pairs_hook=oDict)
|
exit(1)
|
||||||
except:
|
|
||||||
print('[E] JSON syntax error in {}'.format('{}/{}.json'.format(args['profiles-path'], target)))
|
|
||||||
traceback.print_exc()
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
return instructions
|
return instructions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue