Uploaded image for project: 'Qpid Dispatch'
  1. Qpid Dispatch
  2. DISPATCH-1707

Policy config file fails with cryptic error if trailing brace on wrong line

    XMLWordPrintableJSON

Details

    Description

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

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

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

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

       
      then it fails with a confusing message that does not pinpoint what is wrong.

      > 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)
      

      Attachments

        Activity

          People

            chug Charles E. Rolke
            chug Charles E. Rolke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: