puppet-prod/site/profiles/templates/base/scripts/puppetwrapper.py.erb
Ben Vincent 116342bdaa 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
2023-08-26 16:11:53 +10:00

23 lines
729 B
Plaintext

#!/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()