Rudd-O / ansible-qubes

Qubes OS DevOps automation
56 stars 12 forks source link

Example does not work. Bug in qubes.py in hack [with workaround/fix] #10

Closed abeluck closed 2 years ago

abeluck commented 4 years ago

Following the example, the ansible work -m shell -a whoami command fails to run with the following error:

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ansible/executor/task_executor.py", line 140, in run
    res = self._execute()
  File "/usr/lib/python3/dist-packages/ansible/executor/task_executor.py", line 559, in _execute
    self._set_connection_options(variables, templar)
  File "/usr/lib/python3/dist-packages/ansible/executor/task_executor.py", line 896, in _set_connection_options
    self._connection.set_options(var_options=options)
  File "/home/user/ansible-qubes/connection_plugins/qubes.py", line 255, in set_options
    if task_keys['delegate_to'] and 'management_proxy' in self._options:
TypeError: 'NoneType' object is not subscriptable

work | FAILED | rc=-1 >>
Unexpected failure during module execution.

This is caused by this line https://github.com/Rudd-O/ansible-qubes/blob/c2f006868c69e95a60538269f6f156b8be49f8b2/connection_plugins/qubes.py#L255

Changing the line to the following solves the issue.

if task_keys is not None and task_keys['delegate_to'] and 'management_proxy' in self._options