Uploaded image for project: 'Red Hat Insights Engineering'
  1. Red Hat Insights Engineering
  2. RHINENG-9862

The 3.3.20 core gives an exception when parsing the nginx config file.

XMLWordPrintable

    • Moderate

      ** Note that this is a public ticket, please refrain from adding any sensitive data. **

      Description of Problem

      When running the `insights-client` command, it gives a parser exception about a "~" character in the `/etc/nginx/nginx.conf` file. However, the configuration is valid.

      Traceback (most recent call last):
        File "/var/lib/insights/last_stable.egg/insights/parsers/nginx_conf.py", line 156, in parse_doc
          return Entry(children=self.Top("\n".join(content))[0], src=self)
        File "/var/lib/insights/last_stable.egg/insights/parsr/__init__.py", line 356, in __call__
          raise Exception(err.read())
      Exception: At line 83 column 8:
      any whitespace
          Expected any whitespace. Got '~'.
      any whitespace
          Expected any whitespace. Got '~'.
      any whitespace
          Expected any whitespace. Got '~'.    Expected 1 of ['/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']. Got '~'.    Expected '. Got '~'.    Expected ". Got '~'.
      Literal'#'
          Expected '#'. Got '~'.
      any whitespace
          Expected any whitespace. Got '~'.    Expected }. Got '~'.
      During handling of the above exception, another exception occurred:Traceback (most recent call last):
        File "/var/lib/insights/last_stable.egg/insights/core/plugins.py", line 170, in invoke
          r = self.component(d)
        File "/var/lib/insights/last_stable.egg/insights/parsers/nginx_conf.py", line 152, in __init__
          super(NginxConfPEG, self).__init__(*args, **kwargs)
        File "/var/lib/insights/last_stable.egg/insights/core/__init__.py", line 89, in __init__
          self._handle_content(context)
        File "/var/lib/insights/last_stable.egg/insights/core/__init__.py", line 92, in _handle_content
          self.parse_content(context.content)
        File "/var/lib/insights/last_stable.egg/insights/core/__init__.py", line 347, in parse_content
          self.doc = self.parse_doc(content)
        File "/var/lib/insights/last_stable.egg/insights/parsers/nginx_conf.py", line 158, in parse_doc
          raise ParseException("There was an exception when parsing the config file.")
      insights.core.exceptions.ParseException: There was an exception when parsing the config file. 

      How reproducible

      Always

      Steps to Reproduce

      • Have the following config in the `/etc/nginx/nginx.conf` file:
          map $uri $expires {
             default                    off;
             ~*\.(js|css|png|jpg|jpeg|gif|svg|ico|woff2)$       max;
          } 
      • Run the `insights-client` command.

      Actual Behavior

      Insights-client gives the following exception:

      insights.core.exceptions.ParseException: There was an exception when parsing the config file. 

      Expected Behavior

      Insights should run without the parser exception as it is a valid configuration.

              rhn-support-xialiu Xiangce Liu
              rhn-support-ngupta Nikhil Gupta
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: