Repository: ansible-collections/community.general

Issue:
vdo plugin uses deprecated yaml.load() without defining Loader=
### Summary

When using the vdo plugin, it will emit this warning:
`YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.`

In pyYAML 5.1 this is just a warning, however in 6.0 this is upgraded to an error (see https://github.com/yaml/pyyaml/releases/tag/6.0)

### Issue Type

Bug Report

### Component Name

ansible_collections/community/general/plugins/modules/vdo.py

### Ansible Version

```console (paste below)
$ ansible --version
ansible [core 2.14.0]
  config file = None
  configured module search path = ['/home/randall/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/randall/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general

# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.0.1
```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed
CONFIG_FILE() = None
```


### OS / Environment

Debian

### Steps to Reproduce

https://github.com/ansible-collections/community.general/issues/3916 has a reproducer including output

### Expected Results

No warning when using pyyaml 5.1, no error when using pyyaml 6

### Actual Results

Warning when using pyyaml 5.1, error when using pyyaml 6.

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/vdo.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/vdo.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @bgurney-rh @rhawalsh
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
#5632 fixes this issue.
Thanks for reporting this and creating a fix! I just checked the remainder of community.general, that plugin seems to be the only one using `yaml.load`.

Resolving patch:
diff --git a/plugins/modules/system/vdo.py b/plugins/modules/system/vdo.py
--- a/plugins/modules/system/vdo.py
+++ b/plugins/modules/system/vdo.py
@@ -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
 
@@ -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 = {}


Test patch: