Skip to content

Malformed error on motd rendering for json #167

@bortok

Description

@bortok

Adding the following string to a topology causes motd rendering error:

  "oob": false,
nrx --input cyjs --file nrx/tests/site1/data/site1.cyjs --output air -T ./templates -D ~/tmp/dot
Reading platform map from: platform_map.yaml
Reading CYJS topology graph: nrx/tests/site1/data/site1.cyjs
Created air topology: /Users/xxx/tmp/dot/site1.air.json
Traceback (most recent call last):
  File "/Users/xxx/.venv/nrx310/bin/nrx", line 8, in <module>
    sys.exit(main())
  File "/Users/xxx/.venv/nrx310/lib/python3.10/site-packages/nrx/__init__.py", line 27, in main
    return cli()
  File "/Users/xxx/.venv/nrx310/lib/python3.10/site-packages/nrx/nrx.py", line 1326, in cli
    topo.export_topology()
  File "/Users/xxx/.venv/nrx310/lib/python3.10/site-packages/nrx/nrx.py", line 710, in export_topology
    self._render_topology()
  File "/Users/xxx/.venv/nrx310/lib/python3.10/site-packages/nrx/nrx.py", line 905, in _render_topology
    self._print_motd(topo)
  File "/Users/xxx/.venv/nrx310/lib/python3.10/site-packages/nrx/nrx.py", line 931, in _print_motd
    topo_dict = ast.literal_eval(topo)
  File "/usr/local/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ast.py", line 110, in literal_eval
    return _convert(node_or_string)
  File "/usr/local/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ast.py", line 99, in _convert
    return dict(zip(map(_convert, node.keys),
  File "/usr/local/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ast.py", line 109, in _convert
    return _convert_signed_num(node)
  File "/usr/local/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ast.py", line 83, in _convert_signed_num
    return _convert_num(node)
  File "/usr/local/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ast.py", line 74, in _convert_num
    _raise_malformed_node(node)
  File "/usr/local/Cellar/python@3.10/3.10.14_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ast.py", line 71, in _raise_malformed_node
    raise ValueError(msg + f': {node!r}')
ValueError: malformed node or string on line 3: <ast.Name object at 0x1049af430>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions