mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
templates: Disable template execution by default
User will have to enable it by enabling it in /etc/network/ifupdown2.conf template_enable=1 Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
# This file contains default settings for ifupdown
|
||||
#
|
||||
|
||||
# enable templates
|
||||
template_enable=0
|
||||
|
||||
# default template engine (only mako is currently supported)
|
||||
template_engine=mako
|
||||
|
||||
|
@@ -577,6 +577,7 @@ class ifupdownMain(ifupdownBase):
|
||||
nifaces = networkInterfaces(self.interfacesfile,
|
||||
self.interfacesfileiobuf,
|
||||
self.interfacesfileformat,
|
||||
template_enable=self.config.get('template_enable', 0),
|
||||
template_engine=self.config.get('template_engine'),
|
||||
template_lookuppath=self.config.get('template_lookuppath'))
|
||||
nifaces.subscribe('iface_found', self._save_iface)
|
||||
|
@@ -32,7 +32,8 @@ class networkInterfaces():
|
||||
|
||||
def __init__(self, interfacesfile='/etc/network/interfaces',
|
||||
interfacesfileiobuf=None, interfacesfileformat='native',
|
||||
template_engine=None, template_lookuppath=None):
|
||||
template_enable='0', template_engine=None,
|
||||
template_lookuppath=None):
|
||||
"""This member function initializes the networkinterfaces parser object.
|
||||
|
||||
Kwargs:
|
||||
|
@@ -14,12 +14,15 @@ from utils import *
|
||||
class templateEngine():
|
||||
""" provides template rendering methods """
|
||||
|
||||
def __init__(self, template_engine, template_lookuppath=None):
|
||||
def __init__(self, template_engine, template_enable='0',
|
||||
template_lookuppath=None):
|
||||
self.logger = logging.getLogger('ifupdown.' +
|
||||
self.__class__.__name__)
|
||||
self.tclass = None
|
||||
self.tclassargs = {}
|
||||
self.render = self._render_default
|
||||
if template_enable == '0':
|
||||
return
|
||||
if template_engine == 'mako':
|
||||
try:
|
||||
self.tclass = utils.importName('mako.template', 'Template')
|
||||
|
Reference in New Issue
Block a user