Repository: ansible-collections/community.general

Issue:
community.general.vdo is giving error
### Summary

vdo is failing when I try to use the module with the error below

### Issue Type

Bug Report

### Component Name

community.general.vdo

### Ansible Version

```console (paste below)
$ ansible --version

```
ansible --version 
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.0 (default, Oct  4 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general

```
ansible-galaxy collection list community.general
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')


### Configuration

```console (paste below)
$ ansible-config dump --only-changed

```


### OS / Environment
Fedora 35

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->

```
vars:
vdo_disks
  - luks_name: luks_sdb
    vdo_name: vdo_sdb
    size: 1.5T

- name: Create 2 TB VDO volume vdo1 on device /dev/md0
  community.general.vdo:
    name: "{{ item.vdo_vol }}"
    activated: true
    deduplication: enabled
    running: true
    state: present
    device: "/dev/mapper/{{ item.luks_vol }}"
    logicalsize: "{{ item.size }}"
 loop: "{{ vdo_disks }}"
```
### Expected Results

expected to create a VDO on top of luks2

### Actual Results

```console (paste below)
 "module_stderr": "/tmp/ansible_community.general.vdo_payload_w7oyx29g/ansible_community.general.vdo_payload.zip/ansible_collections/community/general/plugins/modules/vdo.py:334: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.\nTraceback (most recent call last):\n  File \"<stdin>\", line 102, in <module>\n  File \"<stdin>\", line 94, in _ansiballz_main\n  File \"<stdin>\", line 40, in invoke_module\n  File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.general.vdo_payload_w7oyx29g/ansible_community.general.vdo_payload.zip/ansible_collections/community/general/plugins/modules/vdo.py\", line 772, in <module>\n  File \"/tmp/ansible_community.general.vdo_payload_w7oyx29g/ansible_community.general.vdo_payload.zip/ansible_collections/community/general/plugins/modules/vdo.py\", line 768, in main\n  File \"/tmp/ansible_community.general.vdo_payload_w7oyx29g/ansible_community.general.vdo_payload.zip/ansible_collections/community/general/plugins/modules/vdo.py\", line 525, in run_module\nTypeError: can only concatenate list (not \"str\") to list\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```
### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/system/vdo.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/system/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 --->
cc @jatorcasso 

```diff
diff --git a/plugins/modules/system/vdo.py b/plugins/modules/system/vdo.py
index ab5cf4e400..d2888836d1 100644
--- a/plugins/modules/system/vdo.py
+++ b/plugins/modules/system/vdo.py
@@ -386,7 +386,6 @@ def deactivate_vdo(module, vdoname, vdocmd):


 def add_vdooptions(params):
-    vdocmdoptions = ""
     options = []

     if params.get('logicalsize') is not None:
@@ -437,7 +436,7 @@ def add_vdooptions(params):
     if params.get('physicalthreads') is not None:
         options.append("--vdoPhysicalThreads=" + params['physicalthreads'])

-    return vdocmdoptions
+    return options


 def run_module():
```

There's #3917 which basically does that, but it looks abandoned...
> There's #3917 which basically does that, but it looks abandoned...

Ok, @jatorcasso is looking for a new contribution. Thanks.

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
@@ -386,7 +386,6 @@ def deactivate_vdo(module, vdoname, vdocmd):
 
 
 def add_vdooptions(params):
-    vdocmdoptions = ""
     options = []
 
     if params.get('logicalsize') is not None:
@@ -437,7 +436,7 @@ def add_vdooptions(params):
     if params.get('physicalthreads') is not None:
         options.append("--vdoPhysicalThreads=" + params['physicalthreads'])
 
-    return vdocmdoptions
+    return options
 
 
 def run_module():


Test patch: