From 766eaa21c309d77d2779490f85b89221e5a927e8 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Wed, 19 Jul 2017 13:31:43 -0400 Subject: [PATCH] Added a check to make sure that a defined formula had a git URL to clone from --- salt-formula-manager.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/salt-formula-manager.py b/salt-formula-manager.py index b0caec1..257f66e 100644 --- a/salt-formula-manager.py +++ b/salt-formula-manager.py @@ -49,9 +49,9 @@ def parse_formula_entry(formula, formulas_dir, formulas_url): local_path = '' # check if the formula entry is a string or a dictionary - if isinstance(formula, dict): + if isinstance(formula, dict): # entry is a dictionary - git_url = str(formula['url']) + git_url = str(formula.get('url', formulas_url)) # get the 'url' value if it is defined, otherwise use the default local_path = str(formulas_dir) + '/' + str(formula['name']) elif isinstance(formula, str): # entry is a string @@ -59,7 +59,7 @@ def parse_formula_entry(formula, formulas_dir, formulas_url): local_path = str(formulas_dir) + '/' + str(formula) + '-formula' else: # entry type is not supported - print('One of your entries is not a dict or a string (' + str(formula) + ') - please fix this.') + print('One of your formula entries is not a dict or a string (' + str(formula) + ') - please fix this.') sys.exit(1) # return the values here