From a7de5745f0897783f536a56233185698ad6a1ebb Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Wed, 8 Mar 2017 11:05:40 -0500 Subject: [PATCH] Removes formula before copying it from source Fixes #173 --- src/watchmaker/workers/salt.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/watchmaker/workers/salt.py b/src/watchmaker/workers/salt.py index e2473333f..09664d2a4 100644 --- a/src/watchmaker/workers/salt.py +++ b/src/watchmaker/workers/salt.py @@ -155,8 +155,12 @@ def _get_formulas_conf(self): # Append Salt formulas that came with Watchmaker package. formulas_path = os.sep.join((static.__path__[0], 'salt', 'formulas')) for formula in os.listdir(formulas_path): - shutil.copytree(os.sep.join((formulas_path, formula)), - os.path.join(self.salt_formula_root, '', formula)) + formula_path = os.path.join(self.salt_formula_root, '', formula) + if os.path.exists(formula_path): + shutil.rmtree(formula_path) + shutil.copytree( + os.sep.join((formulas_path, formula)), + formula_path) # Obtain & extract any Salt formulas specified in user_formulas. for source_loc in self.user_formulas: