forked from Sysdeploy/cloud-init-cherrypy
fix: parse more than the first line of metadata
This commit is contained in:
parent
2913a8aa24
commit
534b33fa52
8
main.py
8
main.py
|
@ -76,10 +76,10 @@ class MainApp:
|
||||||
|
|
||||||
filepath = os.path.join(PATH, "data", hostname, meta_data_filename)
|
filepath = os.path.join(PATH, "data", hostname, meta_data_filename)
|
||||||
if os.path.exists(filepath):
|
if os.path.exists(filepath):
|
||||||
with open(filepath, "r") as f:
|
with open(filepath, "r") as metadata:
|
||||||
line = f.readlines()[0]
|
for line in metadata.readlines():
|
||||||
ls = list(map(lambda k: k.strip(), line.split(":")))
|
linesplit = list(map(lambda k: k.strip(), line.split(":")))
|
||||||
data[ls[0]] = ls[1]
|
data[linesplit[0]] = linesplit[1]
|
||||||
|
|
||||||
return yaml.dump(data)
|
return yaml.dump(data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user