46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
import yaml
|
|
|
|
def str_presenter(dumper, data):
|
|
if '\n' in data:
|
|
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
|
|
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
|
|
|
|
yaml.add_representer(str, str_presenter)
|
|
yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
|
|
|
|
with open('homelab-gitops-repo/manifests/spaceport/homepage/homepage.yaml', 'r', encoding='utf-8') as f:
|
|
text = f.read()
|
|
|
|
docs = list(yaml.safe_load_all(text))
|
|
cm = docs[2]
|
|
|
|
bookmarks_yaml = """- Quick Links:
|
|
- GitHub:
|
|
- abbr: GH
|
|
href: https://github.com/
|
|
- UniFi Site Manager:
|
|
- abbr: UI
|
|
href: https://unifi.ui.com/
|
|
- Cloudflare:
|
|
- abbr: CF
|
|
href: https://dash.cloudflare.com/
|
|
- Grafana Telemetry:
|
|
- Systems Performance:
|
|
- abbr: SYS
|
|
href: https://grafana.snarfnet.net/d/snarfnet-systems/52f6861
|
|
- Container Workloads:
|
|
- abbr: K8S
|
|
href: https://grafana.snarfnet.net/d/snarfnet-containers/f09f93a6-kubernetes-containers-and-workloads
|
|
- AI Stack Intelligence:
|
|
- abbr: AI
|
|
href: https://grafana.snarfnet.net/d/snarfnet-ai-stack/snarfnet-ai-stack-and-inference-intelligence
|
|
"""
|
|
|
|
cm['data']['bookmarks.yaml'] = bookmarks_yaml
|
|
|
|
with open('homelab-gitops-repo/manifests/spaceport/homepage/homepage.yaml', 'w', encoding='utf-8') as f:
|
|
yaml.dump_all(docs, f, sort_keys=False, default_flow_style=False, allow_unicode=True)
|
|
|
|
print("Updated bookmarks in homelab-gitops-repo/manifests/spaceport/homepage/homepage.yaml successfully!")
|
|
|