Merge pull request 'fenix-admin' (#178) from fenix-admin into main

Reviewed-on: fenix-gitea-admin/iac-teste#178
This commit is contained in:
2025-08-27 13:35:14 +00:00
2 changed files with 18 additions and 5 deletions

View File

@ -120,8 +120,9 @@ jobs:
python-version: '3.11'
- name: Install dependencies
run: pip install pyyaml
run: |
pip install pyyaml
pip install yamllint
- name: Init OpenTofu
working-directory: infra/iac

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python3
import yaml
import sys
@ -25,8 +24,21 @@ def main():
file2 = input_data["file2"]
with open(file1, "r") as f1, open(file2, "r") as f2:
yaml1 = yaml.safe_load(f1)
yaml2 = yaml.safe_load(f2)
try:
yaml1 = yaml.safe_load(f1)
except yaml.YAMLError as e:
print("Erro ao carregar YAML do primeiro ficheiro:")
print(f1.read())
raise e
try:
yaml2 = yaml.safe_load(f2)
except yaml.YAMLError as e:
print("Erro ao carregar YAML do segundo ficheiro:")
print(f2.read())
raise e
merged = deep_merge_yaml(yaml1, yaml2)
print(json.dumps({"merged_yaml": yaml.dump(merged, sort_keys=False)}))