Added class to manage a default set of scripts

- included scripts into profiles::base
  - updated hiera with list of scripts to create and their template name
  - created template for a puppet wrapper
This commit is contained in:
2023-08-26 16:11:53 +10:00
parent c1ddb00cbb
commit 116342bdaa
4 changed files with 55 additions and 0 deletions
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
import sys
import subprocess
def main():
# If "-E" is in the arguments, modify the following argument
args = sys.argv[1:]
if "-E" in args:
index = args.index("-E")
if index + 1 < len(args): # Check if there's another argument after "-E"
environment_value = args[index + 1]
# Replace \ and - with _
modified_environment_value = environment_value.replace("\\", "_").replace("-", "_").replace("/","_")
args[index + 1] = modified_environment_value
# Construct the full puppet command with the modified args
command = ["/opt/puppetlabs/bin/puppet"] + args
subprocess.run(command)
if __name__ == "__main__":
main()