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

Errors from debops.avahi with 3.0.5 and ansible 2.15.2 #2395

Open
sjthespian opened this issue Aug 21, 2023 · 1 comment
Open

Errors from debops.avahi with 3.0.5 and ansible 2.15.2 #2395

sjthespian opened this issue Aug 21, 2023 · 1 comment

Comments

@sjthespian
Copy link

sjthespian commented Aug 21, 2023

I am running into an error trying to use devops.avahi with ansible 2.15.2. I'm not sure what it is complaining about, as I am not setting any avahi int values in my host or group variables, so I'm assuming this is coming from some incompatibility with the defaults in the role and the version of ansible I am running.

These are the only avahi variables I set:

avahi__enabled: True
avahi__publish_hinfo: true
avahi__publish_workstation: true
avahi__publish_device_info: true
avahi__disallow_other_stacks: False
avahi__python__dependent_packages3:
  - python3-avahi
avahi__python__dependent_packages2:
  - python3-avahi

My ansible info:

> ansible --version
ansible [core 2.15.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True

And the error output with -vvvv:

TASK [debops.debops.avahi : Configure avahi-daemon] ****************************************************************************************************
task path: /root/.ansible/collections/ansible_collections/debops/debops/roles/avahi/tasks/main.yml:32
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ansible/template/__init__.py", line 1001, in do_template
    res = myenv.concat(rf)
  File "/usr/lib/python3/dist-packages/ansible/template/native_helpers.py", line 83, in ansible_concat
    return ''.join([to_text(v) for v in nodes])
  File "/usr/lib/python3/dist-packages/ansible/template/native_helpers.py", line 83, in <listcomp>
    return ''.join([to_text(v) for v in nodes])
  File "<template>", line 161, in root
  File "/usr/lib/python3/dist-packages/jinja2/runtime.py", line 349, in call
    return __obj(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/jinja2/runtime.py", line 814, in __call__
    return self._invoke(arguments, autoescape)
  File "/usr/lib/python3/dist-packages/jinja2/runtime.py", line 828, in _invoke
    rv = self._func(*arguments)
  File "<template>", line 158, in macro
TypeError: sequence item 27: expected str instance, int found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ansible/plugins/action/template.py", line 152, in run
    resultant = templar.do_template(template_data, preserve_trailing_newlines=True, escape_backslashes=False, overrides=overrides)
  File "/usr/lib/python3/dist-packages/ansible/template/__init__.py", line 1012, in do_template
    raise AnsibleError("Unexpected templating type error occurred on (%s): %s" % (to_native(data), to_native(te)), orig_exc=te)
ansible.errors.AnsibleError: Unexpected templating type error occurred on ({# Copyright (C) 2017-2019 Maciej Delmanowski <drybjed@gmail.com>
 # Copyright (C) 2017-2019 DebOps <https://debops.org/>
 # SPDX-License-Identifier: GPL-2.0-or-later
 #}
# {{ ansible_managed }}

# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.

# See avahi-daemon.conf(5) for more information on this configuration
# file!

{% macro print_config(section, data) %}
[{{ section }}]
{%   for key in data.keys() %}
{%     if data[key] is iterable and data[key] is not string and data[key] is not mapping %}
{%       if data[key] %}
{{ key }}={{ data[key] | join(', ') }}
{%       else %}
#{{ key }}={{ data[key] | join(', ') }}
{%       endif %}
{%     elif data[key] | bool and data[key] is not iterable %}
{{ key }}=yes
{%     elif not data[key] | bool and data[key] is not iterable %}
{%       if data[key] is not none %}
{%         if data[key] | int or data[key] | string == '0' %}
{{ key }}={{ data[key] }}
{%         else %}
{{ key }}=no
{%         endif %}
{%       endif %}
{%     else %}
{%       if data[key] %}
{{ key }}={{ data[key] }}
{%       else %}
#{{ key }}={{ data[key] }}
{%       endif %}
{%     endif %}
{%   endfor %}
{% endmacro %}
{{ print_config('server',    avahi__daemon_conf_default_server    | combine(avahi__daemon_conf_server)) }}
{{ print_config('wide-area', avahi__daemon_conf_default_wide_area | combine(avahi__daemon_conf_wide_area)) }}
{{ print_config('publish',   avahi__daemon_conf_default_publish   | combine(avahi__daemon_conf_publish)) }}
{{ print_config('reflector', avahi__daemon_conf_default_reflector | combine(avahi__daemon_conf_reflector)) }}
{{ print_config('rlimits',   avahi__daemon_conf_default_rlimits   | combine(avahi__daemon_conf_rlimits)) }}
): sequence item 27: expected str instance, int found. sequence item 27: expected str instance, int found
fatal: [morpheus.lapseofthought.com]: FAILED! => {
    "changed": false,
    "msg": "AnsibleError: Unexpected templating type error occurred on ({# Copyright (C) 2017-2019 Maciej Delmanowski <drybjed@gmail.com>\n # Copyright (C) 2017-2019 DebOps <https://debops.org/>\n # SPDX-License-Identifier: GPL-2.0-or-later\n #}\n# {{ ansible_managed }}\n\n# This file is part of avahi.\n#\n# avahi is free software; you can redistribute it and/or modify it\n# under the terms of the GNU Lesser General Public License as\n# published by the Free Software Foundation; either version 2 of the\n# License, or (at your option) any later version.\n#\n# avahi is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public\n# License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with avahi; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\n# USA.\n\n# See avahi-daemon.conf(5) for more information on this configuration\n# file!\n\n{% macro print_config(section, data) %}\n[{{ section }}]\n{%   for key in data.keys() %}\n{%     if data[key] is iterable and data[key] is not string and data[key] is not mapping %}\n{%       if data[key] %}\n{{ key }}={{ data[key] | join(', ') }}\n{%       else %}\n#{{ key }}={{ data[key] | join(', ') }}\n{%       endif %}\n{%     elif data[key] | bool and data[key] is not iterable %}\n{{ key }}=yes\n{%     elif not data[key] | bool and data[key] is not iterable %}\n{%       if data[key] is not none %}\n{%         if data[key] | int or data[key] | string == '0' %}\n{{ key }}={{ data[key] }}\n{%         else %}\n{{ key }}=no\n{%         endif %}\n{%       endif %}\n{%     else %}\n{%       if data[key] %}\n{{ key }}={{ data[key] }}\n{%       else %}\n#{{ key }}={{ data[key] }}\n{%       endif %}\n{%     endif %}\n{%   endfor %}\n{% endmacro %}\n{{ print_config('server',    avahi__daemon_conf_default_server    | combine(avahi__daemon_conf_server)) }}\n{{ print_config('wide-area', avahi__daemon_conf_default_wide_area | combine(avahi__daemon_conf_wide_area)) }}\n{{ print_config('publish',   avahi__daemon_conf_default_publish   | combine(avahi__daemon_conf_publish)) }}\n{{ print_config('reflector', avahi__daemon_conf_default_reflector | combine(avahi__daemon_conf_reflector)) }}\n{{ print_config('rlimits',   avahi__daemon_conf_default_rlimits   | combine(avahi__daemon_conf_rlimits)) }}\n): sequence item 27: expected str instance, int found. sequence item 27: expected str instance, int found"
}
@sjthespian
Copy link
Author

It looks like it's an incompatibility between 2.12 and 2.15. Rolling back to 2.12 works.

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

1 participant