Use yaml.safe_load in release jobs

OpenDev bumped the default nodeset to ubuntu noble. This change has
caused PyYaml to fail with this error with using yaml.load(input):

    File "/home/zuul/scripts/release-tools/process_release_requests.py", line 171, in process_release_requests
      deliverable_data = yaml.load(f.read())
                         ^^^^^^^^^^^^^^^^^^^
  TypeError: load() missing 1 required positional argument: 'Loader'

The issue is that yaml.load is not safe and they deprecated the naive
use of yaml.load(). Instead you have to specify a loader and opt into
unsafe behavior (or opt into safe behavior). We can avoid this entirely
by using yaml.safe_load() instead so we make that change here.

Change-Id: I3bbca9af450cf2b0422ccc568a49b2b672400a59
This commit is contained in:
Clark Boylan 2024-08-21 09:35:18 -07:00
parent dd63733b55
commit 6b4a3ae22f

View File

@ -168,7 +168,7 @@ def process_release_requests(reporoot, filenames, meta_data):
continue continue
with open(filename, 'r', encoding='utf-8') as f: with open(filename, 'r', encoding='utf-8') as f:
deliverable_data = yaml.load(f.read()) deliverable_data = yaml.safe_load(f.read())
deliverable_releases = deliverable_data.get('releases', []) deliverable_releases = deliverable_data.get('releases', [])