Skip to content

Commit

Permalink
Define an ARCHETYPE variable if template_library_configured is true
Browse files Browse the repository at this point in the history
- This variable reflects Aquilon configuration and cannot be modified (final)
- Define LOADPATH based on this variable

Change-Id: Ice4559238bb36e299fc0f172c2fc13f357c9f13f
  • Loading branch information
jouvin committed May 27, 2018
1 parent 311ce0c commit c799db9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/aquilon/worker/templates/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,17 @@ def _generate_content(self):
lines.append("object template %s;" % self.template_name(self.dbobj))
lines.append("")

loadpath = self.loadpath(self.dbobj)
if loadpath:
pan_variable(lines, "LOADPATH", [loadpath])
if self.loadpath(self.dbobj):
# If configuration option template_library_configured is true, define
# an ARCHETYPE variable with the host archetype and use it to initialize
# LOADPATH variable
if self.config.getboolean("panc", "template_library_configured"):
archetype_var_name = "ARCHETYPE"
pan_variable(lines, archetype_var_name, self.loadpath(self.dbobj), final=True)
# Define LOADPATH based on ARCHETYPE variabble
pan_variable(lines, "LOADPATH", [archetype_var_name], quoted=False)
else:
pan_variable(lines, "LOADPATH", [self.loadpath(self.dbobj)])
lines.append("")
pan_assign(lines, "/metadata/template/branch/name",
self.dbobj.branch.name)
Expand Down

0 comments on commit c799db9

Please sign in to comment.