You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-homelab/ansible/roles/setup_hosted_services/files/scripts/find-volumes-to-restore.py

21 lines
432 B
Python

#!/usr/bin/python
import os
def main():
existing = eval(os.getenv("EXISTING_VOLUMES"))
services = eval(os.getenv("SERVICES"))
missing_volumes = []
for service in services:
for volume_name in service.get("volumes", []):
if volume_name not in existing:
missing_volumes.append(volume_name)
for mv in missing_volumes:
print(mv)
if __name__ == "__main__":
main()