From 9af137c6607d9cb043b85e183c7556f858d67401 Mon Sep 17 00:00:00 2001 From: brent s Date: Thu, 4 May 2017 03:10:19 -0400 Subject: [PATCH] ... we should probably pop it in earlier. --- aifclient.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/aifclient.py b/aifclient.py index b54eae5..358fce7 100755 --- a/aifclient.py +++ b/aifclient.py @@ -334,6 +334,31 @@ class aif(object): # if not aifdict['scripts'][scripttype]: # aifdict['scripts'][scripttype] = {} # aifdict['scripts'][scripttype][int(x.attrib['order'])] = {} + if xmlobj.find('scripts') is not None: + aifdict['scripts']['pre'] = [] + aifdict['scripts']['post'] = [] + tempscriptdict = {'pre': {}, 'post': {}} + for x in xmlobj.find('scripts'): + if all(keyname in list(x.attrib.keys()) for keyname in ('user', 'password')): + auth = {} + auth['user'] = x.attrib['user'] + auth['password'] = x.attrib['password'] + if 'realm' in x.attrib.keys(): + auth['realm'] = x.attrib['realm'] + if 'authtype' in x.attrib.keys(): + auth['type'] = x.attrib['authtype'] + scriptcontents = self.webFetch(x.attrib['uri'], auth).decode('utf-8') + else: + scriptcontents = self.webFetch(x.attrib['uri']).decode('utf-8') + if x.attrib['bootstrap'].lower() in ('true', '1'): + tempscriptdict['pre'][x.attrib['order']] = scriptcontents + else: + tempscriptdict['post'][x.attrib['order']] = scriptcontents + for d in ('pre', 'post'): + keylst = list(tempscriptdict[d].keys()) + keylst.sort() + for s in keylst: + aifdict['scripts'][d].append(tempscriptdict[d][s]) return(aifdict) class archInstall(object): @@ -569,7 +594,6 @@ class archInstall(object): resolvers = False if 'resolvers' in self.network['ifaces'][iface].keys(): resolvers = self.network['ifaces'][iface]['resolvers'] - print(resolvers) if iface == 'auto': ifacedev = autoiface iftype = 'dhcp'