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)
|
||||
if os.path.exists(filepath):
|
||||
with open(filepath, "r") as f:
|
||||
line = f.readlines()[0]
|
||||
ls = list(map(lambda k: k.strip(), line.split(":")))
|
||||
data[ls[0]] = ls[1]
|
||||
with open(filepath, "r") as metadata:
|
||||
for line in metadata.readlines():
|
||||
linesplit = list(map(lambda k: k.strip(), line.split(":")))
|
||||
data[linesplit[0]] = linesplit[1]
|
||||
|
||||
return yaml.dump(data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user