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
Aquilon main user authored and jouvin committed May 30, 2018
1 parent 591131b commit 1d15fa1
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 0 deletions.
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
150 changes: 150 additions & 0 deletions etc/aqd.conf.lal
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# This config file is for running the broker outside of MS where no afs available.
# Modify tool_locations and other configuration sections to provide appropriate values
# before moving config to /etc/aqd.conf (or other location defined as AQDCONF env variable).

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

[DEFAULT]
basedir = /pdisk
vardir = %(quattordir)s/var
# The broker does not rely on 'user' for anything security-related...
# user = # config.py supplies os.environ.get("USER") as a default
# srcdir = # config.py supplies a custom _get_srcdir() as a default
# hostname = # config.py supplies socket.gethostname() as a default

[broker]
# Default Organization model name value
default_organization = AquilonOrg

# Directory for log files
logdir = %(vardir)s/logs

rundir = %(vardir)s/run

# Aquilon keytab location
keytab = %(vardir)s/keytab/%(service)s

# Database file containing info about shares
sharedata =

# Git daemon related options
run_git_daemon = True
git_daemon_basedir = %(basedir)s

# Used by refresh_grns
grn_to_eonid_map_location =

# Could be repaced with /etc/passwd, used by refresh_user
user_list_location =

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

[database]
database_section = database_postgresql
#database_section = database_sqlite

[database_postgresql]
dbname = aquilon

[database_sqlite]
dbfile = /pdisk/aquilon/db/aquilon.db

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

[dsdb]
enable = False

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

[tool_locations]
# If option is set to empty value
# tool will default to binary available in PATH

# Not Applicable outside MS
dsdb = /bin/true

# default to binary available in PATH
ssh =

# Network related tools
switch_discover =
# Raw Network data used by refresh_network command
qip_dump_subnetdata =
# Used in poll_net_device command, path to binary
vlan2net =

# default to binary available in PATH
# Used by poll network device command
get_camtable =

# Used by pxeswitch command
aii_installfe =

# Used by get command
mean = %(srcdir)s/tests/fakebin/fake_mean

# Git config
# default to binary available in PATH
git =
git_daemon = /usr/libexec/git-core/git-daemon

# default to binary available in PATH
knc =

# Kerberos config
# default to binary available in PATH
krb5_keytab =
klist =

# Path to Authorisation service
aqd_checkedm = /bin/true

# Java config
# default to binary available in PATH
java_home =
ant_home = /usr/share/ant
ant_contrib_jar = /usr/share/java/ant/ant-contrib.jar
ant =

location_uri_validator = /bin/true

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

[panc]

# The update_domain command expects to be able to read this value
# in raw mode and set the version variable itself.
pan_compiler = /usr/lib/panc.jar
# Option passed to panc the output format that it uses
xml_profiles = false
json_profiles = true
gzip_output = false
# Assume the webserver will decompress transparently as needed.
# only used if gzip_output = true
transparent_gzip = true
template_extension = .pan
include_pan = false

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

[site]
# Site specific settings
default_hardware_label_regex = ^[a-z][a-z0-9]{,62}$

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

# Interface types that require specific names should be added as key for this
# configuration section. If an interface type is not specified here,
# any interface name format will be allowed
[interface_name_regex]
# Interface model name field validation regex
public = ^[a-z]+\d+[a-z]?$
management = ^[a-z]+\d*$
vlan = ^[a-z]+\d*\.[1-9]\d*$
# Linux: ncm-networks wants "bond.*", but Netapp is more relaxed
bonding = ^[a-z]+\d+$

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

[protocols]
directory = /pdisk/quattor/.venv/lib/python2.7/site-packages
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
9 changes: 9 additions & 0 deletions lib/aquilon/worker/templates/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,16 @@ 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", "object_declarations_template"):
pan_include(lines, "archetype/declarations")
lines.append("")

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

# 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", "object_declarations_template"):
pan_include(lines, "archetype/declarations")
lines.append("")

# Okay, here's the real content
pan_include(lines, ["pan/units", "pan/functions"])
lines.append("")
Expand Down
9 changes: 9 additions & 0 deletions lib/aquilon/worker/templates/metacluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ 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", "object_declarations_template"):
pan_include(lines, "archetype/declarations")
lines.append("")

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

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

0 comments on commit 1d15fa1

Please sign in to comment.