insights-core icon indicating copy to clipboard operation
insights-core copied to clipboard

Parse error with nginx when running insights-client

Open Tanjerine opened this issue 8 months ago • 0 comments

Hi,

Been running insights-client for awhile now with this error (though it doesn't seem to affect the data uploaded to the RH portal (as far as I know):

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.

I can trace it to my nginx config file that has the ^# and #$ :

# Protect files and directories from prying eyes.
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
    deny all;
    return 404;
}

Any thoughts on how I can fix? When I run my config through nginx -t, I don't see any errors. So am at a loss. Thank you!

Tanjerine avatar Jun 08 '24 07:06 Tanjerine