From 9af0f5bb9f7b8ba324e394c30cbe81772f6c7dcf Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Nov 12 2017 21:29:35 +0000 Subject: bin/get_formulas.py: make symlink argument standalone Symlinks were created only if --clone was specified. This commit makes it standalone, in case we need to run it on our workstations --- diff --git a/bin/get_formulas.py b/bin/get_formulas.py index b8a9db1..9139d4a 100755 --- a/bin/get_formulas.py +++ b/bin/get_formulas.py @@ -22,7 +22,7 @@ def git(cmd, cwd=None, additional_env=None): sys.exit(status) -def clone_or_pull(DEST, SYMLINK=False): +def clone_or_pull(DEST): def use_git_to_clone_or_pull_repo(): if not os.path.exists(DEST): os.mkdir(DEST) @@ -50,8 +50,11 @@ def clone_or_pull(DEST, SYMLINK=False): opensuse_fork_url = 'https://gitlab.infra.opensuse.org/saltstack-formulas/%s-formula' % formula FULL_PATH = '%s/%s-formula' % (DEST, formula) use_git_to_clone_or_pull_repo() - if SYMLINK: - os.symlink('%s/%s' % (FULL_PATH, formula), '/srv/salt/%s' % formula) + + +def create_symlinks(DEST): + for formula in FORMULAS.keys(): + os.symlink('%s/%s-formula/%s' % (DEST, formula, formula), '/srv/salt/%s' % formula) def enable_remote(REMOTE, DEST): @@ -98,7 +101,10 @@ if args.remote and args.remote[0] not in ['origin', 'opensuse']: sys.exit(1) if args.clone: - clone_or_pull(args.destination[0], args.symlink) + clone_or_pull(args.destination[0]) + +if args.symlink: + create_symlinks(args.destination[0]) if args.remote: enable_remote(args.remote[0], args.destination[0])