21230: Update yml_override.py for PyYAML 6.0+
[arvados.git] / tools / arvbox / lib / arvbox / docker / yml_override.py
index 7f35ac1d686984fbbc51101f8aa1a508e8ae28e0..5f9ee68e4fc7c2480e1ed4f4bb0ca61b28c0edfc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/opt/arvados-py/bin/python3
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
 # SPDX-License-Identifier: AGPL-3.0
@@ -10,12 +10,12 @@ fn = sys.argv[1]
 
 try:
     with open(fn+".override") as f:
-        b = yaml.load(f)
+        b = yaml.safe_load(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):
@@ -27,4 +27,4 @@ def recursiveMerge(a, b):
         return b
 
 with open(fn, "w") as f:
-    yaml.dump(recursiveMerge(a, b), f)
+    yaml.safe_dump(recursiveMerge(a, b), f)