1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/1-prep/templates/iiab_env.py.j2

28 lines
661 B
Text
Raw Normal View History

2017-06-01 20:55:49 +00:00
#!/usr/bin/python
# read iiab.env from python
2017-06-01 20:55:49 +00:00
def get_iiab_env(name):
""" read iiab.env file for a value, return "" if does not exist"""
2017-06-01 20:55:49 +00:00
try:
fd = open("{{ iiab_env_file }}","r")
2017-06-01 20:55:49 +00:00
for line in fd:
line = line.lstrip()
line = line.rstrip('\n')
if len(line) == 0:
continue
if line[0] == "#":
continue
if line.find("=") == -1:
continue
chunks = line.split('=')
if chunks[0] == name:
return chunks[1]
return("")
except:
return("")
finally:
fd.close()
if __name__ == "__main__":
print(get_iiab_env("WWWROOT"))