21230: Update yml_override.py for PyYAML 6.0+
authorBrett Smith <brett.smith@curii.com>
Mon, 15 Jan 2024 15:23:54 +0000 (10:23 -0500)
committerBrett Smith <brett.smith@curii.com>
Mon, 15 Jan 2024 15:23:54 +0000 (10:23 -0500)
This tool gets called to update configuration files for other Arvados
services, so we're not expecting it to deal with any Python objects.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

tools/arvbox/lib/arvbox/docker/yml_override.py

index deea83f909b27ddc715313d40a7e8292298e53b5..5f9ee68e4fc7c2480e1ed4f4bb0ca61b28c0edfc 100755 (executable)
@@ -10,12 +10,12 @@ fn = sys.argv[1]
 
 try:
     with open(fn+".override") as f:
 
 try:
     with open(fn+".override") as f:
-        b = yaml.load(f)
+        b = yaml.safe_load(f)
 except IOError:
     exit()
 
 with open(fn) as f:
 except IOError:
     exit()
 
 with open(fn) as f:
-    a = yaml.load(f)
+    a = yaml.safe_load(f)
 
 def recursiveMerge(a, b):
     if isinstance(a, dict) and isinstance(b, dict):
 
 def recursiveMerge(a, b):
     if isinstance(a, dict) and isinstance(b, dict):
@@ -27,4 +27,4 @@ def recursiveMerge(a, b):
         return b
 
 with open(fn, "w") as f:
         return b
 
 with open(fn, "w") as f:
-    yaml.dump(recursiveMerge(a, b), f)
+    yaml.safe_dump(recursiveMerge(a, b), f)