Bug 1859968

Summary: sosreport doesn't collect haproxy.cfg
Product: Red Hat Enterprise Linux 8 Reporter: Arie Bregman <abregman>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav HradĂ­lek <mhradile>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: agk, bmr, bperkins, cww, knoha, mhradile, plambri, sbradley
Target Milestone: rcKeywords: ZStream
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.0-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1993051 1993052 (view as bug list) Environment:
Last Closed: 2021-05-18 14:47:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1993051, 1993052    

Description Arie Bregman 2020-07-23 11:59:38 UTC
Description of problem:

Running sosreport doesn't collect containerized haproxy config from /var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfg

Version-Release number of selected component (if applicable): sos-3.8.6


How reproducible: 100%


Steps to Reproduce:
1. run sesreport
2. open archive and see there is no /var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfg

Comment 1 Pavel Moravec 2020-07-23 12:19:18 UTC
This sounds strange, since haproxy plugin there matches

https://github.com/sosreport/sos/blame/legacy-3.9/sos/plugins/haproxy.py

where I see:

class HAProxy(Plugin, RedHatPlugin, DebianPlugin):
    """HAProxy load balancer
    """

    plugin_name = 'haproxy'
    profiles = ('webserver',)

    packages = ('haproxy',)

    def setup(self):
        var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
        self.add_copy_spec([
            "/etc/haproxy/haproxy.cfg",
            var_puppet_gen + "/etc/haproxy/haproxy.cfg"
        ])
    ..


So, /var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfg should be collected. If this plugin was enabled.


Is haproxy package installed on the system? Could you please run "sosreport -vvv" and attach the tarball afterwards?

Comment 3 Pavel Moravec 2020-07-23 14:56:34 UTC
So then the haproxy plugin needs to be enabled not only by presence of the package, but also by presence of the haproxy directory.

Will this change help?

--- /usr/lib/python3.6/site-packages/sos/plugins/haproxy.py
+++ /usr/lib/python3.6/site-packages/sos/plugins/haproxy.py
@@ -25,12 +25,13 @@ class HAProxy(Plugin, RedHatPlugin, Debi
     profiles = ('webserver',)
 
     packages = ('haproxy',)
+    var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
+    files = ( var_puppet_gen, )
 
     def setup(self):
-        var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
         self.add_copy_spec([
             "/etc/haproxy/haproxy.cfg",
-            var_puppet_gen + "/etc/haproxy/haproxy.cfg"
+            self.var_puppet_gen + "/etc/haproxy/haproxy.cfg"
         ])
         self.add_copy_spec("/etc/haproxy/conf.d/*")
         self.add_cmd_output("haproxy -f /etc/haproxy/haproxy.cfg -c")

Comment 4 Arie Bregman 2020-07-23 14:59:49 UTC
(In reply to Pavel Moravec from comment #3)
> So then the haproxy plugin needs to be enabled not only by presence of the
> package, but also by presence of the haproxy directory.
> 
> Will this change help?
> 
> --- /usr/lib/python3.6/site-packages/sos/plugins/haproxy.py
> +++ /usr/lib/python3.6/site-packages/sos/plugins/haproxy.py
> @@ -25,12 +25,13 @@ class HAProxy(Plugin, RedHatPlugin, Debi
>      profiles = ('webserver',)
>  
>      packages = ('haproxy',)
> +    var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
> +    files = ( var_puppet_gen, )
>  
>      def setup(self):
> -        var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
>          self.add_copy_spec([
>              "/etc/haproxy/haproxy.cfg",
> -            var_puppet_gen + "/etc/haproxy/haproxy.cfg"
> +            self.var_puppet_gen + "/etc/haproxy/haproxy.cfg"
>          ])
>          self.add_copy_spec("/etc/haproxy/conf.d/*")
>          self.add_cmd_output("haproxy -f /etc/haproxy/haproxy.cfg -c")

I'm not familiar with sos code but if that makes sosreport to collect haproxy not only when the package is present then yes, great. Thank you

Comment 5 Pavel Moravec 2020-07-23 15:12:52 UTC
That codechange will automatically collect the cfg file whenever /var/lib/config-data/puppet-generated/haproxy is present on the system.

Comment 6 Arie Bregman 2020-07-23 15:41:50 UTC
(In reply to Pavel Moravec from comment #5)
> That codechange will automatically collect the cfg file whenever
> /var/lib/config-data/puppet-generated/haproxy is present on the system.

Perfect, thank you.

Comment 10 Maros Kopec 2021-01-21 12:48:05 UTC
Tested manually on RHEL-8.4 x86_64 without haproxy installed by mocking haproxy.cfg file.

# rpm -qa haproxy
# rpm -qa sos
sos-4.0-5.el8.noarch

# mkdir -p  /var/lib/config-data/puppet-generated/haproxy/etc/haproxy/
# touch /var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfg

# sos report
...
Your sosreport has been generated and saved in:
	/var/tmp/sosreport-host-10-0-139-2-1234567890-2021-01-21-iflubtf.tar.xz

# tar -tf /var/tmp/sosreport-host-10-0-139-2-1234567890-2021-01-21-iflubtf.tar.xz | grep haproxy
sosreport-host-10-0-139-2-1234567890-2021-01-21-iflubtf/var/lib/config-data/puppet-generated/haproxy/
sosreport-host-10-0-139-2-1234567890-2021-01-21-iflubtf/var/lib/config-data/puppet-generated/haproxy/etc/
sosreport-host-10-0-139-2-1234567890-2021-01-21-iflubtf/var/lib/config-data/puppet-generated/haproxy/etc/haproxy/
sosreport-host-10-0-139-2-1234567890-2021-01-21-iflubtf/var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfg

Comment 12 errata-xmlrpc 2021-05-18 14:47:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sos bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:1604

Comment 13 Pavel Moravec 2021-07-27 10:45:02 UTC
There is a z-stream request to backport this to 8.2 (only) for better support experience of OSP16.1 still in use by many customers.

Could you please provide business justification to get approval from SST CEE or PM lead ?

Comment 14 Keigo Noha 2021-07-28 00:42:18 UTC
Hi Pavel-san,

Thank you for your comment on this.

Business Justification:
OSP16.1 is supported until April 30 2024 using RHEL8.2 EUS provided in the normal RHOSP subscriptions and RHEL8.2 TUS which OSP16.1 EUS provides the access to.
Support team in Red Hat and OEM partners expect that sosreport command collect all configuration files of RHOSP16.
Lacking this fix needs an additional work in support side and it will have an impact to customer satisfaction by taking a time to collect haproxy configuration additionally.
For better support experience, the fix should be backported into RHEL8.2.

To SST CEE or PM,
Could you please grant an approval for backporting to RHEL8.2.z? 

Kind Regards,
Keigo Noha