Skip to content

Error with paternoster, runs with ansible-playbook #51

@jrast

Description

@jrast

I have the following very simple tasks:

#!/usr/bin/env paternoster

- hosts: paternoster
  vars:
    description: Mount a WebDav Filesystem
    parameters:
      - name: target
        help: "Target Directory / Mount Point"
        required: yes
        type: paternoster.types.restricted_str
        type_params:
          regex: "^/media/[a-zA-Z0-9_-]+$"

- hosts: localhost
  tasks:
    - debug: msg="Installing WebDavFS..."

    - name: Installing WebDavFS
      become: true
      ansible.builtin.apt:
        name: davfs2
        state: present
        update_cache: yes
        cache_valid_time: 86400

    - debug: msg="Creating Mountpoint {{ param_target}}"

If I run them with ansible-playbook ( ansible-playbook MountWebDav --extra-vars "param_target=/media/sharepoint" > ansible-run.log), this works as expected, however, if I run the script with paternoster MountWebDav I get an AttributeError:

Parsed localhost, inventory source with host_list plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: MountWebDav **********************************************************
2 plays in /home/pi/Desktop/AnsibleScripts/MountWebDav

PLAY [paternoster] *************************************************************
skipping: no hosts matched

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
task path: /home/pi/Desktop/AnsibleScripts/MountWebDav:14
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: pi
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048 `" && echo ansible-tmp-1618295847.6610847-20529-101535705936048="` echo /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048 `" ) && sleep 0'
Using module file /home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/modules/setup.py
<localhost> PUT /tmp/ansible-local-20516ye305jqp/tmpt53z4k14 TO /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048/AnsiballZ_setup.py
<localhost> EXEC /bin/sh -c 'chmod u+x /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048/ /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048/AnsiballZ_setup.py && sleep 0'
<localhost> EXEC /bin/sh -c '/home/pi/Desktop/AnsibleScripts/venv/bin/python3 /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048/AnsiballZ_setup.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /tmp/ansible-tmp-1618295847.6610847-20529-101535705936048/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [debug] *******************************************************************
task path: /home/pi/Desktop/AnsibleScripts/MountWebDav:16
ok: [localhost] => {
    "msg": "Installing WebDavFS..."
}

TASK [Installing WebDavFS] *****************************************************
task path: /home/pi/Desktop/AnsibleScripts/MountWebDav:18
The full traceback is:
Traceback (most recent call last):
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 613, in _execute
    self._connection = self._get_connection(cvars, templar)
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 929, in _get_connection
    become_plugin = self._get_become(self._task.become_method)
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/executor/task_executor.py", line 883, in _get_become
    become = become_loader.get(name)
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/plugins/loader.py", line 782, in get
    return self.get_with_context(name, *args, **kwargs).object
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/plugins/loader.py", line 792, in get_with_context
    plugin_load_context = self.find_plugin_with_context(name, collection_list=collection_list)
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/plugins/loader.py", line 541, in find_plugin_with_context
    result = self._resolve_plugin_step(name, mod_type, ignore_deprecated, check_aliases, collection_list, plugin_load_context=plugin_load_context)
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/plugins/loader.py", line 632, in _resolve_plugin_step
    return self._find_plugin_legacy(name, plugin_load_context, ignore_deprecated, check_aliases, suffix)
  File "/home/pi/Desktop/AnsibleScripts/venv/lib/python3.7/site-packages/ansible/plugins/loader.py", line 714, in _find_plugin_legacy
    if not name.startswith('_'):
AttributeError: 'NoneType' object has no attribute 'startswith'
fatal: [localhost]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

Versions:
Python: 3.7.2
Ansible: 2.10.7
Paternoster: 3.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions