|
|
@ -2,11 +2,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
import jinja2
|
|
|
|
import jinja2
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
import logging as log
|
|
|
|
convert = lambda src, dst, args: open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
args = os.environ.copy()
|
|
|
|
args = os.environ.copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.basicConfig(stream=sys.stderr, level=args["LOG_LEVEL"] if "LOG_LEVEL" in args else "WARN")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convert(src, dst, args):
|
|
|
|
|
|
|
|
logger = log.getLogger("convert()")
|
|
|
|
|
|
|
|
logger.debug("Source: %s, Destination: %s", src, dst)
|
|
|
|
|
|
|
|
open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
|
|
|
|
|
|
|
|
|
|
|
|
# Get the first DNS server
|
|
|
|
# Get the first DNS server
|
|
|
|
with open("/etc/resolv.conf") as handle:
|
|
|
|
with open("/etc/resolv.conf") as handle:
|
|
|
|
content = handle.read().split()
|
|
|
|
content = handle.read().split()
|
|
|
|