ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
830 stars 1.53k forks source link

btrfs_subvolume fails to create nested volumes if the parent already exists #7454

Open jezzirolk opened 1 year ago

jezzirolk commented 1 year ago

Summary

Using the btrfs_subvolume module, when i try to create a subvolume nested under an existing subvolume that does not exist at the root. i get an error. it seems to be dropping the preceding directory for nested subvolumes.

Issue Type

Bug Report

Component Name

btrfs_subvolume

Ansible Version

$ ansible --version
ansible [core 2.12.10]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/jezzirolk/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/jezzirolk/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.3

# /home/jezzirolk/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 7.5.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

Target OS: Ubuntu 23.10

Steps to Reproduce

- hosts: kessel
  become: yes
  tasks:
  - name: create /test1 subvol
    community.general.btrfs_subvolume:
      name: /test1
      recursive: true
  - name: create /test1/a subvol (this works)
    community.general.btrfs_subvolume:
      name: /test/a
      recursive: true
  - name: create /test1/a/b subvol (this works)
    community.general.btrfs_subvolume:
      name: /test/a/b
      recursive: true
  - name: create directory /test2
    file:
      path: /test2
      state: directory
  - name: create /test2/a subvol (this works)
    community.general.btrfs_subvolume:
      name: /test2/a
      recursive: true
  - name: create /test2/a/b subvol (this fails)
    community.general.btrfs_subvolume:
      name: /test2/a/b
      recursive: true

Expected Results

subvolumes created at /test2/a/b

Actual Results

TASK [create /test2/a/b subvol (this fails)] *****************************************************************************************************************************************************************************************************************
fatal: [kessel]: FAILED! => {"changed": false, "cmd": "/usr/bin/btrfs subvolume create //a/b", "msg": "ERROR: cannot access '//a': No such file or directory", "rc": 1, "stderr": "ERROR: cannot access '//a': No such file or directory\n", "stderr_lines": ["ERROR: cannot access '//a': No such file or directory"], "stdout": "", "stdout_lines": []}

It seems from the failed commands that it is dropping the test2 directory from the dataset name.

Code of Conduct

ansibullbot commented 1 year ago

Files identified in the description:

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

ansibullbot commented 1 year ago

cc @gnfzdz click here for bot help