From 86b595e13eb71c62c249fdc7523affd16bb67892 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 10 Apr 2019 16:09:09 -0700 Subject: [PATCH] lorax-composer: Fix customizations when creating a recipe This fixes the customizations list problem earlier than in add_customizations. In the recipe it should be [customizations] not [[customizations]] which creates a list. If it was used that way grab the first element and replace the list with it. (cherry picked from commit 67007dfa60c61dfa581693be96024f6a68dfd098) Related: rhbz#1709595 --- src/pylorax/api/recipes.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pylorax/api/recipes.py b/src/pylorax/api/recipes.py index d250e28c..4906ee8a 100644 --- a/src/pylorax/api/recipes.py +++ b/src/pylorax/api/recipes.py @@ -234,6 +234,12 @@ def recipe_from_dict(recipe_dict): description = recipe_dict["description"] version = recipe_dict.get("version", None) customizations = recipe_dict.get("customizations", None) + + # [customizations] was incorrectly documented at first, so we have to support using it + # as [[customizations]] by grabbing the first element. + if isinstance(customizations, list): + customizations = customizations[0] + except KeyError as e: raise RecipeError("There was a problem parsing the recipe: %s" % str(e))