Files
SnarfCode/scripts/inspect_argocd_apps.py

16 lines
654 B
Python

import glob
import yaml
files = glob.glob(r"c:\Users\Snarf\OneDrive\Desktop\code\SnarfCode\homelab-gitops-repo\argocd\**\*.yaml", recursive=True)
for f in files:
with open(f, 'r') as fp:
docs = yaml.safe_load_all(fp)
for doc in docs:
if not doc: continue
if doc.get('kind') == 'Application':
name = doc.get('metadata', {}).get('name')
dest = doc.get('spec', {}).get('destination', {})
src = doc.get('spec', {}).get('source', {})
print(f"App: {name:<30} Path: {src.get('path'):<35} Server: {dest.get('server'):<35} NS: {dest.get('namespace')}")