mirror of
https://github.com/puppetlabs/infinitory.git
synced 2026-01-26 02:08:41 -05:00
Move directory creation into output_html in perparation for parameterizing it
This commit is contained in:
parent
c0b6f87bba
commit
3f0ae46db0
1 changed files with 5 additions and 4 deletions
|
|
@ -18,6 +18,11 @@ from sreinventory.inventory import Inventory
|
||||||
from simplepup import puppetdb
|
from simplepup import puppetdb
|
||||||
|
|
||||||
def output_html(inventory, directory):
|
def output_html(inventory, directory):
|
||||||
|
if os.path.isdir(directory):
|
||||||
|
shutil.rmtree(directory)
|
||||||
|
os.mkdir(directory, 0o755)
|
||||||
|
shutil.copytree("static", "{}/static".format(directory))
|
||||||
|
|
||||||
with open("{}/pygments.css".format(directory), "w", encoding="utf-8") as css:
|
with open("{}/pygments.css".format(directory), "w", encoding="utf-8") as css:
|
||||||
css.write(pygments.formatters.HtmlFormatter().get_style_defs('.codehilite'))
|
css.write(pygments.formatters.HtmlFormatter().get_style_defs('.codehilite'))
|
||||||
|
|
||||||
|
|
@ -165,8 +170,4 @@ def main():
|
||||||
except paramiko.ssh_exception.SSHException as e:
|
except paramiko.ssh_exception.SSHException as e:
|
||||||
sys.exit("PuppetDB connection (SSH): {}".format(e))
|
sys.exit("PuppetDB connection (SSH): {}".format(e))
|
||||||
|
|
||||||
if os.path.isdir("output"):
|
|
||||||
shutil.rmtree("output")
|
|
||||||
os.mkdir("output", 0o755)
|
|
||||||
shutil.copytree("static", "output/static")
|
|
||||||
output_html(inventory, "output")
|
output_html(inventory, "output")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue