Skip to content

New ZFS create fails when you specify mount point #4707

@ankycooper

Description

@ankycooper

Summary

New ZFS create fails when you specify mount point, all the existing are not affected.
This is because the quotes added to the cmd

'mountpoint="/mnt/spin/test"'

if it

Issue Type

Bug Report

Component Name

plugins/modules/storage/zfs/zfs.py

Ansible Version

$ ansible --version
ansible [core 2.12.5]
  config file = /Users/<some-path>>/ansible/ansible.cfg
  configured module search path = ['/Users/<username>/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/5.8.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/<some-path>>/ansible/ansible-tmp/.ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.4 (main, Apr 26 2022, 19:42:59) [Clang 13.1.6 (clang-1316.0.21.2)]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /Users/<some file path>/ansible/ansible-tmp/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 5.0.0  

# /usr/local/Cellar/ansible/5.8.0/libexec/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.8.1  

Configuration

$ ansible-config dump --only-changed
COLLECTIONS_PATHS(/Users/<some-path>/ansible/ansible.cfg) = ['/Users/<some-path>/ansible/ansible-tmp/.ansible/collections']
DEFAULT_HOST_LIST(/Users/<some-path>/ansible/ansible.cfg) = ['/Users/<some-path>/ansible/hosts']
DEFAULT_LOCAL_TMP(/Users/<some-path>/ansible/ansible.cfg) = /Users/<some-path>/ansible/ansible-tmp/.ansible/tmp/ansible-local-63125l1qzq99v
DEFAULT_ROLES_PATH(/Users/<some-path>/ansible/ansible.cfg) = ['/Users/<some-path>/ansible/ansible-tmp/.ansible/roles']
HOST_KEY_CHECKING(/Users/<some-path>/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/Users/<some-path>/ansible/ansible.cfg) = auto_silent

OS / Environment

tried on mac and linux

Steps to Reproduce

Task.yaml


  • name: Create a new new ZFS DS {{item}}
    community.general.zfs:
    name: "{{item}}"
    state: present
    extra_zfs_properties:
    mountpoint={{zfs_base_mount}}{{item}}
    loop: "{{ zfsds }}"

Vars.yaml

zfs_base_mount: /mnt/ #keep trailing slash
zfsds:

  • spin/data #this is existing so no issue
  • spin/data/name1 #this is existing so no issue
  • spin/data/name2/something #this is existing so no issue
  • spin/test #this is new so it fails

Expected Results

create and mount zfs

Actual Results

failed: [host.example.com] (item=spin/test) => {
    "ansible_loop_var": "item",
    "changed": false,
    "cmd": "/usr/sbin/zfs create -p -o 'mountpoint=\"/mnt/spin/test\"' spin/test",
    "invocation": {
        "module_args": {
            "extra_zfs_properties": {
                "mountpoint": "/mnt/spin/test"
            },
            "name": "spin/test",
            "origin": null,
            "state": "present"
        }
    },
    "item": "spin/test",
    "msg": "cannot create 'spin/test': 'mountpoint' must be an absolute path, 'none', or 'legacy'",
    "rc": 1,
    "stderr": "cannot create 'spin/test': 'mountpoint' must be an absolute path, 'none', or 'legacy'\n",
    "stderr_lines": [
        "cannot create 'spin/test': 'mountpoint' must be an absolute path, 'none', or 'legacy'"
    ],
    "stdout": "",
    "stdout_lines": []
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions