Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with paternoster, runs with ansible-playbook #51

Open
jrast opened this issue Apr 13, 2021 · 2 comments
Open

Error with paternoster, runs with ansible-playbook #51

jrast opened this issue Apr 13, 2021 · 2 comments

Comments

@jrast
Copy link

jrast commented Apr 13, 2021

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

@luto
Copy link
Member

luto commented Apr 13, 2021

Which distribution is this running on? Ubuntu?

@jrast
Copy link
Author

jrast commented Apr 13, 2021

I'm running this on a Raspberry Pi with Raspbian 10, which is almost the same as a Debian 10 (buster).

Ansible and Paternoster are installed within a virtual environment, maybe this also leads to some issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants