templates: load from `templates/` directory

This commit is contained in:
Théophile Bastian 2020-03-09 17:36:38 +01:00
parent e310032b36
commit 603ba68f18
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ class Network(util.LibvirtObject):
if self.lxc_network:
raise self.AlreadyExists()
xml = XMLTemplate("templates/network.xml").inst(
xml = XMLTemplate("network.xml").inst(
name=self.name,
uuid=self.uuid,
bridge_id=self.bridge_id,

View File

@ -7,7 +7,7 @@ import jinja2
class XMLTemplate:
""" Reads and instanciates a template from a file """
base_path = os.path.dirname(os.path.abspath(__file__))
base_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates")
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(base_path),
autoescape=jinja2.select_autoescape(