Skip to content

Commit

Permalink
Merge pull request #880 from RedHatInsights/mknop/fix-namespace-yaml-…
Browse files Browse the repository at this point in the history
…deprecation

using pyyaml library, ruamel is deprecated
  • Loading branch information
adamrdrew authored Oct 24, 2023
2 parents 6cc1222 + 6410524 commit 24810ff
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions build/fix_namespace.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/usr/bin/env python

import sys
import ruamel.yaml
import yaml

filename = sys.argv[1]
namespace = sys.argv[2]

yaml = ruamel.yaml.YAML()

print(f"Replacing: {filename} - {namespace}")

with open(filename, "r") as f:
yaml_data = ruamel.yaml.round_trip_load(f)
yaml_data = yaml.safe_load(f)
for i, env in enumerate(yaml_data['spec']['template']['spec']['containers'][0]['env']):
if env['name'] == "STRIMZI_NAMESPACE":
try:
Expand All @@ -21,4 +19,4 @@
yaml_data['spec']['template']['spec']['containers'][0]['env'][i]['value'] = namespace

with open(filename, "w") as f:
ruamel.yaml.round_trip_dump(yaml_data, f, indent=2)
yaml.dump(yaml_data, f, indent=2)

0 comments on commit 24810ff

Please sign in to comment.