ossobv / asterisklint

Asterisk PBX configuration syntax checker
GNU General Public License v3.0
63 stars 12 forks source link

cannot handle hints (and crash on W_ARROW) #35

Open owoschhodan opened 5 years ago

owoschhodan commented 5 years ago
exten => 151,hint,Custom:test,CustomPresence:mypresence01

leads to

./dialplan.conf:70 I_NOTIMPL_HINT: the dialplan hint directive has not been implemented yet

exten = 151,hint,Custom:test,CustomPresence:mypresence01

which is a valid Asterisk syntax for defining hints leads to a crash:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/config.py", line 186, in __iter__
    self.on_varset(element)
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/dialplan.py", line 600, in on_varset
    dialplanvarset = DialplanVarset.from_varset(varset)
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/dialplan.py", line 473, in from_varset
    assert varset.arrow  # W_ARROW
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/asterisklint", line 34, in <module>
    sys.exit(main(sys.argv[1:], os.environ))
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/main.py", line 178, in main
    return command_module.main(args, envs)
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/mainutil.py", line 35, in __call__
    return self.handle_args(args)
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/commands/dialplan-check.py", line 50, in handle_args
    dialplan = next(iter(parser))
  File "/usr/local/lib/python3.6/dist-packages/asterisklint/config.py", line 192, in __iter__
    raise ProgrammingError(str(element.where)) from exc
asterisklint.config.ProgrammingError: An unexpected exception was raised. This is most likely a bug in the asterisklint library. If you can reproduce the problem and file an issue on the bug tracker, that would be nice. Further info: ./dialplan.conf:12
wdoekes commented 5 years ago

Thank you for raising attention to this issue.

Hints are indeed not supported yet. I don't use them myself, so I don't have much incentive to look into that any time soon unfortunately. PRs are gladly accepted though :)

The crash that happens on W_ARROW however should not happen, so I will be looking into that.