Charles E. Rolke created DISPATCH-1707:
------------------------------------------

             Summary: Policy config file fails with cryptic error if trailing 
brace on wrong line
                 Key: DISPATCH-1707
                 URL: https://issues.apache.org/jira/browse/DISPATCH-1707
             Project: Qpid Dispatch
          Issue Type: Bug
          Components: Management Agent, Policy Engine
    Affects Versions: 1.12.0
            Reporter: Charles E. Rolke


If a policy vhost in a config file is specified like this

{code:java}
vhost {
    hostname: 0.0.0.0
    allowUnknownUser: true
    groups: {
        "$default": {
            "users": "*",
            "remoteHosts": "*",
            "allowDynamicSource": true,
            "allowAnonymousSender": true,
            "sources": "*",
            "targets": "*"}
    }
}
{code}

then it works fine. Buf if the trailing brace after _targets_ is on a line by 
itself

{code:java}
vhost {
    hostname: 0.0.0.0
    allowUnknownUser: true
    groups: {
        "$default": {
            "users": "*",
            "remoteHosts": "*",
            "allowDynamicSource": true,
            "allowAnonymousSender": true,
            "sources": "*",
            "targets": "*"
        }
    }
}
{code}
 
then it fails with a confusing message that does not pinpoint what is wrong.

{code:java}
> qdrouterd -c permissive-info.conf
2020-07-08 11:18:36.907041 -0400 ERROR (error) Python: Exception: Cannot load 
configuration file permissive-info.conf: Expecting ',' delimiter: line 46 
column 3 (char 723)
2020-07-08 11:18:36.907563 -0400 ERROR (error) Traceback (most recent call 
last):
  File 
"/opt/local/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
 line 61, in __init__
    self.load(filename, raw_json)
  File 
"/opt/local/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
 line 221, in load
    self.load(f, raw_json)
  File 
"/opt/local/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
 line 223, in load
    sections = self._parserawjson(source) if raw_json else self._parse(source)
  File 
"/opt/local/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
 line 193, in _parse
    sections = json.loads(js_text)
  File "/usr/lib64/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 46 column 3 (char 
723)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/opt/local/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
 line 251, in configure_dispatch
    config = Config(filename)
  File 
"/opt/local/lib/qpid-dispatch/python/qpid_dispatch_internal/management/config.py",
 line 64, in __init__
    % (filename, e))
Exception: Cannot load configuration file permissive-info.conf: Expecting ',' 
delimiter: line 46 column 3 (char 723)

2020-07-08 11:18:36.907599 -0400 MAIN (critical) Router start-up failed: 
Python: Exception: Cannot load configuration file permissive-info.conf: 
Expecting ',' delimiter: line 46 column 3 (char 723)
qdrouterd: Python: Exception: Cannot load configuration file 
permissive-info.conf: Expecting ',' delimiter: line 46 column 3 (char 723)
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to