Commit 101fc844 authored by Franco Fichtner's avatar Franco Fichtner

templates: remove files in the way of directories

Way better fix for the squid file transition.  Does not require
a manual restart anymore.
parent a8f0e841
#!/bin/sh
# XXX Used to be a flat file, but we need a pluggable
# XXX directory. Can safely remove this post-17.1.
RC_CONF_D="/etc/rc.conf.d/squid"
if [ -f ${RC_CONF_D} ]; then
rm ${RC_CONF_D}
fi
SQUID_DIRS="/var/log/squid /var/run/squid /var/squid /var/squid/cache /var/squid/ssl /var/squid/logs"
for SQUID_DIR in ${SQUID_DIRS}; do
......
......@@ -190,8 +190,11 @@ class Template(object):
for fpart in filename.strip().split('/')[:-1]:
fparts.append(fpart)
if len(fpart) > 1:
if not os.path.exists('/'.join(fparts)):
os.mkdir('/'.join(fparts))
tmppart = '/'.join(fparts);
if os.path.isfile(tmppart):
os.remove(tmppart)
if not os.path.exists(tmppart):
os.mkdir(tmppart)
def _generate(self, module_name, create_directory=True):
""" generate configuration files for one section using bound config and template data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment