Commit 48f71cb6 authored by eric pellegrini's avatar eric pellegrini
Browse files

bug fixed when setting up templates base dir to cleanup function

parent f59f64b4
......@@ -14,12 +14,14 @@ import sys
from packme import Packman
def clean_templates_dir(templates_dir):
def clean_templates_dir(templates_base_dir):
"""Removes all manifest.json files, packer_cache and builds directories found in
templates directory
for template_dir in templates_dir:
template_dirs = glob.glob(os.path.join(templates_base_dir,"*"))
for template_dir in template_dirs:
......@@ -45,7 +47,7 @@ def parse_args():
parser.add_argument("--clean", "-c", dest="clean", action="store_true", help="clean up templates directories")
parser.add_argument("--debug", "-d", dest="debug", action="store_true", help="debug mode (keep temporary files)")
parser.add_argument("--run", "-r", dest="run", action="store_true", help="run packer after json manifest(s) generation")
parser.add_argument("--templates-dir", "-t", dest="templates_dir", required=True, help="Templates base directory")
parser.add_argument("--templates-base-dir", "-t", dest="templates_base_dir", required=True, help="Templates base directory")
parser.add_argument("--selected-templates", "-s", dest="selected_templates", nargs="*", default=["*"], help="run packman on selected template(s)")
parser.add_argument("--input", "-i", dest="input_file", help="YAML input file")
......@@ -59,7 +61,7 @@ if __name__ == "__main__":
args = parse_args()
input_file = args.input_file
run =
templates_dir = args.templates_dir
templates_base_dir = args.templates_base_dir
selected_templates = args.selected_templates
clean = args.clean
debug = args.debug
......@@ -67,12 +69,12 @@ if __name__ == "__main__":
# If --clean option is set, cleanup the templates dir (builds, packer_cache, manifest.json files and directories)
if clean:
if not input_file:
t = Packman.Packman(input_file, templates_dir)
t = Packman.Packman(input_file, templates_base_dir), indent=4, separators=(',', ': '))
......@@ -81,6 +83,6 @@ if __name__ == "__main__":
# If --debug option is set, keep temporary files and directories in templates dir (builds, packer_cache, manifest.json)
if not debug:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment