Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdo: Use yaml.safe_load() instead of yaml.load() #5632

Merged
merged 2 commits into from Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,2 @@
bugfixes:
- vdo - now uses ``yaml.safe_load()`` to parse command output instead of the deprecated ``yaml.load()`` which is potentially unsafe. Using ``yaml.load()`` without explicitely setting a ``Loader=`` is also an error in pyYAML 6.0 (https://github.com/ansible-collections/community.general/pull/5632).
4 changes: 2 additions & 2 deletions plugins/modules/vdo.py
Expand Up @@ -332,7 +332,7 @@ def inventory_vdos(module, vdocmd):
if rc != 0:
module.fail_json(msg="Inventorying VDOs failed: %s" % vdostatusout, rc=rc, err=err)

vdostatusyaml = yaml.load(vdostatusout)
vdostatusyaml = yaml.safe_load(vdostatusout)
if vdostatusyaml is None:
return vdolist

Expand Down Expand Up @@ -548,7 +548,7 @@ def run_module():
# Modify the current parameters of a VDO that exists.
if desiredvdo in vdolist and state == 'present':
rc, vdostatusoutput, err = module.run_command([vdocmd, "status"])
vdostatusyaml = yaml.load(vdostatusoutput)
vdostatusyaml = yaml.safe_load(vdostatusoutput)

# An empty dictionary to contain dictionaries of VDO statistics
processedvdos = {}
Expand Down