fboender / ansible-cmdb

Generate host overview from ansible fact gathering output
GNU General Public License v3.0
2.33k stars 465 forks source link

ansible-cmdb solaris fails #203

Open kalsto opened 4 years ago

kalsto commented 4 years ago

tried ansible -i inventory test -m setup --tree out/ Which created the facts file on my one host that I'm trying it on, then ran the command below

ansible-cmdb --debug out/ data_dir = /usr/lib/python2.7/site-packages/ansiblecmdb/data tpl_dir = /usr/lib/python2.7/site-packages/ansiblecmdb/data/tpl static_dir = /usr/lib/python2.7/site-packages/ansiblecmdb/data/static inventory files = ['hosts'] template params = {'exclude_columns': None, 'data_dir': '/usr/lib/python2.7/site-packages/ansiblecmdb/data', 'log': <logging.RootLogger object at 0xf9015c90>, 'lib_dir': '/usr/lib/python2.7/site-packages/ansiblecmdb/data', 'cust_cols': [], 'version': '1.30', 'columns': None} Parsing fact dir: out/ Reading host facts from out/vns80 Determining type of inventory_path hosts hosts is a file. Handle as static inventory file Inventory path hosts is a file. Reading as inventory. Parsing host vars (dir): host_vars Parsing group vars (dir): group_vars Reading group vars from group_vars/all.yml Reading group vars from group_vars/oss-user.yml Reading group vars from group_vars/solaris-oracle.yml Reading group vars from group_vars/sol-hosts.yml Reading group vars from group_vars/solaris-oss.yml Whoops, it looks like something went wrong while rendering the template.

The reported error was: SyntaxException: (SyntaxError) unexpected EOF while parsing (, line 1) (u"r_dict(jsonxs(host, 'ansible_facts.ansible_local',") in file '/usr/lib/python2.7/site-packages/ansiblecmdb/data/tpl/html_fancy_defs.html' at line: 756 char: 5

The full error was:

Traceback (most recent call last):
  File "/usr/bin/../lib/ansiblecmdb/ansible-cmdb.py", line 216, in <module>
    output = renderer.render(ansible.get_hosts(), params)
  File "/usr/lib/python2.7/site-packages/ansiblecmdb/render.py", line 42, in render
    return self._render_mako(hosts, vars)
  File "/usr/lib/python2.7/site-packages/ansiblecmdb/render.py", line 59, in _render_mako
    return template.render(hosts=hosts, **vars)
  File "/usr/lib/python2.7/vendor-packages/mako/template.py", line 296, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/python2.7/vendor-packages/mako/runtime.py", line 660, in _render
    **_kwargs_for_callable(callable_, data))
  File "/usr/lib/python2.7/vendor-packages/mako/runtime.py", line 692, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/python2.7/vendor-packages/mako/runtime.py", line 718, in _exec_template
    callable_(context, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/ansiblecmdb/data/tpl/html_fancy.tpl", line 4, in render_body
    <%namespace name="defs" file="/html_fancy_defs.html" import="*" />
  File "/usr/lib/python2.7/site-packages/ansiblecmdb/data/tpl/html_fancy.tpl", line 2, in _mako_get_namespace
    <%! from ansiblecmdb.util import to_bool %>
  File "/usr/lib/python2.7/site-packages/ansiblecmdb/data/tpl/html_fancy.tpl", line 4, in _mako_generate_namespaces
    <%namespace name="defs" file="/html_fancy_defs.html" import="*" />
  File "/usr/lib/python2.7/vendor-packages/mako/runtime.py", line 403, in __init__
    calling_uri)
  File "/usr/lib/python2.7/vendor-packages/mako/runtime.py", line 626, in _lookup_template
    return lookup.get_template(uri)
  File "/usr/lib/python2.7/vendor-packages/mako/lookup.py", line 218, in get_template
    return self._load(srcfile, uri)
  File "/usr/lib/python2.7/vendor-packages/mako/lookup.py", line 283, in _load
    **self.template_args)
  File "/usr/lib/python2.7/vendor-packages/mako/template.py", line 218, in __init__
    module = self._compile_from_file(path, filename)
  File "/usr/lib/python2.7/vendor-packages/mako/template.py", line 262, in _compile_from_file
    filename)
  File "/usr/lib/python2.7/vendor-packages/mako/template.py", line 478, in _compile_text
    node = lexer.parse()
  File "/usr/lib/python2.7/vendor-packages/mako/lexer.py", line 209, in parse
    if self.match_expression():
  File "/usr/lib/python2.7/vendor-packages/mako/lexer.py", line 369, in match_expression
    lineno=line, pos=pos)
  File "/usr/lib/python2.7/vendor-packages/mako/lexer.py", line 125, in append_node
    node = nodecls(*args, **kwargs)
  File "/usr/lib/python2.7/vendor-packages/mako/parsetree.py", line 172, in __init__
    self.code = ast.PythonCode(text, **self.exception_kwargs)
  File "/usr/lib/python2.7/vendor-packages/mako/ast.py", line 34, in __init__
    expr = pyparser.parse(code.lstrip(), "exec", **exception_kwargs)
  File "/usr/lib/python2.7/vendor-packages/mako/pyparser.py", line 60, in parse
    ), **exception_kwargs)
SyntaxException: (SyntaxError) unexpected EOF while parsing (<unknown>, line 1) (u"r_dict(jsonxs(host, 'ansible_facts.ansible_local',") in file '/usr/lib/python2.7/site-packages/ansiblecmdb/data/tpl/html_fancy_defs.html' at line: 756 char: 5

The output is probably not correct.

You can report a bug on the issue tracker:

https://github.com/fboender/ansible-cmdb/issues

Please include the debugging output (-d switch) in the report!

If you can, also include the hosts file and the facts file for the last host that rendered properly ('Rendering host...' in the output. If these files must remain confidential, you can send them to ferry.boender@gmail.com instead.

I can't add the facts file at this time

fboender commented 2 years ago

Huh, weird. Just be be clear, you're not running ansible-cmdb itself on a Solaris host, right? It's just the facts come from an Solaris host?

Did you make any modifications to html_fancy_defs.html?