add pretty routes debian
All checks were successful
/ test (push) Successful in 32s

This commit is contained in:
Michaël Ricart 2025-02-27 15:20:16 +01:00
parent 0cb496b818
commit 4f0d01aab0
2 changed files with 6 additions and 5 deletions

View file

@ -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:

View file

@ -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
--------