[elbe-devel] [PATCH 1/2] Assert that the buildtype in XML is valid

Torben Hohn torben.hohn at linutronix.de
Tue Jul 2 12:09:32 CEST 2019


On Thu, Jun 27, 2019 at 05:58:21PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

> ---
>  elbepack/xmldefaults.py | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/elbepack/xmldefaults.py b/elbepack/xmldefaults.py
> index 9793d2f3..1979b67d 100644
> --- a/elbepack/xmldefaults.py
> +++ b/elbepack/xmldefaults.py
> @@ -200,14 +200,9 @@ class ElbeDefaults(object):
>  
>      def __init__(self, build_type):
>  
> -        if build_type not in defaults:
> -            print("Please specify a valid buildtype.")
> -            print("Valid buildtypes:")
> -            print(defaults.keys())
> -            print("Please specify a valid buildtype.")
> -            print("Valid buildtypes:")
> -            print(list(defaults.keys()))
> -            sys.exit(20)
> +        assert build_type in defaults, ("Invalid buildtype %s\n"
> +                                        "Valid buildtypes are:\n  - %s" %
> +                                        (build_type, "\n  - ".join(defaults.keys())))
>  
>          self.defaults = defaults[build_type]
>          self.defaults["nicmac"] = get_random_mac()
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list