community.general icon indicating copy to clipboard operation
community.general copied to clipboard

btrfs_submodule examples use nonexistent `device` parameter

Open MarcinWieczorek opened this issue 10 months ago • 20 comments

Summary

The documentation for btrfs_submodule lists multiple examples like:

- name: Create a @home subvolume under the root subvolume
  community.general.btrfs_subvolume:
    name: /@home
    device: /dev/vda2

Unfortunately the device parameter does not exist. There only is filesystem_device and it is unclear if it is the same parameter. α-conversion does not work in my case, but possibly for other reasons. Before task listed below I only create the filesystem with community.general.filesystem, it's not mounted. It is unclear what the prerequisites are. root_device=/dev/vda2.

  - name: Setup default btrfs volume
    community.general.btrfs_subvolume:
      name: "/@"
      filesystem_device: "{{ root_device }}"
      default: yes
    when: fstype == "btrfs"

Result:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'get_subvolume_by_name'
fatal: [libvirt_wyse]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDOUT:

Traceback (most recent call last):
  File "/root/.local/share/ansible/tmp/ansible-tmp-1691827052.2975812-441057-66821381645042/AnsiballZ_btrfs_subvolume.py", line 107, in <module>
    _ansiballz_main()
  File "/root/.local/share/ansible/tmp/ansible-tmp-1691827052.2975812-441057-66821381645042/AnsiballZ_btrfs_subvolume.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.local/share/ansible/tmp/ansible-tmp-1691827052.2975812-441057-66821381645042/AnsiballZ_btrfs_subvolume.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.btrfs_subvolume', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.btrfs_subvolume', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/ansible_community.general.btrfs_subvolume_payload_2odjhzh6/ansible_community.general.btrfs_subvolume_payload.zip/ansible_collections/community/general/plugins/modules/btrfs_subvolume.py", line 682, in <module>
  File "/tmp/ansible_community.general.btrfs_subvolume_payload_2odjhzh6/ansible_community.general.btrfs_subvolume_payload.zip/ansible_collections/community/general/plugins/modules/btrfs_subvolume.py", line 678, in main
  File "/tmp/ansible_community.general.btrfs_subvolume_payload_2odjhzh6/ansible_community.general.btrfs_subvolume_payload.zip/ansible_collections/community/general/plugins/modules/btrfs_subvolume.py", line 670, in run_module
  File "/tmp/ansible_community.general.btrfs_subvolume_payload_2odjhzh6/ansible_community.general.btrfs_subvolume_payload.zip/ansible_collections/community/general/plugins/modules/btrfs_subvolume.py", line 278, in run
  File "/tmp/ansible_community.general.btrfs_subvolume_payload_2odjhzh6/ansible_community.general.btrfs_subvolume_payload.zip/ansible_collections/community/general/plugins/modules/btrfs_subvolume.py", line 596, in get_results
AttributeError: 'NoneType' object has no attribute 'get_subvolume_by_name'

Issue Type

Documentation Report

Component Name

btrfs_subvolume

Ansible Version

$ ansible --version
ansible [core 2.15.1]
  config file = /home/user/.config/ansible/ansible.cfg
  configured module search path = ['/home/user/.local/share/ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/user/.local/share/ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.3 (main, Jun  5 2023, 09:32:32) [GCC 13.1.1 20230429] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.1.0

Configuration

$ ansible-config dump --only-changed
COLLECTIONS_PATHS(/home/user/.config/ansible/ansible.cfg) = ['/home/user/.local/share/ansible/collections', '/usr/share/ansible/collections']
CONFIG_FILE() = /home/user/.config/ansible/ansible.cfg
DEFAULT_HOST_LIST(/home/user/.config/ansible/ansible.cfg) = ['/home/user/.config/ansible/hosts']
DEFAULT_LOCAL_TMP(/home/user/.config/ansible/ansible.cfg) = /home/user/.local/share/ansible/tmp/ansible-local-447497k47791oj
DEFAULT_MODULE_PATH(/home/user/.config/ansible/ansible.cfg) = ['/home/user/.local/share/ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
DEFAULT_MODULE_UTILS_PATH(/home/user/.config/ansible/ansible.cfg) = ['/home/user/.local/share/ansible/plugins/module_utils', '/usr/share/ansible/plugins/module_utils']
DEFAULT_ROLES_PATH(/home/user/.config/ansible/ansible.cfg) = ['/home/user/.local/share/ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
DEFAULT_STDOUT_CALLBACK(/home/user/.config/ansible/ansible.cfg) = debug
EDITOR(env: EDITOR) = vim
HOST_KEY_CHECKING(/home/user/.config/ansible/ansible.cfg) = False
PAGER(env: PAGER) = less
RETRY_FILES_SAVE_PATH(/home/user/.config/ansible/ansible.cfg) = /home/user/.local/share/ansible/ansible-retry

OS / Environment

Host is ArchLinux Linux hostname 6.4.1-arch2-1 #1 SMP PREEMPT_DYNAMIC Tue, 04 Jul 2023 08:39:40 +0000 x86_64 GNU/Linux So is the guest, but archiso (arch installer)

Additional Information

No response

Code of Conduct

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

MarcinWieczorek avatar Aug 12 '23 08:08 MarcinWieczorek