mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-opentofu-private.git
synced 2025-10-27 15:53:06 +00:00
Update merge_yaml.py
This commit is contained in:
@ -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:
|
||||
|
||||
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)}))
|
||||
|
||||
Reference in New Issue
Block a user