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

'NoneType' is not an acceptable base type when executing ansible-runner with process-isolation using a community EE base image #1346

Closed
shantanoo-desai opened this issue Mar 15, 2024 · 1 comment
Labels
needs_triage New item that needs to be triaged

Comments

@shantanoo-desai
Copy link

Host System

Windows Subsystem for Linux 2 with Ubuntu 22.04

Software Versions

  • Docker Engine: 25.0.4
  • ansible-runner: 2.3.6
  • python: 3.10.12

Problem Description / Scenario

I am experimenting with ansible-runner to run my Runner Project via an Ansible Execution-Environment.

At the moment just to get a grip on how things work I am using the ghcr.io/ansible-community/community-ee-base:latest image

My inventory comprises of nothing but the localhost (which when executed within the EE should be the container's localhost)

Upon executing the run command with the respective process-isolation parameters via the CLI I get the following error:

Identity added: /runner/artifacts/29a525b0-49f2-47e7-aba8-780f724a7399/ssh_key_data (ansible_test_network)
ansible-playbook [core 2.16.1]
  config file = /runner/ansible.cfg
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.12.0 (main, Oct  2 2023, 00:00:00) [GCC 13.2.1 20230918 (Red Hat 13.2.1-3)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /runner/ansible.cfg as config file
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
script declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
auto declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Parsed /runner/inventory/hosts inventory source with yaml plugin
redirecting (type: callback) ansible.builtin.yaml to community.general.yaml
ERROR! Unexpected Exception, this is probably a bug: type 'NoneType' is not an acceptable base type
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/cli/playbook.py", line 156, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/executor/playbook_executor.py", line 119, in run
    self._tqm.load_callbacks()
  File "/usr/local/lib/python3.12/site-packages/ansible/executor/task_queue_manager.py", line 200, in load_callbacks
    self._stdout_callback = callback_loader.get(self._stdout_callback)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/plugins/loader.py", line 864, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/plugins/loader.py", line 899, in get_with_context
    self._module_cache[path] = self._load_module_source(resolved_type_name, path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ansible/plugins/loader.py", line 837, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/runner/artifacts/29a525b0-49f2-47e7-aba8-780f724a7399/callback/awx_display.py", line 316, in <module>
    class CallbackModule(DefaultCallbackModule):
TypeError: type 'NoneType' is not an acceptable base type

Project Structure

.
├── README.md
├── ansible.cfg
├── appstack
├── artifacts
├── env
├── inventory
├── project
└── tests

The project has all the playbooks I need to execute.

Code Snippets

debug.yml

A simple ping based debug Playbook used is as follows:

---
# project/debug.yml

- hosts: all
  gather_facts: false
  tasks:
    - name: 'ping from ee'
      ansible.builtin.ping:

env/envvars

---
# path always relative to the `project` directory
ANSIBLE_CONFIG: ../ansible.cfg
ANSIBLE_STDOUT_CALLBACK: yaml
ANSIBLE_HOST_KEY_CHECKING: False

Inventory

inventory
├── group_vars
│   └── all
│       ├── vars.yml
│       └── vault.yml
├── host_vars
│   └── localhost.yml
└── hosts

content of hosts

all:
  children:
    ungrouped:
      hosts:
        localhost:

The inventory seems to correct since on the host upon performing

ansible-inventory -i inventory --list --yaml

I get all the correct values for the variables and the localhost correctly

Reproduction Steps

In order to execute this I am currently executing the following command in the terminal:

ansible-runner run . \
--process-isolation \
--process-isolation-executable=docker \
--container-image=ghcr.io/ansible-community/community-ee-base:latest \
-p debug.yml \
-vvv

Upon executing the command I get the error as mentioned above. What seems to be the problem here?

@github-actions github-actions bot added the needs_triage New item that needs to be triaged label Mar 15, 2024
@shantanoo-desai
Copy link
Author

shantanoo-desai commented Mar 15, 2024

Edit

the error seems to be coming from the fact that ANSIBLE_STDOUT_CALLBACK: yaml is set. Upon commenting it out, I am able to execute the playbook.

I am not sure why the YAML callback plugin is throwing such an error? but my initial suspicion is the use redirecting (type: callback) ansible.builtin.yaml to community.general.yaml which I guess the base image might not have the community.general collection

phire-tc pushed a commit to PhireLink/awx-ee that referenced this issue Dec 23, 2024
I was getting a crash when I tried to run awx-ee using
ansible-navigator:

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/ansible/cli/__init__.py", line 646, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/cli/playbook.py", line 155, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/executor/playbook_executor.py", line 117, in run
    self._tqm.load_callbacks()
  File "/usr/local/lib/python3.11/site-packages/ansible/executor/task_queue_manager.py", line 198, in load_callbacks
    self._stdout_callback = callback_loader.get(self._stdout_callback)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 861, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 907, in get_with_context
    self._module_cache[path] = self._load_module_source(resolved_type_name, path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 834, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/runner/artifacts/5c4373ae-294c-4355-9717-91217391340d/callback/awx_display.py", line 317, in <module>
    class CallbackModule(DefaultCallbackModule):
TypeError: type 'NoneType' is not an acceptable base type
```

According to ansible/ansible-runner#1346 it
might be caused by the yaml output callback so this commit sets an
environment variable to set the callback to the default. It also
installs the community.general collection.
phire-tc pushed a commit to PhireLink/awx-ee that referenced this issue Dec 23, 2024
I was getting a crash when I tried to run awx-ee using
ansible-navigator:

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/ansible/cli/__init__.py", line 646, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/cli/playbook.py", line 155, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/executor/playbook_executor.py", line 117, in run
    self._tqm.load_callbacks()
  File "/usr/local/lib/python3.11/site-packages/ansible/executor/task_queue_manager.py", line 198, in load_callbacks
    self._stdout_callback = callback_loader.get(self._stdout_callback)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 861, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 907, in get_with_context
    self._module_cache[path] = self._load_module_source(resolved_type_name, path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 834, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/runner/artifacts/5c4373ae-294c-4355-9717-91217391340d/callback/awx_display.py", line 317, in <module>
    class CallbackModule(DefaultCallbackModule):
TypeError: type 'NoneType' is not an acceptable base type
```

According to ansible/ansible-runner#1346 it
might be caused by the yaml output callback so this commit sets an
environment variable to set the callback to the default. It also
installs the community.general collection.
phire-tc pushed a commit to PhireLink/awx-ee that referenced this issue Dec 25, 2024
I was getting a crash when I tried to run awx-ee using
ansible-navigator:

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/ansible/cli/__init__.py", line 646, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/cli/playbook.py", line 155, in run
    results = pbex.run()
              ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/executor/playbook_executor.py", line 117, in run
    self._tqm.load_callbacks()
  File "/usr/local/lib/python3.11/site-packages/ansible/executor/task_queue_manager.py", line 198, in load_callbacks
    self._stdout_callback = callback_loader.get(self._stdout_callback)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 861, in get
    return self.get_with_context(name, *args, **kwargs).object
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 907, in get_with_context
    self._module_cache[path] = self._load_module_source(resolved_type_name, path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ansible/plugins/loader.py", line 834, in _load_module_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/runner/artifacts/5c4373ae-294c-4355-9717-91217391340d/callback/awx_display.py", line 317, in <module>
    class CallbackModule(DefaultCallbackModule):
TypeError: type 'NoneType' is not an acceptable base type
```

According to ansible/ansible-runner#1346 it
might be caused by the yaml output callback so this commit sets an
environment variable to set the callback to the default. It also
installs the community.general collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_triage New item that needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant