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

Debian 11 can't use default template with ansible-cmdb 1.31 #247

Open
itservices-trust opened this issue Jun 17, 2022 · 3 comments
Open

Comments

@itservices-trust
Copy link

Hi,
I have a role in Ansible that automates html page creation with ansible-cmdb.
I have ansible-cmdb version 1.31.

With Debian 11 upgrade does not work anymore, if I execute:
/usr/bin/ansible-cmdb -i /srv/ansible_repos/inventory/all /srv/ansible_out/hosts > /srv/ansible_out/html/index.html

I receive the following error:

Traceback (most recent call last):
  File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 18, in _mako_get_namespace
KeyError: ('_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl', 'defs')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/ansible-cmdb/mako/lookup.py", line 237, in get_template
    return self._check(uri, self._collection[uri])
KeyError: '/html_fancy_defs.html'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/../lib/ansible-cmdb/ansible-cmdb.py", line 214, in <module>
    output = renderer.render(ansible.get_hosts(), params)
  File "/usr/lib/ansible-cmdb/ansiblecmdb/render.py", line 42, in render
    return self._render_mako(hosts, vars)
  File "/usr/lib/ansible-cmdb/ansiblecmdb/render.py", line 59, in _render_mako
    return template.render(hosts=hosts, **vars)
  File "/usr/lib/ansible-cmdb/mako/template.py", line 443, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/ansible-cmdb/mako/runtime.py", line 802, in _render
    _render_context(template, callable_, context, *args,
  File "/usr/lib/ansible-cmdb/mako/runtime.py", line 835, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/ansible-cmdb/mako/runtime.py", line 860, in _exec_template
    callable_(context, *args, **kwargs)
  File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 31, in render_body
  File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 20, in _mako_get_namespace
  File "_usr_lib_ansible_cmdb_ansiblecmdb_data_tpl_html_fancy_tpl", line 23, in _mako_generate_namespaces
  File "/usr/lib/ansible-cmdb/mako/runtime.py", line 545, in __init__
    self.template = _lookup_template(context, templateuri,
  File "/usr/lib/ansible-cmdb/mako/runtime.py", line 769, in _lookup_template
    return lookup.get_template(uri)
  File "/usr/lib/ansible-cmdb/mako/lookup.py", line 245, in get_template
    return self._load(srcfile, uri)
  File "/usr/lib/ansible-cmdb/mako/lookup.py", line 306, in _load
    self._collection[uri] = template = Template(
  File "/usr/lib/ansible-cmdb/mako/template.py", line 321, in __init__
    module = self._compile_from_file(path, filename)
  File "/usr/lib/ansible-cmdb/mako/template.py", line 396, in _compile_from_file
    code, module = _compile_text(
  File "/usr/lib/ansible-cmdb/mako/template.py", line 672, in _compile_text
    code = compile(source, cid, 'exec')
  File "_html_fancy_defs_html", line 97
    def render_var_cols(context,cols_visible=,cols_exclude=):
                                             ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/../lib/ansible-cmdb/ansible-cmdb.py", line 221, in <module>
    full_err = exceptions.text_error_template().render().replace("\n", "\n    ")
  File "/usr/lib/ansible-cmdb/mako/exceptions.py", line 219, in text_error_template
    return mako.template.Template(r"""
  File "/usr/lib/ansible-cmdb/mako/template.py", line 303, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/usr/lib/ansible-cmdb/mako/template.py", line 672, in _compile_text
    code = compile(source, cid, 'exec')
  File "memory:0x7f9b3fa85c40", line 18
    def render_body(context,error=,traceback=,**pageargs):
                                  ^
SyntaxError: invalid syntax
@itservices-trust
Copy link
Author

Solved installing ansible-cmdb with pip instead of .deb package!

@Frank-dbc
Copy link

thanks @itservices-trust a life-saver! after fighting a few days with the .deb package not working, i now have a ansible-cmdb that works!

@itservices-trust
Copy link
Author

thanks @itservices-trust a life-saver! after fighting a few days with the .deb package not working, i now have a ansible-cmdb that works!

you're welcome! 👍

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