Commit 16353e6f authored by Stansberry, Dale's avatar Stansberry, Dale
Browse files

- Clean-up collectNodeInfo function

parent bdfe6e1b
Pipeline #2795 skipped
......@@ -25,18 +25,20 @@ def collectNodeInfo():
nodenameset.add(line.strip())
nodenamelist = list( nodenameset )
# TODO This impl is inefficient
for nodename in nodenamelist:
# need to replace with re.match
hostsfile = open( '/etc/hosts', 'r' )
output = []
for line in hostsfile:
if len( line.strip().split()) > 2:
if re.match(nodename+'\\b',line.strip().split()[2]):
hostdict={"IP":line.strip().split()[0], \
"FULLNAME": line.strip().split()[1], \
"NAME": line.strip().split()[2].lower()}
hostlist.append(hostdict)
tokens = line.strip().split()
for nodename in nodenamelist:
if len( tokens ) > 2:
if re.match(nodename+'\\b',tokens[2]):
hostdict={
"IP": tokens[0],
"FULLNAME": tokens[1],
"NAME": tokens[2].lower()
}
hostlist.append( hostdict )
break
return hostlist
def createConfigDirs( hostname ):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment