From 21faf5b5d0cebfb50d59c52b78abc1805ccd87fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Sat, 21 Jan 2017 12:13:40 +0000 Subject: Add new configuration parameter: 'check-references' I think missing references to .morph files are way more important that incorrect names or other defects in definitions. I'd like to make ybd to exit when this happen, but lets add a new configuration parameter ans set it to 'warn' instead 'exit' to keep compatibility with older (probably broken) definitions --- ybd/config/ybd.conf | 6 ++++++ ybd/morphs.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ybd/config/ybd.conf b/ybd/config/ybd.conf index 129e1bd..79aea84 100644 --- a/ybd/config/ybd.conf +++ b/ybd/config/ybd.conf @@ -74,6 +74,12 @@ artifact-version: 13 # path to be used in default chroots for builds base-path: ['/usr/bin', '/bin', '/usr/sbin', '/sbin'] +# This set how ybd should react to missing references to .morph files +# Default value is 'warn' to not break previous definitions, +# but we recommend set this it to 'exit' +# possible values are 'ignore', 'warn', 'exit' +check-references: 'warn' + # historically we have not been great at ensuring definitions don't contain # wrong names etc. ybd can react to this via the check-definitions parameter. # possible values are 'ignore', 'warn', 'exit' diff --git a/ybd/morphs.py b/ybd/morphs.py index 4e1059d..3d04dd2 100644 --- a/ybd/morphs.py +++ b/ybd/morphs.py @@ -146,10 +146,12 @@ class Morphs(object): ''' exit = (config.get('check-definitions') == 'exit') + exit_ref = (config.get('check-references') == 'exit') if dn.get('morph'): if not os.path.isfile(dn.get('morph')): - log('DEFINITION', 'WARNING: missing', dn['morph'], exit=exit) + log('DEFINITION', 'WARNING: missing', dn['morph'], + exit=exit_ref) dn['path'] = self._demorph(dn.pop('morph')) if 'path' not in dn: -- cgit v1.2.1