From b64858b4420e2c49e49f580dfdc71f3e70128150 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Wed, 14 Sep 2016 16:58:33 -0400 Subject: [PATCH] Added main loop for moving through repos --- salt-formula-manager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/salt-formula-manager.py b/salt-formula-manager.py index 4a29b86..913717d 100644 --- a/salt-formula-manager.py +++ b/salt-formula-manager.py @@ -28,6 +28,14 @@ def check_formula_dir(conf): else: os.makedirs(conf['formulas_dir']) +# loops through the array of repos and downloads them +def get_formulas(conf): + for formula in conf['formulas']: + if isinstance(formula, dict): + print('Downloading ' + str(formula['url']) + ' into ' + str(conf['formulas_dir']) + '/' + str(formula['name'])) + elif isinstance(formula, str): + print('Downloading ' + str(conf['formulas_url']) + str(formula) + '-formula into ' + str(conf['formulas_dir']) + '/' + str(formula) + '-formula') + # main program def main(): # read configuration settings @@ -36,5 +44,8 @@ def main(): # make sure the formulas directory exists check_formula_dir(conf) + # do the formula stuff + get_formulas(conf) + # run main main()