feat: add homelab deployment configs, documentation, and automation scripts
This commit is contained in:
26
scripts/add_topology_to_homepage.py
Normal file
26
scripts/add_topology_to_homepage.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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]
|
||||
|
||||
services = yaml.safe_load(cm['data']['services.yaml'])
|
||||
bookmarks = yaml.safe_load(cm['data']['bookmarks.yaml'])
|
||||
|
||||
cm['data']['services.yaml'] = yaml.dump(services, sort_keys=False, default_flow_style=False, allow_unicode=True)
|
||||
cm['data']['bookmarks.yaml'] = yaml.dump(bookmarks, sort_keys=False, default_flow_style=False, allow_unicode=True)
|
||||
|
||||
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("Cleaned up unicode strings in homepage.yaml!")
|
||||
Reference in New Issue
Block a user