]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Dump generated configs from templates to stdout
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 19 Nov 2020 11:41:45 +0000 (12:41 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 19 Nov 2020 14:55:46 +0000 (15:55 +0100)
dockerdata/startup.py

index 4e09b2932947e390d9fc01d68d9b208bbafbbd74..7819cc306e266c8e68ae90e1a100a3c5b1b69df4 100755 (executable)
@@ -50,6 +50,7 @@ if apikey is not None:
     conffile = os.path.join(templatedestination, '_api.conf')
     with open(conffile, 'w') as f:
         f.write(webserver_conf)
+    print("Created {} with content:\n{}\n".format(conffile, webserver_conf))
 
 templates = os.getenv('TEMPLATE_FILES')
 if templates is not None:
@@ -58,7 +59,9 @@ if templates is not None:
         with open(os.path.join(templateroot, templateFile + '.j2')) as f:
             template = jinja2.Template(f.read())
         rendered = template.render(os.environ)
-        with open(os.path.join(templatedestination, templateFile + '.conf'), 'w') as f:
+        target = os.path.join(templatedestination, templateFile + '.conf')
+        with open(target, 'w') as f:
             f.write(rendered)
+        print("Created {} with content:\n{}\n".format(target, rendered))
 
 os.execv(program, [program]+args+sys.argv[1:])