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 template_library_configuration option is true: default=false
  (true in aqd.conf.noms)
- Template must be archetype/loadpath (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
Aquilon main user authored and jouvin committed May 27, 2018
1 parent 44b1d06 commit f19fbc0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
2 changes: 2 additions & 0 deletions etc/aqd.conf.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ gzip_output = false
# Assume the webserver will decompress transparently as needed.
# only used if gzip_output = true
transparent_gzip = true
# Generate the template library variant of the plenary object template if true
template_library_configured = 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

# Generate the template library variant of the plenary object template if true
template_library_configured = true


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

[site]
Expand Down
12 changes: 11 additions & 1 deletion lib/aquilon/worker/templates/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
PlenaryPersonalityBase, add_location_info)
from aquilon.worker.templates.panutils import (StructureTemplate, PanValue,
pan_assign, pan_include,
pan_append)
pan_include_if_exists, pan_append)
from aquilon.worker.dbwrappers.cluster import get_cluster_location_preference
from aquilon.worker.locks import CompileKey, PlenaryKey

Expand Down 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 template_library_configured option is true
# This template is optional: included only if it exists
if self.config.getboolean("panc", "template_library_configured"):
pan_include_if_exists(lines, "archetype/loadpath")
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
7 changes: 7 additions & 0 deletions lib/aquilon/worker/templates/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,13 @@ def body(self, lines):
services.sort()
provides.sort()

# Allow settings such as loadpath to be modified by the archetype before anything else happens
# Included only if template_library_configured option is true
# This template is optional: included only if it exists
if self.config.getboolean("panc", "template_library_configured"):
pan_include_if_exists(lines, "archetype/loadpath")
lines.append("")

# Okay, here's the real content
pan_include(lines, ["pan/units", "pan/functions"])
lines.append("")
Expand Down
12 changes: 11 additions & 1 deletion lib/aquilon/worker/templates/metacluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
add_location_info)
from aquilon.worker.templates.panutils import (StructureTemplate, PanValue,
pan_assign, pan_include,
pan_append)
pan_include_if_exists, pan_append)
from aquilon.worker.dbwrappers.cluster import get_cluster_location_preference
from aquilon.worker.locks import CompileKey, PlenaryKey

Expand Down 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 template_library_configured option is true
# This template is optional: included only if it exists
if self.config.getboolean("panc", "template_library_configured"):
pan_include_if_exists(lines, "archetype/loadpath")
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 f19fbc0

Please sign in to comment.