This commit is contained in:
parent
0cb496b818
commit
4f0d01aab0
2 changed files with 6 additions and 5 deletions
|
@ -17,7 +17,6 @@ def find_os(content):
|
|||
osystem = [line.split("=")[-1] for line in version.splitlines() if line.startswith("ID=")]
|
||||
if osystem:
|
||||
return osystem[0]
|
||||
print(content)
|
||||
if "ID" in jcontent:
|
||||
return jcontent["ID"]
|
||||
return "freebox"
|
||||
|
@ -30,6 +29,7 @@ def main():
|
|||
env = Environment(loader = FileSystemLoader('../template'))
|
||||
|
||||
for file in onlyfiles:
|
||||
print("opening {} file ...".format(file.split("/")[-1]))
|
||||
with open(file,"r") as f:
|
||||
content = f.read()
|
||||
current_os = find_os(content)
|
||||
|
@ -37,13 +37,10 @@ def main():
|
|||
infos = parse_freebsd(content)
|
||||
template = env.get_template('freebsd.rst.j2')
|
||||
output = template.render(**infos)
|
||||
print(output)
|
||||
elif "debian" in current_os:
|
||||
infos = parse_debian(content)
|
||||
template = env.get_template('debian.rst.j2')
|
||||
output = template.render(**infos)
|
||||
print(output)
|
||||
|
||||
else:
|
||||
parse_freebox(content)
|
||||
with open("../source/devices/{host}.rst".format(host=infos["hostname"].replace("\n","")), "w") as f:
|
||||
|
|
|
@ -15,7 +15,11 @@ interface adresses
|
|||
routes
|
||||
######
|
||||
|
||||
{{ routes }}
|
||||
============ =============== ==============
|
||||
destination gateway interface
|
||||
============ =============== =============={% for route in routes %}
|
||||
{{ "{:<12}".format(route["destination"]) }} {{ "{:<15}".format(route["gateway"]) }} {{ route["iface"] }}{% endfor %}
|
||||
============ =============== ==============
|
||||
|
||||
services
|
||||
--------
|
||||
|
|
Loading…
Add table
Reference in a new issue