]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
ifupdown: disable template execution by default
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Mon, 11 Jul 2016 03:28:53 +0000 (20:28 -0700)
committerJulien Fortin <julien@cumulusnetworks.com>
Fri, 15 Jul 2016 12:16:11 +0000 (13:16 +0100)
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>
config/ifupdown2.conf
ifupdown/ifupdownmain.py
ifupdown/networkinterfaces.py
ifupdown/template.py

index 906fdea19be03fa717152bd0e161971b27841551..3f954845bbb3a72ad428517f803e9b27069d6553 100644 (file)
@@ -5,7 +5,7 @@
 #
 
 # enable templates
-template_enable=1
+template_enable=0
 
 # default template engine (only mako is currently supported)
 template_engine=mako
index ed9ad53d15661e98dc836e59d2aceb4f6ca5f358..c5ca77ae5672362674c9406f38edd013394f7df8 100644 (file)
@@ -762,6 +762,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'))
         if self._ifaceobj_squash or self._ifaceobj_squash_internal:
index eacf386e8a9fab704c040f0472afb9433892d017..bc7749d04bf4c3698bbc1be7a60cb7026299d8cf 100644 (file)
@@ -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:
index f1792ccfbe7d0b15676d43b21d2f14df7711f706..d315dddbfef7df5c0a95ac9b2aa35afb3ad8f344 100644 (file)
@@ -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')