diff --git a/etc/aqd.conf.defaults b/etc/aqd.conf.defaults index 82e79bad7..3a786a1ad 100644 --- a/etc/aqd.conf.defaults +++ b/etc/aqd.conf.defaults @@ -350,6 +350,9 @@ gzip_output = false transparent_gzip = true template_extension = .tpl object_declarations_template = false +# When true, only display a warning if a feature template doesn't +# exist in a domain Git repository +relaxed_feature_template_check = False [tool_timeout] # If set to True, timeout will be set to 'default_value' for any tools run via subprocess diff --git a/lib/aquilon/worker/commands/bind_feature.py b/lib/aquilon/worker/commands/bind_feature.py index 20e7163f6..2d1813af0 100755 --- a/lib/aquilon/worker/commands/bind_feature.py +++ b/lib/aquilon/worker/commands/bind_feature.py @@ -141,7 +141,7 @@ def do_link(self, session, logger, dbfeature, params): q = q.filter(or_(*filters)) for dbdomain in q: - check_feature_template(self.config, dbarchetype, dbfeature, + check_feature_template(self.config, logger, dbarchetype, dbfeature, dbdomain) add_link(session, logger, dbfeature, params) diff --git a/lib/aquilon/worker/commands/manage_list.py b/lib/aquilon/worker/commands/manage_list.py index e6a014afe..0cbc8850c 100755 --- a/lib/aquilon/worker/commands/manage_list.py +++ b/lib/aquilon/worker/commands/manage_list.py @@ -181,7 +181,7 @@ def render(self, session, logger, plenaries, domain, sandbox, force, for dbarch, featureset in features.items(): for dbfeature in featureset: - check_feature_template(self.config, dbarch, dbfeature, + check_feature_template(self.config, logger, dbarch, dbfeature, dbbranch) for dbobj in objects: diff --git a/lib/aquilon/worker/dbwrappers/feature.py b/lib/aquilon/worker/dbwrappers/feature.py index 2d90b5617..d800da2c8 100644 --- a/lib/aquilon/worker/dbwrappers/feature.py +++ b/lib/aquilon/worker/dbwrappers/feature.py @@ -27,7 +27,6 @@ from aquilon.worker.templates import PlenaryHost, PlenaryPersonality from aquilon.worker.templates.domain import template_branch_basedir - def add_link(session, logger, dbfeature, params): FeatureLink.get_unique(session, feature=dbfeature, preclude=True, **params) @@ -59,7 +58,7 @@ def add_link(session, logger, dbfeature, params): dbfeature.links.append(FeatureLink(**params)) -def check_feature_template(config, dbarchetype, dbfeature, dbdomain): +def check_feature_template(config, logger, dbarchetype, dbfeature, dbdomain): basedir = template_branch_basedir(config, dbdomain) # Features can be defined either in the archetype directory or as # features shared by all the archetypes if they are defined in basedir @@ -73,8 +72,12 @@ def check_feature_template(config, dbarchetype, dbfeature, dbdomain): if os.path.exists("{}/config.{}" .format(feature_dir, ext)): return - raise ArgumentError("{0} does not have templates present in {1:l} " - "for {2:l}.".format(dbfeature, dbdomain, dbarchetype)) + if config.getboolean("panc", "relaxed_feature_template_check"): + logger.client_info("WARNING: {0} templates not present in {1:l} for {2:l} " + "(assumed to be present in plenary templates).".format(dbfeature, dbdomain, dbarchetype)) + else: + raise ArgumentError("{0} does not have templates present in {1:l} " + "for {2:l}.".format(dbfeature, dbdomain, dbarchetype)) def get_affected_plenaries(session, dbfeature, plenaries, diff --git a/lib/aquilon/worker/dbwrappers/host.py b/lib/aquilon/worker/dbwrappers/host.py index fff7b6f4d..322b03d65 100644 --- a/lib/aquilon/worker/dbwrappers/host.py +++ b/lib/aquilon/worker/dbwrappers/host.py @@ -84,7 +84,7 @@ def create_host(session, logger, config, dbhw, dbarchetype, domain=None, pre, post = host_features(dbstage) hw_features = hardware_features(dbstage, dbhw.model) for dbfeature in pre | post | hw_features: - check_feature_template(config, dbarchetype, dbfeature, dbbranch) + check_feature_template(config, logger, dbarchetype, dbfeature, dbbranch) if not osname: if config.has_option(section, "default_osname"):