From 5e7979f31d8e30980a6e31490d00345e51a14006 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 26 Feb 2020 12:52:44 +0000 Subject: Throw TypeError in repository enable/disable macros Currently we do not validate the type of the reponames argument to the enable_extra_repos and disable_extra_repos macros. It should be a list, but we merged a call where the argument was a string, which interpreted as a list of single characters ('e', 'p', 'e', 'l'), and silently ignored. This change validates that the reponames argument is a list to avoid this issue. Change-Id: I497c8b2c1dc548e678698474d3604664cf8eeb07 --- kolla/template/methods.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kolla/template/methods.py') diff --git a/kolla/template/methods.py b/kolla/template/methods.py index 66c5dcfa9..fb470a65f 100644 --- a/kolla/template/methods.py +++ b/kolla/template/methods.py @@ -88,6 +88,9 @@ def handle_repos(context, reponames, mode): else: raise KeyError + if not isinstance(reponames, list): + raise TypeError("First argument should be a list of repositories") + repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml' with open(repofile, 'r') as repos_file: repo_data = {} -- cgit v1.2.3