Skip to content

Commit

Permalink
Include an archetype preface template in the plenary object
Browse files Browse the repository at this point in the history
- Only if object_declarations_template option is true: default=false
  (true in aqd.conf.noms)
- Template must be archetype/declarations (intended to define LOADPATH mainly)
- It is the first executed template in the plenary object
- Implemented for host, cluster and metacluster

Fixes #86

Change-Id: I7e57401fc82bfbc5af21d3d07efe543e999c23e6
  • Loading branch information
jouvin committed May 31, 2018
1 parent 591131b commit 129cf74
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions etc/aqd.conf.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ gzip_output = false
# only used if gzip_output = true
transparent_gzip = true
template_extension = .tpl
object_declarations_template = false

[tool_timeout]
# If set to True, timeout will be set to 'default_value' for any tools run via subprocess
Expand Down
4 changes: 4 additions & 0 deletions etc/aqd.conf.noms
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ location_uri_validator = /bin/true
# in raw mode and set the version variable itself.
pan_compiler = /usr/lib/panc.jar

# Include a preface template in the object template if true
object_declarations_template = true


###############################################################################

[site]
Expand Down
10 changes: 10 additions & 0 deletions lib/aquilon/worker/templates/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,17 @@ def get_key(self, exclusive=True):
return CompileKey.merge(keylist)

def body(self, lines):
# Allow settings such as loadpath to be modified by the archetype before anything else happens
# Included only if object_declarations_template option is true
# It the option is true, the template MUST exist
if self.config.getboolean("panc", "object_declarations_template"):
pan_include(lines, "archetype/declarations")
lines.append("")

pan_include(lines, ["pan/units", "pan/functions"])
lines.append("")

# Okay, here's the real content
path = PlenaryClusterData.template_name(self.dbobj)
pan_assign(lines, "/",
StructureTemplate(path,
Expand Down
9 changes: 8 additions & 1 deletion lib/aquilon/worker/templates/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,17 @@ def body(self, lines):
services.sort()
provides.sort()

# Okay, here's the real content
# Allow settings such as loadpath to be modified by the archetype before anything else happens
# Included only if object_declarations_template option is true
# It the option is true, the template MUST exist
if self.config.getboolean("panc", "object_declarations_template"):
pan_include(lines, "archetype/declarations")
lines.append("")

pan_include(lines, ["pan/units", "pan/functions"])
lines.append("")

# Okay, here's the real content
path = PlenaryHostData.template_name(self.dbobj)
pan_assign(lines, "/",
StructureTemplate(path,
Expand Down
10 changes: 10 additions & 0 deletions lib/aquilon/worker/templates/metacluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,17 @@ def get_key(self, exclusive=True):
return CompileKey.merge(keylist)

def body(self, lines):
# Allow settings such as loadpath to be modified by the archetype before anything else happens
# Included only if object_declarations_template option is true
# It the option is true, the template MUST exist
if self.config.getboolean("panc", "object_declarations_template"):
pan_include(lines, "archetype/declarations")
lines.append("")

pan_include(lines, ["pan/units", "pan/functions"])
lines.append("")

# Okay, here's the real content
pan_assign(lines, "/",
StructureTemplate("clusterdata/%s" % self.dbobj.name,
{"metadata": PanValue("/metadata")}))
Expand Down

0 comments on commit 129cf74

Please sign in to comment.