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