From 672be1929d45b3ce541e16e06b8b2768abca44e8 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Thu, 29 Sep 2016 11:51:46 -0400 Subject: [PATCH] Added ability to purge unmanaged salt formulas --- salt-formula-manager.py | 11 +++++++++++ sfm.yaml.example | 3 +++ 2 files changed, 14 insertions(+) diff --git a/salt-formula-manager.py b/salt-formula-manager.py index 5ac00f3..a73857f 100644 --- a/salt-formula-manager.py +++ b/salt-formula-manager.py @@ -57,6 +57,14 @@ def get_formulas(conf): # clone git repo Repo.clone_from(git_url, local_path) +# purge un-managed formulas +def clean_formulas(conf): + if conf['purge_formulas']: + print('Cleaning out unmanaged formulas') + + else: + print('Not cleaning out unmanaged formulas') + # main program def main(): # read configuration settings @@ -68,5 +76,8 @@ def main(): # do the formula stuff get_formulas(conf) + # clean unmanaged formulas + clean_formulas(conf) + # run main main() diff --git a/sfm.yaml.example b/sfm.yaml.example index 637c1ce..27652ae 100644 --- a/sfm.yaml.example +++ b/sfm.yaml.example @@ -6,6 +6,9 @@ formulas_url: https://github.com/saltstack-formulas/ # where to store the new formulas (relative to current directory) formulas_dir: formulas +# remove unmanaged formulas +purge_formulas: true + # list of formulas to import formulas: - vim