mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-18 23:03:30 +00:00
style: apply ruff autoformat
This commit is contained in:
11
cli/vault.py
11
cli/vault.py
@@ -3,18 +3,25 @@
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
|
||||
def run_ansible_vault(action, filename, password_file):
|
||||
cmd = ["ansible-vault", action, filename, "--vault-password-file", password_file]
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Manage Ansible Vault")
|
||||
parser.add_argument("action", choices=["edit", "decrypt", "encrypt"], help="Vault action")
|
||||
parser.add_argument(
|
||||
"action", choices=["edit", "decrypt", "encrypt"], help="Vault action"
|
||||
)
|
||||
parser.add_argument("filename", help="File to process")
|
||||
parser.add_argument("--password-file", required=True, help="Path to the Vault password file")
|
||||
parser.add_argument(
|
||||
"--password-file", required=True, help="Path to the Vault password file"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
run_ansible_vault(args.action, args.filename, args.password_file)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user