Skip to content

Commit

Permalink
check_feature_template: allow the features to be in the rootdirectory
Browse files Browse the repository at this point in the history
- Enable sharing of feature definitions between several archetypes

Contributes to quattor#111

Change-Id: Ic15880018c615add765724ff82e24acf337d4912
  • Loading branch information
jouvin authored and Aquilon main user committed Oct 22, 2018
1 parent 0dbd27d commit c51fc14
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/aquilon/worker/dbwrappers/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ def add_link(session, logger, dbfeature, params):

def check_feature_template(config, 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
feature_template_dirs = ['{}/{}/{}'.format(basedir, dbarchetype.name, dbfeature.cfg_path),
'{}/{}'.format(basedir, dbfeature.cfg_path)]

# The broker has no control over the extension used, so we check for
# everything panc accepts
for ext in ('pan', 'tpl'):
if os.path.exists("%s/%s/%s/config.%s" % (basedir, dbarchetype.name,
dbfeature.cfg_path, ext)):
return
for feature_dir in feature_template_dirs:
if os.path.exists("{}/config.{}" .format(feature_dir, ext)):
return

# Legacy path for hardware features
if os.path.exists("%s/%s/%s.%s" % (basedir, dbarchetype.name,
Expand Down

0 comments on commit c51fc14

Please sign in to comment.