diff --git a/SOURCES/sos-3.4-centos-branding.patch b/SOURCES/sos-3.4-centos-branding.patch deleted file mode 100644 index ed4e8ae..0000000 --- a/SOURCES/sos-3.4-centos-branding.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff -uNrp sos-3.4.orig/sos/policies/redhat.py sos-3.4/sos/policies/redhat.py ---- sos-3.4.orig/sos/policies/redhat.py 2017-08-09 22:26:42.179358997 +0000 -+++ sos-3.4/sos/policies/redhat.py 2017-08-09 22:33:25.371349658 +0000 -@@ -34,9 +34,9 @@ except: - - - class RedHatPolicy(LinuxPolicy): -- distro = "Red Hat" -- vendor = "Red Hat" -- vendor_url = "http://www.redhat.com/" -+ distro = "CentOS" -+ vendor = "CentOS" -+ vendor_url = "http://www.centos.org/" - _redhat_release = '/etc/redhat-release' - _tmp_dir = "/var/tmp" - _rpmq_cmd = 'rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"' -@@ -82,9 +82,9 @@ class RedHatPolicy(LinuxPolicy): - - @classmethod - def check(cls): -- """This method checks to see if we are running on Red Hat. It must be -+ """This method checks to see if we are running on CentOS. It must be - overriden by concrete subclasses to return True when running on a -- Fedora, RHEL or other Red Hat distribution or False otherwise.""" -+ Fedora, RHEL or other CentOS distribution or False otherwise.""" - return False - - def _container_init(self): -@@ -132,15 +132,15 @@ class RedHatPolicy(LinuxPolicy): - def get_local_name(self): - return self.host_name() - --# Container environment variables on Red Hat systems. -+# Container environment variables on CentOS systems. - ENV_CONTAINER = 'container' - ENV_HOST_SYSROOT = 'HOST' - - - class RHELPolicy(RedHatPolicy): -- distro = "Red Hat Enterprise Linux" -- vendor = "Red Hat" -- vendor_url = "https://access.redhat.com/support/" -+ distro = "CentOS Linux" -+ vendor = "CentOS" -+ vendor_url = "https://wiki.centos.org/" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system and installed \ -@@ -204,7 +204,7 @@ No changes will be made to system config - - - class RedHatAtomicPolicy(RHELPolicy): -- distro = "Red Hat Atomic Host" -+ distro = "CentOS Atomic Host" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system. diff --git a/SOURCES/sos-bz1463635-openstack-containerized-tripleo.patch b/SOURCES/sos-bz1463635-openstack-containerized-tripleo.patch new file mode 100644 index 0000000..332e32b --- /dev/null +++ b/SOURCES/sos-bz1463635-openstack-containerized-tripleo.patch @@ -0,0 +1,1533 @@ +From 665b85fcf25c016cbb467f8d9e3e93c2005b0fb9 Mon Sep 17 00:00:00 2001 +From: Bogdan Dobrelya +Date: Wed, 28 Jun 2017 21:34:39 +0200 +Subject: [PATCH] [plugins] Tripleo specific containerized services logs + (#1046) + +Add Tripleo Pike opinionated logs paths to be collected +for services, when running in containers. This is a temporary +and will be reworked for Queens, like switching those to syslog +or fluentd shipping logs to Elasticsearch cluster. + +Partial bug: https://bugs.launchpad.net/tripleo/+bug/1700909 +Related blueprint: https://review.openstack.org/#/c/462900 + +Signed-off-by: Bogdan Dobrelya +Signed-off-by: Adam Stokes +--- + sos/plugins/mongodb.py | 3 ++- + sos/plugins/mysql.py | 2 ++ + sos/plugins/openstack_ceilometer.py | 7 +++++-- + sos/plugins/openstack_cinder.py | 8 ++++++-- + sos/plugins/openstack_glance.py | 8 ++++++-- + sos/plugins/openstack_heat.py | 8 ++++++-- + sos/plugins/openstack_horizon.py | 8 ++++++-- + sos/plugins/openstack_instack.py | 12 ++++++++---- + sos/plugins/openstack_ironic.py | 8 ++++++-- + sos/plugins/openstack_keystone.py | 8 ++++++-- + sos/plugins/openstack_manila.py | 6 ++++-- + sos/plugins/openstack_neutron.py | 8 ++++++-- + sos/plugins/openstack_nova.py | 8 ++++++-- + sos/plugins/openstack_sahara.py | 8 ++++++-- + sos/plugins/openstack_swift.py | 8 ++++++-- + sos/plugins/openstack_trove.py | 8 ++++++-- + sos/plugins/pacemaker.py | 3 ++- + sos/plugins/rabbitmq.py | 3 ++- + sos/plugins/redis.py | 6 ++++-- + 19 files changed, 95 insertions(+), 35 deletions(-) + +diff --git a/sos/plugins/mongodb.py b/sos/plugins/mongodb.py +index 5d7d601..46b0251 100644 +--- a/sos/plugins/mongodb.py ++++ b/sos/plugins/mongodb.py +@@ -30,7 +30,8 @@ class MongoDb(Plugin, DebianPlugin, UbuntuPlugin): + def setup(self): + self.add_copy_spec([ + "/etc/mongodb.conf", +- "/var/log/mongodb/mongodb.log" ++ "/var/log/mongodb/mongodb.log", ++ "/var/log/containers/mongodb/mongodb.log" + ]) + + def postproc(self): +diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py +index b750ed3..7bf933a 100644 +--- a/sos/plugins/mysql.py ++++ b/sos/plugins/mysql.py +@@ -40,12 +40,14 @@ class Mysql(Plugin): + # Required for MariaDB under pacemaker (MariaDB-Galera) + "/var/log/mysqld.log", + "/var/log/mysql/mysqld.log", ++ "/var/log/containers/mysql/mysqld.log", + "/var/log/mariadb/mariadb.log", + ]) + + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/mysql*", ++ "/var/log/containers/mysql*", + "/var/log/mariadb*" + ]) + +diff --git a/sos/plugins/openstack_ceilometer.py b/sos/plugins/openstack_ceilometer.py +index 8e3e8e9..2c3a809 100644 +--- a/sos/plugins/openstack_ceilometer.py ++++ b/sos/plugins/openstack_ceilometer.py +@@ -32,9 +32,12 @@ class OpenStackCeilometer(Plugin): + # Ceilometer + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/ceilometer/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/ceilometer/", ++ "/var/log/containers/ceilometer/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/ceilometer/*.log", ++ self.add_copy_spec(["/var/log/ceilometer/*.log", ++ "/var/log/containers/ceilometer/*.log"], + sizelimit=self.limit) + self.add_copy_spec("/etc/ceilometer/") + if self.get_option("verify"): +diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py +index 0383a8a..ffec62b 100644 +--- a/sos/plugins/openstack_cinder.py ++++ b/sos/plugins/openstack_cinder.py +@@ -40,9 +40,13 @@ class OpenStackCinder(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/cinder/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/cinder/", ++ "/var/log/containers/cinder/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/cinder/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/cinder/*.log", ++ "/var/log/containers/cinder/*.log"], ++ sizelimit=self.limit) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index 1aa0cb7..88d06e3 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -38,9 +38,13 @@ class OpenStackGlance(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/glance/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/glance/", ++ "/var/log/containers/glance/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/glance/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/glance/*.log", ++ "/var/log/containers/glance/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec("/etc/glance/") + +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index 451bad3..2dad83f 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -45,9 +45,13 @@ class OpenStackHeat(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/heat/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/heat/", ++ "/var/log/containers/heat/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/heat/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/heat/*.log", ++ "/var/log/containers/heat/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec("/etc/heat/") + +diff --git a/sos/plugins/openstack_horizon.py b/sos/plugins/openstack_horizon.py +index f778b91..75ad3ce 100644 +--- a/sos/plugins/openstack_horizon.py ++++ b/sos/plugins/openstack_horizon.py +@@ -32,9 +32,13 @@ class OpenStackHorizon(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/horizon/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/horizon/", ++ "/var/log/containers/horizon/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/horizon/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/horizon/*.log", ++ "/var/log/containers/horizon/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec("/etc/openstack-dashboard/") + self.add_forbidden_path("*.py[co]") +diff --git a/sos/plugins/openstack_instack.py b/sos/plugins/openstack_instack.py +index 3c87de8..87ec59f 100644 +--- a/sos/plugins/openstack_instack.py ++++ b/sos/plugins/openstack_instack.py +@@ -34,14 +34,18 @@ class OpenStackInstack(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/mistral/", ++ self.add_copy_spec(["/var/log/mistral/", ++ "/var/log/containers/mistral/"], + sizelimit=self.limit) +- self.add_copy_spec("/var/log/zaqar/", ++ self.add_copy_spec(["/var/log/zaqar/", ++ "/var/log/containers/zaqar/"], + sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/mistral/*.log", ++ self.add_copy_spec(["/var/log/mistral/*.log", ++ "/var/log/containers/mistral/*.log"], + sizelimit=self.limit) +- self.add_copy_spec("/var/log/zaqar/*.log", ++ self.add_copy_spec(["/var/log/zaqar/*.log", ++ "/var/log/containers/zaqar/*.log"], + sizelimit=self.limit) + + vars = [p in os.environ for p in [ +diff --git a/sos/plugins/openstack_ironic.py b/sos/plugins/openstack_ironic.py +index f225427..e4e320d 100644 +--- a/sos/plugins/openstack_ironic.py ++++ b/sos/plugins/openstack_ironic.py +@@ -31,9 +31,13 @@ class OpenStackIronic(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/ironic/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/ironic/", ++ "/var/log/containers/ironic/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/ironic/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/ironic/*.log", ++ "/var/log/containers/ironic/*.log"], ++ sizelimit=self.limit) + + self.add_cmd_output('ls -laRt /var/lib/ironic/') + +diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py +index cb8a626..5a8f4e2 100644 +--- a/sos/plugins/openstack_keystone.py ++++ b/sos/plugins/openstack_keystone.py +@@ -37,9 +37,13 @@ class OpenStackKeystone(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/keystone/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/keystone/", ++ "/var/log/containers/keystone/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/keystone/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/keystone/*.log", ++ "/var/log/containers/keystone/*.log"], ++ sizelimit=self.limit) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +diff --git a/sos/plugins/openstack_manila.py b/sos/plugins/openstack_manila.py +index ce50a31..c1e6609 100644 +--- a/sos/plugins/openstack_manila.py ++++ b/sos/plugins/openstack_manila.py +@@ -29,10 +29,12 @@ class OpenStackManila(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/manila/*", ++ self.add_copy_spec(["/var/log/manila/*", ++ "/var/log/containers/manila/*"], + sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/manila/*.log", ++ self.add_copy_spec(["/var/log/manila/*.log", ++ "/var/log/containers/manila/*.log"], + sizelimit=self.limit) + + def postproc(self): +diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py +index 62fd1c3..b0f6699 100644 +--- a/sos/plugins/openstack_neutron.py ++++ b/sos/plugins/openstack_neutron.py +@@ -29,9 +29,13 @@ class OpenStackNeutron(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/neutron/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/neutron/", ++ "/var/log/containers/neutron/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/neutron/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/neutron/*.log", ++ "/var/log/containers/neutron/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec("/etc/neutron/") + self.add_copy_spec("/var/lib/neutron/") +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index 14bdfbd..3dda7af 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -63,9 +63,13 @@ class OpenStackNova(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/nova/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/nova/", ++ "/var/log/containers/nova/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/nova/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/nova/*.log", ++ "/var/log/containers/nova/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec("/etc/nova/") + +diff --git a/sos/plugins/openstack_sahara.py b/sos/plugins/openstack_sahara.py +index adbad32..adaedf9 100644 +--- a/sos/plugins/openstack_sahara.py ++++ b/sos/plugins/openstack_sahara.py +@@ -32,9 +32,13 @@ class OpenStackSahara(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/sahara/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/sahara/", ++ "/var/log/containers/sahara/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/sahara/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/sahara/*.log", ++ "/var/log/containers/sahara/*.log"], ++ sizelimit=self.limit) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +diff --git a/sos/plugins/openstack_swift.py b/sos/plugins/openstack_swift.py +index 790a4cb..9906b94 100644 +--- a/sos/plugins/openstack_swift.py ++++ b/sos/plugins/openstack_swift.py +@@ -31,9 +31,13 @@ class OpenStackSwift(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/swift/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/swift/", ++ "/var/log/containers/swift/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/swift/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/swift/*.log", ++ "/var/log/containers/swift/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec("/etc/swift/") + +diff --git a/sos/plugins/openstack_trove.py b/sos/plugins/openstack_trove.py +index 4d526b0..5183ad1 100644 +--- a/sos/plugins/openstack_trove.py ++++ b/sos/plugins/openstack_trove.py +@@ -30,9 +30,13 @@ class OpenStackTrove(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/trove/", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/trove/", ++ "/var/log/containers/trove/"], ++ sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/trove/*.log", sizelimit=self.limit) ++ self.add_copy_spec(["/var/log/trove/*.log", ++ "/var/log/containers/trove/*.log"], ++ sizelimit=self.limit) + + self.add_copy_spec('/etc/trove/') + +diff --git a/sos/plugins/pacemaker.py b/sos/plugins/pacemaker.py +index 9775284..5780c81 100644 +--- a/sos/plugins/pacemaker.py ++++ b/sos/plugins/pacemaker.py +@@ -36,7 +36,8 @@ class Pacemaker(Plugin, DebianPlugin, UbuntuPlugin): + "/var/lib/pacemaker/cib/cib.xml", + self.defaults, + "/var/log/pacemaker.log", +- "/var/log/pcsd/pcsd.log" ++ "/var/log/pcsd/pcsd.log", ++ "/var/log/pacemaker/bundles/*/", + ]) + self.add_cmd_output([ + "crm_mon -1 -A -n -r -t", +diff --git a/sos/plugins/rabbitmq.py b/sos/plugins/rabbitmq.py +index d9871a0..8d73835 100644 +--- a/sos/plugins/rabbitmq.py ++++ b/sos/plugins/rabbitmq.py +@@ -29,6 +29,7 @@ class RabbitMQ(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + self.add_cmd_output("rabbitmqctl list_policies") + + self.add_copy_spec("/etc/rabbitmq/*") +- self.add_copy_spec("/var/log/rabbitmq/*", ++ self.add_copy_spec(["/var/log/rabbitmq/*", ++ "/var/log/containers/rabbitmq/*"], + sizelimit=self.get_option('log_size')) + # vim: set et ts=4 sw=4 : +diff --git a/sos/plugins/redis.py b/sos/plugins/redis.py +index befa3d3..9ac2397 100644 +--- a/sos/plugins/redis.py ++++ b/sos/plugins/redis.py +@@ -32,10 +32,12 @@ class Redis(Plugin, RedHatPlugin): + self.limit = self.get_option("log_size") + self.add_cmd_output("redis-cli info") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/redis/redis.log*", ++ self.add_copy_spec(["/var/log/redis/redis.log*", ++ "/var/log/containers/redis/redis.log*"], + sizelimit=self.limit) + else: +- self.add_copy_spec("/var/log/redis/redis.log", ++ self.add_copy_spec(["/var/log/redis/redis.log", ++ "/var/log/containers/redis/redis.log"], + sizelimit=self.limit) + + def postproc(self): +-- +2.7.5 + +From 5bbe32f49f3406368ac794e638b61a3234da1d11 Mon Sep 17 00:00:00 2001 +From: stuggi +Date: Wed, 28 Jun 2017 21:35:45 +0200 +Subject: [PATCH] [openstack plugins] run openstack command when correct ENV is + set (#1048) + +With Tripleo Pike the default ENV changed from OS_TENANT_NAME to +OS_PROJECT_NAME. The commands of the openstack plugins against +the env should run when either OSP_TENANT_NAME or OS_PROJECT_NAME +is set. + +Signed-off-by: Martin Schuppert mschuppe@redhat.com +Signed-off-by: Adam Stokes +--- + sos/plugins/gnocchi.py | 10 +++++++--- + sos/plugins/openstack_glance.py | 10 +++++++--- + sos/plugins/openstack_heat.py | 10 +++++++--- + sos/plugins/openstack_instack.py | 10 +++++++--- + sos/plugins/openstack_ironic.py | 10 +++++++--- + sos/plugins/openstack_keystone.py | 10 +++++++--- + sos/plugins/openstack_neutron.py | 10 +++++++--- + sos/plugins/openstack_nova.py | 10 +++++++--- + 8 files changed, 56 insertions(+), 24 deletions(-) + +diff --git a/sos/plugins/gnocchi.py b/sos/plugins/gnocchi.py +index 14baf55..dc79a0f 100644 +--- a/sos/plugins/gnocchi.py ++++ b/sos/plugins/gnocchi.py +@@ -44,9 +44,13 @@ class GnocchiPlugin(Plugin, RedHatPlugin): + self.add_copy_spec("/var/log/gnocchi/*.log", + sizelimit=self.limit) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index 88d06e3..6202c49 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -51,9 +51,13 @@ class OpenStackGlance(Plugin): + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index 2dad83f..0f457d9 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -34,9 +34,13 @@ class OpenStackHeat(Plugin): + suggest_filename="heat_db_version" + ) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_instack.py b/sos/plugins/openstack_instack.py +index 87ec59f..f990476 100644 +--- a/sos/plugins/openstack_instack.py ++++ b/sos/plugins/openstack_instack.py +@@ -48,9 +48,13 @@ class OpenStackInstack(Plugin): + "/var/log/containers/zaqar/*.log"], + sizelimit=self.limit) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_ironic.py b/sos/plugins/openstack_ironic.py +index e4e320d..0396cc6 100644 +--- a/sos/plugins/openstack_ironic.py ++++ b/sos/plugins/openstack_ironic.py +@@ -44,9 +44,13 @@ class OpenStackIronic(Plugin): + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py +index 5a8f4e2..82e987a 100644 +--- a/sos/plugins/openstack_keystone.py ++++ b/sos/plugins/openstack_keystone.py +@@ -48,9 +48,13 @@ class OpenStackKeystone(Plugin): + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py +index b0f6699..d2bfe6b 100644 +--- a/sos/plugins/openstack_neutron.py ++++ b/sos/plugins/openstack_neutron.py +@@ -42,9 +42,13 @@ class OpenStackNeutron(Plugin): + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index 3dda7af..c0e8109 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -35,9 +35,13 @@ class OpenStackNova(Plugin): + self.add_cmd_output("nova-manage fixed list") + self.add_cmd_output("nova-manage floating list") + +- vars = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']] +- if not all(vars): ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. Source " + "the environment file for the user intended " + "to connect to the OpenStack environment.") +-- +2.7.5 + +From f379776da6d2d3f4e3f31bf34b12908674dc122d Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Wed, 28 Jun 2017 16:21:05 +0200 +Subject: [PATCH] [gnocchi] Tripleo specific containerized services logs + +This is an addition to pull request 1046 to collect gnocchi logs +correct when service is running in a container. + +Signed-off-by: Martin Schuppert mschuppert@redhat.com +--- + sos/plugins/gnocchi.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/sos/plugins/gnocchi.py b/sos/plugins/gnocchi.py +index dc79a0f..724e41b 100644 +--- a/sos/plugins/gnocchi.py ++++ b/sos/plugins/gnocchi.py +@@ -38,11 +38,17 @@ class GnocchiPlugin(Plugin, RedHatPlugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec("/var/log/gnocchi/", +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/gnocchi/*", ++ "/var/log/containers/gnocchi/*"], ++ sizelimit=self.limit ++ ) + else: +- self.add_copy_spec("/var/log/gnocchi/*.log", +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/gnocchi/*.log", ++ "/var/log/containers/gnocchi/*.log"], ++ sizelimit=self.limit ++ ) + + vars_all = [p in os.environ for p in [ + 'OS_USERNAME', 'OS_PASSWORD']] +-- +2.7.5 + +From 55800f71bdcfdea22b1d6e1c68848e58eb087d1c Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Sun, 9 Jul 2017 15:22:30 +0200 +Subject: [PATCH] [openstack plugins] Tripleo specific containerized services + configs + +Add Tripleo Pike opinionated config paths to be collected +for services, when running in containers. Each service has a +config dir in /var/lib/config-data/puppet-generated on the host +which gets bind mounted read only into the container. + +Closes #1054 + +Signed-off-by: Martin Schuppert +Signed-off-by: Bryn M. Reeves +--- + sos/plugins/gnocchi.py | 18 +++++++++++++- + sos/plugins/haproxy.py | 6 ++++- + sos/plugins/iscsi.py | 2 ++ + sos/plugins/mongodb.py | 15 +++++++++++- + sos/plugins/mysql.py | 5 ++-- + sos/plugins/openstack_ceilometer.py | 24 ++++++++++++------ + sos/plugins/openstack_glance.py | 25 +++++++++++++------ + sos/plugins/openstack_heat.py | 49 ++++++++++++++++++++++++++++++------- + sos/plugins/openstack_horizon.py | 48 ++++++++++++++++++++++++++---------- + sos/plugins/openstack_keystone.py | 28 +++++++++++++++------ + sos/plugins/openstack_manila.py | 25 +++++++++++++------ + sos/plugins/openstack_neutron.py | 27 ++++++++++++++------ + sos/plugins/openstack_nova.py | 37 ++++++++++++++++++++++------ + sos/plugins/openstack_sahara.py | 24 ++++++++++++------ + sos/plugins/openstack_swift.py | 30 +++++++++++++++++------ + sos/plugins/openstack_trove.py | 25 +++++++++++++------ + sos/plugins/rabbitmq.py | 22 +++++++++++++---- + sos/plugins/redis.py | 40 ++++++++++++++++++++++++------ + 18 files changed, 345 insertions(+), 105 deletions(-) + +diff --git a/sos/plugins/gnocchi.py b/sos/plugins/gnocchi.py +index 724e41b..c7a9709 100644 +--- a/sos/plugins/gnocchi.py ++++ b/sos/plugins/gnocchi.py +@@ -33,8 +33,17 @@ class GnocchiPlugin(Plugin, RedHatPlugin): + + requires_root = False + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/gnocchi" ++ + def setup(self): +- self.add_copy_spec("/etc/gnocchi/") ++ self.add_copy_spec([ ++ "/etc/gnocchi/*", ++ self.var_puppet_gen + "/etc/gnocchi/*", ++ self.var_puppet_gen + "/etc/httpd/conf/*", ++ self.var_puppet_gen + "/etc/httpd/conf.d/*", ++ self.var_puppet_gen + "/etc/httpd/conf.modules.d/wsgi.conf", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf" ++ ]) + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +@@ -76,5 +85,12 @@ class GnocchiPlugin(Plugin, RedHatPlugin): + r"password=(.*)", + r"password=*****", + ) ++ self.do_file_sub( ++ self.var_puppet_gen + "/etc/gnocchi/" ++ "gnocchi.conf", ++ r"password=(.*)", ++ r"password=*****", ++ ) ++ + + # vim: set et ts=4 sw=4 : +diff --git a/sos/plugins/haproxy.py b/sos/plugins/haproxy.py +index 6ec98d2..9084506 100644 +--- a/sos/plugins/haproxy.py ++++ b/sos/plugins/haproxy.py +@@ -27,7 +27,11 @@ class HAProxy(Plugin, RedHatPlugin, DebianPlugin): + packages = ('haproxy',) + + def setup(self): +- self.add_copy_spec("/etc/haproxy/haproxy.cfg") ++ 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.add_copy_spec("/etc/haproxy/conf.d/*") + self.add_cmd_output("haproxy -f /etc/haproxy/haproxy.cfg -c") + +diff --git a/sos/plugins/iscsi.py b/sos/plugins/iscsi.py +index 7324b26..66aa632 100644 +--- a/sos/plugins/iscsi.py ++++ b/sos/plugins/iscsi.py +@@ -30,9 +30,11 @@ class RedHatIscsi(Iscsi, RedHatPlugin): + + def setup(self): + super(RedHatIscsi, self).setup() ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/iscsid" + self.add_copy_spec([ + "/etc/iscsi/iscsid.conf", + "/etc/iscsi/initiatorname.iscsi", ++ var_puppet_gen + "/etc/iscsi/initiatorname.iscsi", + "/var/lib/iscsi" + ]) + self.add_cmd_output([ +diff --git a/sos/plugins/mongodb.py b/sos/plugins/mongodb.py +index 46b0251..8c89517 100644 +--- a/sos/plugins/mongodb.py ++++ b/sos/plugins/mongodb.py +@@ -25,11 +25,18 @@ class MongoDb(Plugin, DebianPlugin, UbuntuPlugin): + profiles = ('services',) + + packages = ('mongodb-server',) +- files = ('/etc/mongodb.conf',) ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/mongodb" ++ ++ files = ( ++ '/etc/mongodb.conf', ++ var_puppet_gen + '/etc/mongod.conf' ++ ) + + def setup(self): + self.add_copy_spec([ + "/etc/mongodb.conf", ++ self.var_puppet_gen + "/etc/", ++ self.var_puppet_gen + "/etc/systemd/system/mongod.service.d/", + "/var/log/mongodb/mongodb.log", + "/var/log/containers/mongodb/mongodb.log" + ]) +@@ -41,6 +48,12 @@ class MongoDb(Plugin, DebianPlugin, UbuntuPlugin): + r"mms-token = ********" + ) + ++ self.do_file_sub( ++ self.var_puppet_gen + "/etc/mongodb.conf", ++ r"(mms-token\s*=\s*.*)", ++ r"mms-token = ********" ++ ) ++ + + class RedHatMongoDb(MongoDb, RedHatPlugin): + +diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py +index 7bf933a..decca69 100644 +--- a/sos/plugins/mysql.py ++++ b/sos/plugins/mysql.py +@@ -93,9 +93,10 @@ class RedHatMysql(Mysql, RedHatPlugin): + super(RedHatMysql, self).setup() + self.add_copy_spec([ + "/etc/ld.so.conf.d/mysql-*.conf", +- "/etc/ld.so.conf.d/mariadb-*.conf" ++ "/etc/ld.so.conf.d/mariadb-*.conf", ++ "/etc/my.cnf.d/*", ++ "/var/lib/config-data/puppet-generated/mysql/etc/my.cnf.d/*" + ]) +- self.add_copy_spec("/etc/my.cnf.d/*") + + + class DebianMysql(Mysql, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_ceilometer.py b/sos/plugins/openstack_ceilometer.py +index 2c3a809..b3c6bd8 100644 +--- a/sos/plugins/openstack_ceilometer.py ++++ b/sos/plugins/openstack_ceilometer.py +@@ -27,19 +27,25 @@ class OpenStackCeilometer(Plugin): + profiles = ('openstack', 'openstack_controller', 'openstack_compute') + + option_list = [] ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/ceilometer" + + def setup(self): + # Ceilometer + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/ceilometer/", +- "/var/log/containers/ceilometer/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/ceilometer/*", ++ "/var/log/containers/ceilometer/*" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/ceilometer/*.log", +- "/var/log/containers/ceilometer/*.log"], +- sizelimit=self.limit) +- self.add_copy_spec("/etc/ceilometer/") ++ self.add_copy_spec([ ++ "/var/log/ceilometer/*.log", ++ "/var/log/containers/ceilometer/*.log" ++ ], sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/etc/ceilometer/*", ++ self.var_puppet_gen + "/etc/ceilometer/*" ++ ]) + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + +@@ -54,6 +60,10 @@ class OpenStackCeilometer(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/ceilometer/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/ceilometer/*", ++ regexp, r"\1*********" ++ ) + + + class DebianCeilometer(OpenStackCeilometer, DebianPlugin, +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index 6202c49..0a2bdc1 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -28,6 +28,7 @@ class OpenStackGlance(Plugin): + profiles = ('openstack', 'openstack_controller') + + option_list = [] ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/glance_api" + + def setup(self): + # Glance +@@ -38,15 +39,21 @@ class OpenStackGlance(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/glance/", +- "/var/log/containers/glance/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/glance/", ++ "/var/log/containers/glance/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/glance/*.log", +- "/var/log/containers/glance/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/glance/*.log", ++ "/var/log/containers/glance/*.log" ++ ], sizelimit=self.limit) + +- self.add_copy_spec("/etc/glance/") ++ self.add_copy_spec([ ++ "/etc/glance/", ++ self.var_puppet_gen + "/etc/glance/", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf" ++ ]) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -73,6 +80,10 @@ class OpenStackGlance(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/glance/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/glance/*", ++ regexp, r"\1*********" ++ ) + + + class DebianGlance(OpenStackGlance, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index 0f457d9..a73916b 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -26,6 +26,7 @@ class OpenStackHeat(Plugin): + profiles = ('openstack', 'openstack_controller') + + option_list = [] ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/heat" + + def setup(self): + # Heat +@@ -49,15 +50,31 @@ class OpenStackHeat(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/heat/", +- "/var/log/containers/heat/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/heat/", ++ "/var/log/containers/heat/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/heat/*.log", +- "/var/log/containers/heat/*.log"], +- sizelimit=self.limit) +- +- self.add_copy_spec("/etc/heat/") ++ self.add_copy_spec([ ++ "/var/log/heat/*.log", ++ "/var/log/containers/heat/*.log" ++ ], sizelimit=self.limit) ++ ++ self.add_copy_spec([ ++ "/etc/heat/", ++ self.var_puppet_gen + "/etc/heat/", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "_api/etc/heat/", ++ self.var_puppet_gen + "_api/etc/httpd/conf/", ++ self.var_puppet_gen + "_api/etc/httpd/conf.d/", ++ self.var_puppet_gen + "_api/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "_api/var/spool/cron/heat", ++ self.var_puppet_gen + "_api_cfn/etc/heat/", ++ self.var_puppet_gen + "_api_cfn/etc/httpd/conf/", ++ self.var_puppet_gen + "_api_cfn/etc/httpd/conf.d/", ++ self.var_puppet_gen + "_api_cfn/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "_api_cfn/var/spool/cron/heat", ++ ]) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -69,7 +86,21 @@ class OpenStackHeat(Plugin): + ] + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) +- self.do_path_regex_sub("/etc/heat/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ "/etc/heat/*", ++ regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/heat/*", ++ regexp, r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "_api/etc/heat/*", ++ regexp, r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "_api_cfn/etc/heat/*", ++ regexp, r"\1*********" ++ ) + + + class DebianHeat(OpenStackHeat, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_horizon.py b/sos/plugins/openstack_horizon.py +index 75ad3ce..a9a7fab 100644 +--- a/sos/plugins/openstack_horizon.py ++++ b/sos/plugins/openstack_horizon.py +@@ -27,36 +27,58 @@ class OpenStackHorizon(Plugin): + plugin_name = "openstack_horizon" + profiles = ('openstack', 'openstack_controller') + option_list = [] ++ var_puppet_gen = "/var/lib/config-data/puppet-generated" + + def setup(self): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/horizon/", +- "/var/log/containers/horizon/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/horizon/", ++ "/var/log/containers/horizon/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/horizon/*.log", +- "/var/log/containers/horizon/*.log"], +- sizelimit=self.limit) +- +- self.add_copy_spec("/etc/openstack-dashboard/") ++ self.add_copy_spec([ ++ "/var/log/horizon/*.log", ++ "/var/log/containers/horizon/*.log" ++ ], sizelimit=self.limit) ++ ++ self.add_copy_spec([ ++ "/etc/openstack-dashboard/", ++ self.var_puppet_gen + "/horizon/etc/openstack-dashboard/", ++ self.var_puppet_gen + "/horizon/etc/httpd/conf/", ++ self.var_puppet_gen + "/horizon/etc/httpd/conf.d/", ++ self.var_puppet_gen + "/horizon/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "/memcached/etc/sysconfig/memcached" ++ ]) + self.add_forbidden_path("*.py[co]") + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + + def postproc(self): ++ var_puppet_gen = self.var_puppet_gen + "/horizon" + protect_keys = [ + "SECRET_KEY", "EMAIL_HOST_PASSWORD" + ] + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) +- self.do_path_regex_sub("/etc/openstack-dashboard/.*\.json", +- regexp, r"\1*********") +- self.do_path_regex_sub("/etc/openstack-dashboard/local_settings/ + \ +- .*\.conf.*", +- regexp, r"\1*********") ++ self.do_path_regex_sub( ++ "/etc/openstack-dashboard/.*\.json", ++ regexp, r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ var_puppet_gen + "/etc/openstack-dashboard/.*\.json", ++ regexp, r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ "/etc/openstack-dashboard/local_settings/.*\.conf.*", ++ regexp, r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ var_puppet_gen + "/etc/openstack-dashboard/.*\.conf.*", ++ regexp, r"\1*********" ++ ) + + + class DebianHorizon(OpenStackHorizon, DebianPlugin): +diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py +index 82e987a..bdcb61d 100644 +--- a/sos/plugins/openstack_keystone.py ++++ b/sos/plugins/openstack_keystone.py +@@ -26,24 +26,34 @@ class OpenStackKeystone(Plugin): + profiles = ('openstack', 'openstack_controller') + + option_list = [("nopw", "dont gathers keystone passwords", "slow", True)] ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/keystone" + + def setup(self): + self.add_copy_spec([ + "/etc/keystone/default_catalog.templates", + "/etc/keystone/keystone.conf", + "/etc/keystone/logging.conf", +- "/etc/keystone/policy.json" ++ "/etc/keystone/policy.json", ++ self.var_puppet_gen + "/etc/keystone/*.conf", ++ self.var_puppet_gen + "/etc/keystone/*.json", ++ self.var_puppet_gen + "/etc/httpd/conf/", ++ self.var_puppet_gen + "/etc/httpd/conf.d/", ++ self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "/var/spool/cron/", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf" + ]) + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/keystone/", +- "/var/log/containers/keystone/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/keystone/", ++ "/var/log/containers/keystone/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/keystone/*.log", +- "/var/log/containers/keystone/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/keystone/*.log", ++ "/var/log/containers/keystone/*.log" ++ ], sizelimit=self.limit) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -71,6 +81,10 @@ class OpenStackKeystone(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/keystone/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/keystone/*", ++ regexp, r"\1*********" ++ ) + + + class DebianKeystone(OpenStackKeystone, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_manila.py b/sos/plugins/openstack_manila.py +index c1e6609..92bca6f 100644 +--- a/sos/plugins/openstack_manila.py ++++ b/sos/plugins/openstack_manila.py +@@ -24,18 +24,25 @@ class OpenStackManila(Plugin): + profiles = ('openstack', 'openstack_controller') + option_list = [] + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/manila" ++ + def setup(self): +- self.add_copy_spec("/etc/manila/") ++ self.add_copy_spec([ ++ "/etc/manila/", ++ self.var_puppet_gen + "/etc/manila/" ++ ]) + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/manila/*", +- "/var/log/containers/manila/*"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/manila/*", ++ "/var/log/containers/manila/*" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/manila/*.log", +- "/var/log/containers/manila/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/manila/*.log", ++ "/var/log/containers/manila/*.log" ++ ], sizelimit=self.limit) + + def postproc(self): + protect_keys = [ +@@ -47,6 +54,10 @@ class OpenStackManila(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/manila/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/manila/*", ++ regexp, r"\1*********" ++ ) + + + class DebianManila(OpenStackManila, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py +index d2bfe6b..b6116c7 100644 +--- a/sos/plugins/openstack_neutron.py ++++ b/sos/plugins/openstack_neutron.py +@@ -25,19 +25,26 @@ class OpenStackNeutron(Plugin): + plugin_name = "openstack_neutron" + profiles = ('openstack', 'openstack_controller', 'openstack_compute') + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/neutron" ++ + def setup(self): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/neutron/", +- "/var/log/containers/neutron/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/neutron/", ++ "/var/log/containers/neutron/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/neutron/*.log", +- "/var/log/containers/neutron/*.log"], +- sizelimit=self.limit) +- +- self.add_copy_spec("/etc/neutron/") ++ self.add_copy_spec([ ++ "/var/log/neutron/*.log", ++ "/var/log/containers/neutron/*.log" ++ ], sizelimit=self.limit) ++ ++ self.add_copy_spec([ ++ "/etc/neutron/", ++ self.var_puppet_gen + "/etc/neutron/" ++ ]) + self.add_copy_spec("/var/lib/neutron/") + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -75,6 +82,10 @@ class OpenStackNeutron(Plugin): + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + + self.do_path_regex_sub("/etc/neutron/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/neutron/*", ++ regexp, r"\1*********" ++ ) + + + class DebianNeutron(OpenStackNeutron, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index c0e8109..75dd372 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -29,6 +29,8 @@ class OpenStackNova(Plugin): + plugin_name = "openstack_nova" + profiles = ('openstack', 'openstack_controller', 'openstack_compute') + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/nova" ++ + def setup(self): + # commands we do not need to source the environment file + self.add_cmd_output("nova-manage db version") +@@ -67,15 +69,28 @@ class OpenStackNova(Plugin): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/nova/", +- "/var/log/containers/nova/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/nova/", ++ "/var/log/containers/nova/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/nova/*.log", +- "/var/log/containers/nova/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/nova/*.log", ++ "/var/log/containers/nova/*.log" ++ ], sizelimit=self.limit) + +- self.add_copy_spec("/etc/nova/") ++ self.add_copy_spec([ ++ "/etc/nova/", ++ self.var_puppet_gen + "/etc/nova/", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "_placement/var/spool/cron/nova", ++ self.var_puppet_gen + "_placement/etc/nova/", ++ self.var_puppet_gen + "_placement/etc/httpd/conf/", ++ self.var_puppet_gen + "_placement/etc/httpd/conf.d/", ++ self.var_puppet_gen + "_placement/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "_placement/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "/../memcached/etc/sysconfig/memcached" ++ ]) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -92,6 +107,14 @@ class OpenStackNova(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/nova/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/nova/*", ++ regexp, r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "_placement/etc/nova/*", ++ regexp, r"\1*********" ++ ) + + + class DebianNova(OpenStackNova, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_sahara.py b/sos/plugins/openstack_sahara.py +index adaedf9..68cf0b3 100644 +--- a/sos/plugins/openstack_sahara.py ++++ b/sos/plugins/openstack_sahara.py +@@ -23,22 +23,28 @@ class OpenStackSahara(Plugin): + profiles = ('openstack', 'openstack_controller') + + option_list = [] ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/sahara" + + def setup(self): +- self.add_copy_spec("/etc/sahara/") ++ self.add_copy_spec([ ++ "/etc/sahara/", ++ self.var_puppet_gen + "/etc/sahara/" ++ ]) + self.add_journal(units="openstack-sahara-all") + self.add_journal(units="openstack-sahara-api") + self.add_journal(units="openstack-sahara-engine") + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/sahara/", +- "/var/log/containers/sahara/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/sahara/", ++ "/var/log/containers/sahara/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/sahara/*.log", +- "/var/log/containers/sahara/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/sahara/*.log", ++ "/var/log/containers/sahara/*.log" ++ ], sizelimit=self.limit) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -52,6 +58,10 @@ class OpenStackSahara(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/sahara/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/sahara/*", ++ regexp, r"\1*********" ++ ) + + + class DebianSahara(OpenStackSahara, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_swift.py b/sos/plugins/openstack_swift.py +index 9906b94..1cfff2b 100644 +--- a/sos/plugins/openstack_swift.py ++++ b/sos/plugins/openstack_swift.py +@@ -27,19 +27,29 @@ class OpenStackSwift(Plugin): + + option_list = [] + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated" ++ + def setup(self): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/swift/", +- "/var/log/containers/swift/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/swift/", ++ "/var/log/containers/swift/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/swift/*.log", +- "/var/log/containers/swift/*.log"], +- sizelimit=self.limit) +- +- self.add_copy_spec("/etc/swift/") ++ self.add_copy_spec([ ++ "/var/log/swift/*.log", ++ "/var/log/containers/swift/*.log" ++ ], sizelimit=self.limit) ++ ++ self.add_copy_spec([ ++ "/etc/swift/", ++ self.var_puppet_gen + "/swift/etc/*", ++ self.var_puppet_gen + "/swift/etc/swift/*", ++ self.var_puppet_gen + "/swift/etc/xinetd.d/*", ++ self.var_puppet_gen + "/memcached/etc/sysconfig/memcached" ++ ]) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -54,6 +64,10 @@ class OpenStackSwift(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/swift/.*\.conf.*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/swift/etc/swift/.*\.conf.*", ++ regexp, r"\1*********" ++ ) + + + class DebianSwift(OpenStackSwift, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_trove.py b/sos/plugins/openstack_trove.py +index 5183ad1..093e5d5 100644 +--- a/sos/plugins/openstack_trove.py ++++ b/sos/plugins/openstack_trove.py +@@ -26,19 +26,26 @@ class OpenStackTrove(Plugin): + profiles = ('openstack', 'openstack_controller') + option_list = [] + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/trove" ++ + def setup(self): + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/trove/", +- "/var/log/containers/trove/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/trove/", ++ "/var/log/containers/trove/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/trove/*.log", +- "/var/log/containers/trove/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/trove/*.log", ++ "/var/log/containers/trove/*.log" ++ ], sizelimit=self.limit) + +- self.add_copy_spec('/etc/trove/') ++ self.add_copy_spec([ ++ '/etc/trove/', ++ self.var_puppet_gen + '/etc/trove/' ++ ]) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -53,6 +60,10 @@ class OpenStackTrove(Plugin): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/trove/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/trove/*", ++ regexp, r"\1*********" ++ ) + + + class DebianTrove(OpenStackTrove, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/rabbitmq.py b/sos/plugins/rabbitmq.py +index 8d73835..2c7e428 100644 +--- a/sos/plugins/rabbitmq.py ++++ b/sos/plugins/rabbitmq.py +@@ -20,7 +20,11 @@ class RabbitMQ(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + """ + plugin_name = 'rabbitmq' + profiles = ('services',) +- files = ('/etc/rabbitmq/rabbitmq.conf',) ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/rabbitmq" ++ files = ( ++ '/etc/rabbitmq/rabbitmq.conf', ++ var_puppet_gen + '/etc/rabbitmq/rabbitmq.config' ++ ) + packages = ('rabbitmq-server',) + + def setup(self): +@@ -28,8 +32,16 @@ class RabbitMQ(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + self.add_cmd_output("rabbitmqctl cluster_status") + self.add_cmd_output("rabbitmqctl list_policies") + +- self.add_copy_spec("/etc/rabbitmq/*") +- self.add_copy_spec(["/var/log/rabbitmq/*", +- "/var/log/containers/rabbitmq/*"], +- sizelimit=self.get_option('log_size')) ++ self.add_copy_spec([ ++ "/etc/rabbitmq/*", ++ self.var_puppet_gen + "/etc/rabbitmq/*", ++ self.var_puppet_gen + "/etc/security/limits.d/", ++ self.var_puppet_gen + "/etc/systemd/" ++ ]) ++ self.add_copy_spec([ ++ "/var/log/rabbitmq/*", ++ "/var/log/containers/rabbitmq/*" ++ ], sizelimit=self.get_option('log_size')) ++ ++ + # vim: set et ts=4 sw=4 : +diff --git a/sos/plugins/redis.py b/sos/plugins/redis.py +index 9ac2397..088a9a2 100644 +--- a/sos/plugins/redis.py ++++ b/sos/plugins/redis.py +@@ -1,4 +1,5 @@ + # Copyright (C) 2015 Red Hat, Inc., Abhijeet Kasurde ++# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert + + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -25,20 +26,32 @@ class Redis(Plugin, RedHatPlugin): + profiles = ('services',) + + packages = ('redis',) +- files = ('/etc/redis.conf', '/var/log/redis') ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/redis" ++ files = ( ++ '/etc/redis.conf', ++ '/var/log/redis', ++ var_puppet_gen + '/etc/redis.conf' ++ ) + + def setup(self): +- self.add_copy_spec("/etc/redis.conf") ++ self.add_copy_spec([ ++ "/etc/redis.conf", ++ self.var_puppet_gen + "/etc/redis*", ++ self.var_puppet_gen + "/etc/redis/", ++ self.var_puppet_gen + "/etc/security/limits.d/" ++ ]) + self.limit = self.get_option("log_size") + self.add_cmd_output("redis-cli info") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/redis/redis.log*", +- "/var/log/containers/redis/redis.log*"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/redis/redis.log*", ++ "/var/log/containers/redis/redis.log*" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/redis/redis.log", +- "/var/log/containers/redis/redis.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/redis/redis.log", ++ "/var/log/containers/redis/redis.log" ++ ], sizelimit=self.limit) + + def postproc(self): + self.do_file_sub( +@@ -51,5 +64,16 @@ class Redis(Plugin, RedHatPlugin): + r"(requirepass\s).*", + r"\1********" + ) ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/redis.conf*", ++ r"(masterauth\s).*", ++ r"\1*********" ++ ) ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/redis.conf*", ++ r"(requirepass\s).*", ++ r"\1*********" ++ ) ++ + + # vim: set et ts=4 sw=4 : +-- +2.7.5 + diff --git a/SOURCES/sos-bz1482574-jars-redundant-os-walk.patch b/SOURCES/sos-bz1482574-jars-redundant-os-walk.patch new file mode 100644 index 0000000..8b036f7 --- /dev/null +++ b/SOURCES/sos-bz1482574-jars-redundant-os-walk.patch @@ -0,0 +1,106 @@ +From 6fc42802b87f95dba1d6bfda49ae158143e7799c Mon Sep 17 00:00:00 2001 +From: Michal Srb +Date: Mon, 21 Aug 2017 16:29:23 +0200 +Subject: [PATCH 1/2] [jars] Scan only /usr/{share,lib}/java by default + +Other known locations can be added via: +-k jars.all_known_locations + +Additional user-specified locations can be added via: +-k jars.append_locations=... + +Signed-off-by: Michal Srb +--- + sos/plugins/jars.py | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/sos/plugins/jars.py b/sos/plugins/jars.py +index c6cba96..486ac05 100644 +--- a/sos/plugins/jars.py ++++ b/sos/plugins/jars.py +@@ -31,7 +31,8 @@ class Jars(Plugin, RedHatPlugin): + profiles = ("java",) + option_list = [ + ("append_locations", "colon-separated list of additional JAR paths", +- "fast", "") ++ "fast", ""), ++ ("all_known_locations", "scan all known paths", "slow", False) + ] + + # There is no standard location for JAR files and scanning +@@ -39,7 +40,12 @@ class Jars(Plugin, RedHatPlugin): + # scan directories in which JARs can be typically found. + jar_locations = ( + "/usr/share/java", # common location for JARs +- "/usr/lib/java", # common location for JARs containing native code ++ "/usr/lib/java" # common location for JARs containing native code ++ ) ++ ++ # Following paths can be optionally scanned as well. Note the scan can take ++ # *very* long time. ++ extra_jar_locations = ( + "/opt", # location for RHSCL and 3rd party software + "/usr/local", # used by sysadmins when installing SW locally + "/var/lib" # Java services commonly explode WARs there +@@ -50,9 +56,13 @@ class Jars(Plugin, RedHatPlugin): + jar_paths = [] + + locations = list(Jars.jar_locations) +- extra_locations = self.get_option("append_locations") +- if extra_locations: +- locations += extra_locations.split(":") ++ if self.get_option("all_known_locations"): ++ locations += list(Jars.extra_jar_locations) ++ ++ # append also user-defined locations, if any ++ user_locations = self.get_option("append_locations") ++ if user_locations: ++ locations += user_locations.split(":") + + # find all JARs in given locations + for location in locations: +-- +2.7.5 + +From d33c63a230092e94f966551968c51e8c5760742f Mon Sep 17 00:00:00 2001 +From: Michal Srb +Date: Mon, 21 Aug 2017 18:11:04 +0200 +Subject: [PATCH 2/2] [jars] Catch zipfile.BadZipfile exception + +Bad ZIP files can raise zipfile.BadZipfile exception. + +Fixes: +Traceback (most recent call last): + File "/home/msrb/projects/sos/sos/sosreport.py", line 1252, in setup + plug.setup() + File "/home/msrb/projects/sos/sos/plugins/jars.py", line 72, in setup + if Jars.is_jar(path): + File "/home/msrb/projects/sos/sos/plugins/jars.py", line 98, in is_jar + with zipfile.ZipFile(path) as f: + File "/usr/lib64/python2.7/zipfile.py", line 770, in __init__ + self._RealGetContents() + File "/usr/lib64/python2.7/zipfile.py", line 842, in _RealGetContents + raise BadZipfile("Bad magic number for central directory") +BadZipfile: Bad magic number for central directory + +Signed-off-by: Michal Srb +--- + sos/plugins/jars.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sos/plugins/jars.py b/sos/plugins/jars.py +index 486ac05..8c6b54f 100644 +--- a/sos/plugins/jars.py ++++ b/sos/plugins/jars.py +@@ -98,7 +98,7 @@ class Jars(Plugin, RedHatPlugin): + with zipfile.ZipFile(path) as f: + if "META-INF/MANIFEST.MF" in f.namelist(): + return True +- except IOError: ++ except (IOError, zipfile.BadZipfile): + pass + return False + +-- +2.7.5 + diff --git a/SOURCES/sos-bz1491964-gluster-block-plugin.patch b/SOURCES/sos-bz1491964-gluster-block-plugin.patch new file mode 100644 index 0000000..b968fc5 --- /dev/null +++ b/SOURCES/sos-bz1491964-gluster-block-plugin.patch @@ -0,0 +1,90 @@ +From 07e6ce3ee1f18a09fa8eaa77fc10729c970bf5f6 Mon Sep 17 00:00:00 2001 +From: vredara +Date: Thu, 29 Jun 2017 00:36:37 +0530 +Subject: [PATCH] [gluster_block] Added new plugin gluster_block (#1041) + +gluster_block plugin collects config/log files related to blocks + +Signed-off-by: venkata edara +Signed-off-by: Adam Stokes +--- + sos/plugins/gluster_block.py | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + create mode 100644 sos/plugins/gluster_block.py + +diff --git a/sos/plugins/gluster_block.py b/sos/plugins/gluster_block.py +new file mode 100644 +index 0000000..39efbd7 +--- /dev/null ++++ b/sos/plugins/gluster_block.py +@@ -0,0 +1,39 @@ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License along ++# with this program; if not, write to the Free Software Foundation, Inc., ++# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++import glob ++from sos.plugins import Plugin, RedHatPlugin ++ ++ ++class GlusterBlock(Plugin, RedHatPlugin): ++ """Gluster Block""" ++ ++ plugin_name = 'gluster_block' ++ profiles = ('storage',) ++ packages = ("gluster-block",) ++ files = ("/usr/sbin/gluster-block",) ++ ++ def setup(self): ++ ++ # collect logs - apply log_size for any individual file ++ # all_logs takes precedence over logsize ++ if not self.get_option("all_logs"): ++ limit = self.get_option("log_size") ++ else: ++ limit = 0 ++ ++ if limit: ++ for f in glob.glob("/var/log/gluster-block/*.log"): ++ self.add_copy_spec(f, limit) ++ else: ++ self.add_copy_spec("/var/log/gluster-block") +-- +2.7.5 + +From 9c3302597630e601213561b7f6dba8def0fcc448 Mon Sep 17 00:00:00 2001 +From: vredara +Date: Thu, 29 Jun 2017 00:38:01 +0530 +Subject: [PATCH] [targetcli] added one item (#1044) + +collecting the /sys/kernel/config/target + +Signed-off-by: venkata edara +Signed-off-by: Adam Stokes +--- + sos/plugins/targetcli.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sos/plugins/targetcli.py b/sos/plugins/targetcli.py +index 14be1bf..2a93379 100644 +--- a/sos/plugins/targetcli.py ++++ b/sos/plugins/targetcli.py +@@ -31,6 +31,7 @@ class TargetCli(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + "systemctl status target.service" + ]) + self.add_journal(units="targetcli") ++ self.add_copy_spec("/sys/kernel/config/target") + self.add_copy_spec("/etc/target") + + # vim: set et ts=4 sw=4 : +-- +2.7.5 + diff --git a/SOURCES/sos-bz1511087-openstack-containerized-further-updates.patch b/SOURCES/sos-bz1511087-openstack-containerized-further-updates.patch new file mode 100644 index 0000000..e500171 --- /dev/null +++ b/SOURCES/sos-bz1511087-openstack-containerized-further-updates.patch @@ -0,0 +1,936 @@ +From 4d1e5ffd2e6e4e9b4d4509af212c11a9ead58740 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Thu, 12 Oct 2017 14:22:55 +0200 +Subject: [PATCH] [openstack_[glance|heat]] run commands only if service is + running + +Collect "glance-manage db_version" and similar commands from the +two plugins only if the relevant services are running. Otherwise +the commands get stuck and timeout. + +Resolves: #1124 + +Signed-off-by: Pavel Moravec +--- + sos/plugins/openstack_glance.py | 29 +++++++++++++++++------------ + sos/plugins/openstack_heat.py | 40 +++++++++++++++++++++++----------------- + 2 files changed, 40 insertions(+), 29 deletions(-) + +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index 0a2bdc1bb..642b4593a 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -31,12 +31,6 @@ class OpenStackGlance(Plugin): + var_puppet_gen = "/var/lib/config-data/puppet-generated/glance_api" + + def setup(self): +- # Glance +- self.add_cmd_output( +- "glance-manage db_version", +- suggest_filename="glance_db_version" +- ) +- + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): + self.add_copy_spec([ +@@ -64,12 +58,23 @@ def setup(self): + vars_any = [p in os.environ for p in [ + 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] + +- if not (all(vars_all) and any(vars_any)): +- self.soslog.warning("Not all environment variables set. Source " +- "the environment file for the user intended " +- "to connect to the OpenStack environment.") +- else: +- self.add_cmd_output("openstack image list --long") ++ # collect commands output only if the openstack-glance-api service ++ # is running ++ service_status = self.get_command_output( ++ "systemctl status openstack-glance-api.service" ++ ) ++ if service_status['status'] == 0: ++ self.add_cmd_output( ++ "glance-manage db_version", ++ suggest_filename="glance_db_version" ++ ) ++ if not (all(vars_all) and any(vars_any)): ++ self.soslog.warning("Not all environment variables set. " ++ "Source the environment file for the user " ++ "intended to connect to the OpenStack " ++ "environment.") ++ else: ++ self.add_cmd_output("openstack image list --long") + + def postproc(self): + protect_keys = [ +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index a73916b25..66a7f4109 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -29,24 +29,30 @@ class OpenStackHeat(Plugin): + var_puppet_gen = "/var/lib/config-data/puppet-generated/heat" + + def setup(self): +- # Heat +- self.add_cmd_output( +- "heat-manage db_version", +- suggest_filename="heat_db_version" +- ) +- +- vars_all = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD']] + +- vars_any = [p in os.environ for p in [ +- 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] +- +- if not (all(vars_all) and any(vars_any)): +- self.soslog.warning("Not all environment variables set. Source " +- "the environment file for the user intended " +- "to connect to the OpenStack environment.") +- else: +- self.add_cmd_output("openstack stack list") ++ # collect commands output only if the openstack-heat-api service ++ # is running ++ service_status = self.get_command_output("systemctl status " ++ "openstack-heat-api.service") ++ if service_status['status'] == 0: ++ self.add_cmd_output( ++ "heat-manage db_version", ++ suggest_filename="heat_db_version" ++ ) ++ ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): ++ self.soslog.warning("Not all environment variables set. " ++ "Source the environment file for the user " ++ "intended to connect to the OpenStack " ++ "environment.") ++ else: ++ self.add_cmd_output("openstack stack list") + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +From d5ac6cd768acbd6a8d2d1de2ec26f127272089f2 Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Wed, 18 Oct 2017 15:50:23 +0200 +Subject: [PATCH] [openstack_*, logrotate] Tripleo additional directories + +Tripleo Pike opinionated config+log paths to be collected +for services, when running in containers. + +This is an addition to #1054 where a couple of things got missed + +Fixes: #1130 + +Signed-off-by: Martin Schuppert +Signed-off-by: Bryn M. Reeves +--- + sos/plugins/gnocchi.py | 6 ++++-- + sos/plugins/logrotate.py | 6 +++++- + sos/plugins/openstack_cinder.py | 34 ++++++++++++++++++++++++------- + sos/plugins/openstack_glance.py | 6 ++++-- + sos/plugins/openstack_heat.py | 8 ++++++-- + sos/plugins/openstack_horizon.py | 6 ++++-- + sos/plugins/openstack_ironic.py | 43 +++++++++++++++++++++++++++++++-------- + sos/plugins/openstack_keystone.py | 6 ++++-- + sos/plugins/openstack_manila.py | 12 ++++++++--- + sos/plugins/openstack_neutron.py | 10 ++++++--- + sos/plugins/openstack_nova.py | 19 ++++++++++++++--- + sos/plugins/openstack_swift.py | 6 ++++-- + 13 files changed, 160 insertions(+), 43 deletions(-) + +diff --git a/sos/plugins/gnocchi.py b/sos/plugins/gnocchi.py +index c7a97097c..d2eda47ea 100644 +--- a/sos/plugins/gnocchi.py ++++ b/sos/plugins/gnocchi.py +@@ -49,13 +49,15 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/gnocchi/*", +- "/var/log/containers/gnocchi/*"], ++ "/var/log/containers/gnocchi/*", ++ "/var/log/containers/httpd/gnocchi-api/*"], + sizelimit=self.limit + ) + else: + self.add_copy_spec([ + "/var/log/gnocchi/*.log", +- "/var/log/containers/gnocchi/*.log"], ++ "/var/log/containers/gnocchi/*.log", ++ "/var/log/containers/httpd/gnocchi-api/*log"], + sizelimit=self.limit + ) + +diff --git a/sos/plugins/logrotate.py b/sos/plugins/logrotate.py +index c811192f0..c12cf1bb4 100644 +--- a/sos/plugins/logrotate.py ++++ b/sos/plugins/logrotate.py +@@ -22,12 +22,16 @@ class LogRotate(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + plugin_name = 'logrotate' + profiles = ('system',) + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/crond" ++ + def setup(self): + self.add_cmd_output("logrotate --debug /etc/logrotate.conf", + suggest_filename="logrotate_debug") + self.add_copy_spec([ + "/etc/logrotate*", +- "/var/lib/logrotate.status" ++ "/var/lib/logrotate.status", ++ self.var_puppet_gen + "/etc/logrotate-crond.conf", ++ self.var_puppet_gen + "/var/spool/cron/root" + ]) + + # vim: set et ts=4 sw=4 : +diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py +index ffec62b53..abfd267bb 100644 +--- a/sos/plugins/openstack_cinder.py ++++ b/sos/plugins/openstack_cinder.py +@@ -30,23 +30,39 @@ class OpenStackCinder(Plugin): + option_list = [("db", "gathers openstack cinder db version", "slow", + False)] + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/cinder" ++ + def setup(self): + if self.get_option("db"): + self.add_cmd_output( + "cinder-manage db version", + suggest_filename="cinder_db_version") + +- self.add_copy_spec(["/etc/cinder/"]) ++ self.add_copy_spec([ ++ "/etc/cinder/", ++ self.var_puppet_gen + "/etc/cinder/", ++ self.var_puppet_gen + "/etc/httpd/conf/", ++ self.var_puppet_gen + "/etc/httpd/conf.d/", ++ self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "/etc/sysconfig/", ++ ]) + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/cinder/", +- "/var/log/containers/cinder/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/cinder/", ++ "/var/log/httpd/cinder*", ++ "/var/log/containers/cinder/", ++ "/var/log/containers/httpd/cinder-api/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/cinder/*.log", +- "/var/log/containers/cinder/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/cinder/*.log", ++ "/var/log/httpd/cinder*.log", ++ "/var/log/containers/cinder/*.log", ++ "/var/log/containers/httpd/cinder-api/*log" ++ ], sizelimit=self.limit) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +@@ -67,6 +83,10 @@ def postproc(self): + + regexp = r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + self.do_path_regex_sub("/etc/cinder/*", regexp, r"\1*********") ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "/etc/cinder/*", ++ regexp, r"\1*********" ++ ) + + + class DebianCinder(OpenStackCinder, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index 642b4593a..fdd789a81 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -35,12 +35,14 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/glance/", +- "/var/log/containers/glance/" ++ "/var/log/containers/glance/", ++ "/var/log/containers/httpd/glance-api/" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/glance/*.log", +- "/var/log/containers/glance/*.log" ++ "/var/log/containers/glance/*.log", ++ "/var/log/containers/httpd/glance-api/*log" + ], sizelimit=self.limit) + + self.add_copy_spec([ +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index 66a7f4109..de34ed155 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -58,12 +58,16 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/heat/", +- "/var/log/containers/heat/" ++ "/var/log/containers/heat/", ++ "/var/log/containers/httpd/heat-api/", ++ "/var/log/containers/httpd/heat-api-cfn" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/heat/*.log", +- "/var/log/containers/heat/*.log" ++ "/var/log/containers/heat/*.log", ++ "/var/log/containers/httpd/heat-api/*log", ++ "/var/log/containers/httpd/heat-api-cfn/*log" + ], sizelimit=self.limit) + + self.add_copy_spec([ +diff --git a/sos/plugins/openstack_horizon.py b/sos/plugins/openstack_horizon.py +index a9a7fab3b..d4f457115 100644 +--- a/sos/plugins/openstack_horizon.py ++++ b/sos/plugins/openstack_horizon.py +@@ -35,12 +35,14 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/horizon/", +- "/var/log/containers/horizon/" ++ "/var/log/containers/horizon/", ++ "/var/log/containers/httpd/horizon/" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/horizon/*.log", +- "/var/log/containers/horizon/*.log" ++ "/var/log/containers/horizon/*.log", ++ "/var/log/containers/httpd/horizon/*log" + ], sizelimit=self.limit) + + self.add_copy_spec([ +diff --git a/sos/plugins/openstack_ironic.py b/sos/plugins/openstack_ironic.py +index 0396cc639..f4e0a97d3 100644 +--- a/sos/plugins/openstack_ironic.py ++++ b/sos/plugins/openstack_ironic.py +@@ -25,21 +25,48 @@ class OpenStackIronic(Plugin): + plugin_name = "openstack_ironic" + profiles = ('openstack', 'openstack_undercloud') + ++ var_puppet_gen = "/var/lib/config-data/puppet-generated/ironic" ++ + def setup(self): +- self.conf_list = ['/etc/ironic/*'] +- self.add_copy_spec('/etc/ironic/') ++ self.conf_list = [ ++ "/etc/ironic/*", ++ self.var_puppet_gen + "/etc/ironic/*", ++ self.var_puppet_gen + "_api/etc/ironic/*" ++ ] ++ self.add_copy_spec([ ++ "/etc/ironic/", ++ self.var_puppet_gen + "/etc/xinetd.conf", ++ self.var_puppet_gen + "/etc/xinetd.d/", ++ self.var_puppet_gen + "/etc/ironic/", ++ self.var_puppet_gen + "/etc/httpd/conf/", ++ self.var_puppet_gen + "/etc/httpd/conf.d/", ++ self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "_api/etc/ironic/", ++ self.var_puppet_gen + "_api/etc/httpd/conf/", ++ self.var_puppet_gen + "_api/etc/httpd/conf.d/", ++ self.var_puppet_gen + "_api/etc/httpd/conf.modules.d/*.conf", ++ self.var_puppet_gen + "_api/etc/my.cnf.d/tripleo.cnf" ++ ]) + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +- self.add_copy_spec(["/var/log/ironic/", +- "/var/log/containers/ironic/"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/ironic/", ++ "/var/log/containers/ironic/", ++ "/var/log/containers/httpd/ironic-api/" ++ ], sizelimit=self.limit) + else: +- self.add_copy_spec(["/var/log/ironic/*.log", +- "/var/log/containers/ironic/*.log"], +- sizelimit=self.limit) ++ self.add_copy_spec([ ++ "/var/log/ironic/*.log", ++ "/var/log/containers/ironic/*.log", ++ "/var/log/containers/httpd/ironic-api/*log" ++ ], sizelimit=self.limit) + + self.add_cmd_output('ls -laRt /var/lib/ironic/') ++ self.add_cmd_output( ++ 'ls -laRt ' + self.var_puppet_gen + '/var/lib/ironic/' ++ ) + + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) +diff --git a/sos/plugins/openstack_keystone.py b/sos/plugins/openstack_keystone.py +index d0b144323..72c7f8e2a 100644 +--- a/sos/plugins/openstack_keystone.py ++++ b/sos/plugins/openstack_keystone.py +@@ -47,12 +47,14 @@ class OpenStackKeystone(Plugin): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/keystone/", +- "/var/log/containers/keystone/" ++ "/var/log/containers/keystone/", ++ "/var/log/containers/httpd/keystone/" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/keystone/*.log", +- "/var/log/containers/keystone/*.log" ++ "/var/log/containers/keystone/*.log", ++ "/var/log/containers/httpd/keystone/*log" + ], sizelimit=self.limit) + + if self.get_option("verify"): +diff --git a/sos/plugins/openstack_manila.py b/sos/plugins/openstack_manila.py +index 92bca6fa8..e29859367 100644 +--- a/sos/plugins/openstack_manila.py ++++ b/sos/plugins/openstack_manila.py +@@ -29,19 +29,25 @@ class OpenStackManila(Plugin): + def setup(self): + self.add_copy_spec([ + "/etc/manila/", +- self.var_puppet_gen + "/etc/manila/" ++ self.var_puppet_gen + "/etc/manila/", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "/etc/httpd/conf/", ++ self.var_puppet_gen + "/etc/httpd/conf.d/", ++ self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf", + ]) + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/manila/*", +- "/var/log/containers/manila/*" ++ "/var/log/containers/manila/*", ++ "/var/log/containers/httpd/manila-api/*" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/manila/*.log", +- "/var/log/containers/manila/*.log" ++ "/var/log/containers/manila/*.log", ++ "/var/log/containers/httpd/manila-api/*log" + ], sizelimit=self.limit) + + def postproc(self): +diff --git a/sos/plugins/openstack_neutron.py b/sos/plugins/openstack_neutron.py +index b6116c731..522686606 100644 +--- a/sos/plugins/openstack_neutron.py ++++ b/sos/plugins/openstack_neutron.py +@@ -33,17 +33,21 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/neutron/", +- "/var/log/containers/neutron/" ++ "/var/log/containers/neutron/", ++ "/var/log/containers/httpd/neutron-api/" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/neutron/*.log", +- "/var/log/containers/neutron/*.log" ++ "/var/log/containers/neutron/*.log", ++ "/var/log/containers/httpd/neutron-api/*log" + ], sizelimit=self.limit) + + self.add_copy_spec([ + "/etc/neutron/", +- self.var_puppet_gen + "/etc/neutron/" ++ self.var_puppet_gen + "/etc/neutron/", ++ self.var_puppet_gen + "/etc/default/neutron-server", ++ self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf" + ]) + self.add_copy_spec("/var/lib/neutron/") + if self.get_option("verify"): +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index 75dd37255..1fbfa76a8 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -71,12 +71,16 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/nova/", +- "/var/log/containers/nova/" ++ "/var/log/containers/nova/", ++ "/var/log/containers/httpd/nova-api/", ++ "/var/log/containers/httpd/nova-placement/" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/nova/*.log", +- "/var/log/containers/nova/*.log" ++ "/var/log/containers/nova/*.log", ++ "/var/log/containers/httpd/nova-api/*log", ++ "/var/log/containers/httpd/nova-placement/*log" + ], sizelimit=self.limit) + + self.add_copy_spec([ +@@ -89,7 +93,12 @@ def setup(self): + self.var_puppet_gen + "_placement/etc/httpd/conf.d/", + self.var_puppet_gen + "_placement/etc/httpd/conf.modules.d/*.conf", + self.var_puppet_gen + "_placement/etc/my.cnf.d/tripleo.cnf", +- self.var_puppet_gen + "/../memcached/etc/sysconfig/memcached" ++ self.var_puppet_gen + "/../memcached/etc/sysconfig/memcached", ++ self.var_puppet_gen + "_libvirt/etc/libvirt/", ++ self.var_puppet_gen + "_libvirt/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "_libvirt/etc/nova/migration/" ++ "authorized_keys", ++ self.var_puppet_gen + "_libvirt/var/lib/nova/.ssh/config", + ]) + + if self.get_option("verify"): +@@ -115,6 +124,10 @@ def postproc(self): + self.var_puppet_gen + "_placement/etc/nova/*", + regexp, r"\1*********" + ) ++ self.do_path_regex_sub( ++ self.var_puppet_gen + "_libvirt/etc/nova/*", ++ regexp, r"\1*********" ++ ) + + + class DebianNova(OpenStackNova, DebianPlugin, UbuntuPlugin): +diff --git a/sos/plugins/openstack_swift.py b/sos/plugins/openstack_swift.py +index 1cfff2b88..1688112f5 100644 +--- a/sos/plugins/openstack_swift.py ++++ b/sos/plugins/openstack_swift.py +@@ -35,12 +35,14 @@ def setup(self): + if self.get_option("all_logs"): + self.add_copy_spec([ + "/var/log/swift/", +- "/var/log/containers/swift/" ++ "/var/log/containers/swift/", ++ "/var/log/containers/httpd/swift-proxy/" + ], sizelimit=self.limit) + else: + self.add_copy_spec([ + "/var/log/swift/*.log", +- "/var/log/containers/swift/*.log" ++ "/var/log/containers/swift/*.log", ++ "/var/log/containers/httpd/swift-proxy/*log" + ], sizelimit=self.limit) + + self.add_copy_spec([ +From e63c17d902f99d96cbd4cb2a06d9cbbf8a4d4c18 Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Tue, 7 Nov 2017 18:07:47 +0100 +Subject: [PATCH] [openstack_nova] added missing nova container config + +Tripleo Pike opinionated config+log paths to be collected +for services, when running in containers. + +The nova configuration for the nova and placement container +was included, but the nova configuration libvirt container +was missing. Also the httpd configs for the nova contaier +were added. + +This is a change to #1130 + +Signed-off-by: Martin Schuppert mschuppe@redhat.com +--- + sos/plugins/openstack_nova.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index 1fbfa76a8..cdd297608 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -87,7 +87,10 @@ def setup(self): + "/etc/nova/", + self.var_puppet_gen + "/etc/nova/", + self.var_puppet_gen + "/etc/my.cnf.d/tripleo.cnf", +- self.var_puppet_gen + "_placement/var/spool/cron/nova", ++ self.var_puppet_gen + "/var/spool/cron/nova", ++ self.var_puppet_gen + "/etc/httpd/conf/", ++ self.var_puppet_gen + "/etc/httpd/conf.d/", ++ self.var_puppet_gen + "/etc/httpd/conf.modules.d/*.conf", + self.var_puppet_gen + "_placement/etc/nova/", + self.var_puppet_gen + "_placement/etc/httpd/conf/", + self.var_puppet_gen + "_placement/etc/httpd/conf.d/", +@@ -96,6 +99,7 @@ def setup(self): + self.var_puppet_gen + "/../memcached/etc/sysconfig/memcached", + self.var_puppet_gen + "_libvirt/etc/libvirt/", + self.var_puppet_gen + "_libvirt/etc/my.cnf.d/tripleo.cnf", ++ self.var_puppet_gen + "_libvirt/etc/nova/", + self.var_puppet_gen + "_libvirt/etc/nova/migration/" + "authorized_keys", + self.var_puppet_gen + "_libvirt/var/lib/nova/.ssh/config", +From 410733862a1f5ea1f9666d1fa41a7b5d3390e3c6 Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Wed, 8 Nov 2017 17:57:54 +0100 +Subject: [PATCH] [openstack_[glance|heat|cinder|nova]] limit command run + +Collect "glance-manage db_version" and similar commands from the +four plugins only if the relevant services or containers are +running. Otherwise the commands get stuck and timeout. + +This is an enhancement to #1124 to check for containers + do the +same for nova + cinder. + +Signed-off-by: Martin Schuppert mschuppe@redhat.com + +Edited to remove use of shell syntax. + +Fixes: #1139 + +Signed-off-by: Bryn M. Reeves +--- + sos/plugins/openstack_cinder.py | 30 ++++++++++--- + sos/plugins/openstack_glance.py | 33 +++++++++++---- + sos/plugins/openstack_heat.py | 23 ++++++++-- + sos/plugins/openstack_nova.py | 94 +++++++++++++++++++++++++++-------------- + 4 files changed, 129 insertions(+), 51 deletions(-) + +diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py +index abfd267bb..a023105c8 100644 +--- a/sos/plugins/openstack_cinder.py ++++ b/sos/plugins/openstack_cinder.py +@@ -27,16 +27,34 @@ class OpenStackCinder(Plugin): + plugin_name = "openstack_cinder" + profiles = ('openstack', 'openstack_controller') + +- option_list = [("db", "gathers openstack cinder db version", "slow", +- False)] +- + var_puppet_gen = "/var/lib/config-data/puppet-generated/cinder" + + def setup(self): +- if self.get_option("db"): ++ ++ # collect commands output only if the openstack-cinder-api service ++ # is running ++ service_status = self.get_command_output( ++ "systemctl status openstack-cinder-api.service" ++ ) ++ ++ container_status = self.get_command_output("docker ps") ++ in_container = False ++ if container_status['status'] == 0: ++ for line in container_status['output'].splitlines(): ++ if line.endswith("cinder_api"): ++ in_container = True ++ ++ if (service_status['status'] == 0) or in_container: ++ cinder_config = "" ++ # if containerized we need to pass the config to the cont. ++ if in_container: ++ cinder_config = "--config-dir " + self.var_puppet_gen + \ ++ "/etc/cinder/" ++ + self.add_cmd_output( +- "cinder-manage db version", +- suggest_filename="cinder_db_version") ++ "cinder-manage " + cinder_config + " db version", ++ suggest_filename="cinder_db_version" ++ ) + + self.add_copy_spec([ + "/etc/cinder/", +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index fdd789a81..4cdc6dc62 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -54,22 +54,37 @@ def setup(self): + if self.get_option("verify"): + self.add_cmd_output("rpm -V %s" % ' '.join(self.packages)) + +- vars_all = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD']] +- +- vars_any = [p in os.environ for p in [ +- 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] +- + # collect commands output only if the openstack-glance-api service + # is running + service_status = self.get_command_output( +- "systemctl status openstack-glance-api.service" ++ "systemctl status openstack-glance-api.service" + ) +- if service_status['status'] == 0: ++ ++ container_status = self.get_command_output("docker ps") ++ in_container = False ++ if container_status['status'] == 0: ++ for line in container_status['output'].splitlines(): ++ if line.endswith("cinder_api"): ++ in_container = True ++ ++ if (service_status['status'] == 0) or in_container: ++ glance_config = "" ++ # if containerized we need to pass the config to the cont. ++ if in_container: ++ glance_config = "--config-dir " + self.var_puppet_gen + \ ++ "/etc/glance/" ++ + self.add_cmd_output( +- "glance-manage db_version", ++ "glance-manage " + glance_config + " db_version", + suggest_filename="glance_db_version" + ) ++ ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ + if not (all(vars_all) and any(vars_any)): + self.soslog.warning("Not all environment variables set. " + "Source the environment file for the user " +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index de34ed155..e3395fabd 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -32,11 +32,26 @@ def setup(self): + + # collect commands output only if the openstack-heat-api service + # is running +- service_status = self.get_command_output("systemctl status " +- "openstack-heat-api.service") +- if service_status['status'] == 0: ++ service_status = self.get_command_output( ++ "systemctl status openstack-heat-api.service" ++ ) ++ ++ container_status = self.get_command_output("docker ps") ++ in_container = False ++ if container_status['status'] == 0: ++ for line in container_status['output'].splitlines(): ++ if line.endswith("cinder_api"): ++ in_container = True ++ ++ if (service_status['status'] == 0) or in_container: ++ heat_config = "" ++ # if containerized we need to pass the config to the cont. ++ if in_container: ++ heat_config = "--config-dir " + self.var_puppet_gen + \ ++ "_api/etc/heat/" ++ + self.add_cmd_output( +- "heat-manage db_version", ++ "heat-manage " + heat_config + " db_version", + suggest_filename="heat_db_version" + ) + +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index cdd297608..e8839a2a6 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -32,40 +32,70 @@ class OpenStackNova(Plugin): + var_puppet_gen = "/var/lib/config-data/puppet-generated/nova" + + def setup(self): +- # commands we do not need to source the environment file +- self.add_cmd_output("nova-manage db version") +- self.add_cmd_output("nova-manage fixed list") +- self.add_cmd_output("nova-manage floating list") + +- vars_all = [p in os.environ for p in [ +- 'OS_USERNAME', 'OS_PASSWORD']] +- +- vars_any = [p in os.environ for p in [ +- 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ # collect commands output only if the openstack-nova-api service ++ # is running ++ service_status = self.get_command_output( ++ "systemctl status openstack-nova-api.service" ++ ) + +- if not (all(vars_all) and any(vars_any)): +- self.soslog.warning("Not all environment variables set. Source " +- "the environment file for the user intended " +- "to connect to the OpenStack environment.") +- else: +- self.add_cmd_output("nova service-list") +- self.add_cmd_output("openstack flavor list --long") +- self.add_cmd_output("nova network-list") +- self.add_cmd_output("nova list") +- self.add_cmd_output("nova agent-list") +- self.add_cmd_output("nova version-list") +- self.add_cmd_output("nova host-list") +- self.add_cmd_output("openstack quota show") +- self.add_cmd_output("openstack hypervisor stats show") +- # get details for each nova instance +- cmd = "openstack server list -f value" +- nova_instances = self.call_ext_prog(cmd)['output'] +- for instance in nova_instances.splitlines(): +- instance = instance.split()[0] +- cmd = "openstack server show %s" % (instance) +- self.add_cmd_output( +- cmd, +- suggest_filename="instance-" + instance + ".log") ++ container_status = self.get_command_output("docker ps") ++ in_container = False ++ if container_status['status'] == 0: ++ for line in container_status['output'].splitlines(): ++ if line.endswith("cinder_api"): ++ in_container = True ++ ++ if (service_status['status'] == 0) or in_container: ++ nova_config = "" ++ # if containerized we need to pass the config to the cont. ++ if in_container: ++ nova_config = "--config-dir " + self.var_puppet_gen + \ ++ "/etc/nova/" ++ ++ self.add_cmd_output( ++ "nova-manage " + nova_config + " db version", ++ suggest_filename="nova-manage_db_version" ++ ) ++ self.add_cmd_output( ++ "nova-manage " + nova_config + " fixed list", ++ suggest_filename="nova-manage_fixed_list" ++ ) ++ self.add_cmd_output( ++ "nova-manage " + nova_config + " floating list", ++ suggest_filename="nova-manage_floating_list" ++ ) ++ ++ vars_all = [p in os.environ for p in [ ++ 'OS_USERNAME', 'OS_PASSWORD']] ++ ++ vars_any = [p in os.environ for p in [ ++ 'OS_TENANT_NAME', 'OS_PROJECT_NAME']] ++ ++ if not (all(vars_all) and any(vars_any)): ++ self.soslog.warning("Not all environment variables set. " ++ "Source the environment file for the user " ++ "intended to connect to the OpenStack " ++ "environment.") ++ else: ++ self.add_cmd_output("nova service-list") ++ self.add_cmd_output("openstack flavor list --long") ++ self.add_cmd_output("nova network-list") ++ self.add_cmd_output("nova list") ++ self.add_cmd_output("nova agent-list") ++ self.add_cmd_output("nova version-list") ++ self.add_cmd_output("nova hypervisor-list") ++ self.add_cmd_output("openstack quota show") ++ self.add_cmd_output("openstack hypervisor stats show") ++ # get details for each nova instance ++ cmd = "openstack server list -f value" ++ nova_instances = self.call_ext_prog(cmd)['output'] ++ for instance in nova_instances.splitlines(): ++ instance = instance.split()[0] ++ cmd = "openstack server show %s" % (instance) ++ self.add_cmd_output( ++ cmd, ++ suggest_filename="instance-" + instance + ".log") + + self.limit = self.get_option("log_size") + if self.get_option("all_logs"): +From 2140b1611565078c4a6536782c013a525722e0da Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Thu, 21 Dec 2017 08:00:41 +0100 +Subject: [PATCH] [openstack_glance|heat|nova] fix api container names + +Container names of glance, heat and nova api was not correct +when verify if a the container is running. + +Signed-off-by: Martin Schuppert +--- + sos/plugins/openstack_glance.py | 2 +- + sos/plugins/openstack_heat.py | 2 +- + sos/plugins/openstack_nova.py | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sos/plugins/openstack_glance.py b/sos/plugins/openstack_glance.py +index 4cdc6dc62..d7588abe0 100644 +--- a/sos/plugins/openstack_glance.py ++++ b/sos/plugins/openstack_glance.py +@@ -64,7 +64,7 @@ def setup(self): + in_container = False + if container_status['status'] == 0: + for line in container_status['output'].splitlines(): +- if line.endswith("cinder_api"): ++ if line.endswith("glance_api"): + in_container = True + + if (service_status['status'] == 0) or in_container: +diff --git a/sos/plugins/openstack_heat.py b/sos/plugins/openstack_heat.py +index e3395fabd..0cf7c8595 100644 +--- a/sos/plugins/openstack_heat.py ++++ b/sos/plugins/openstack_heat.py +@@ -40,7 +40,7 @@ def setup(self): + in_container = False + if container_status['status'] == 0: + for line in container_status['output'].splitlines(): +- if line.endswith("cinder_api"): ++ if line.endswith("heat_api"): + in_container = True + + if (service_status['status'] == 0) or in_container: +diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py +index e8839a2a6..951e69cba 100644 +--- a/sos/plugins/openstack_nova.py ++++ b/sos/plugins/openstack_nova.py +@@ -43,7 +43,7 @@ def setup(self): + in_container = False + if container_status['status'] == 0: + for line in container_status['output'].splitlines(): +- if line.endswith("cinder_api"): ++ if line.endswith("nova_api"): + in_container = True + + if (service_status['status'] == 0) or in_container: +From 8ce70c4d3683ce977f1243c56b7d4f4b6782c0df Mon Sep 17 00:00:00 2001 +From: Martin Schuppert +Date: Fri, 29 Dec 2017 09:20:33 +0100 +Subject: [PATCH] [openstack_cinder] check for api service running via + cinder_wsgi + +With OSP11 cinder api changed to run via https wsgi. To check for +running cinder-manage command we also need to take this situation. +The change checks for cinder_wsgi process. + +Signed-off-by: Martin Schuppert +--- + sos/plugins/openstack_cinder.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/sos/plugins/openstack_cinder.py b/sos/plugins/openstack_cinder.py +index a023105c8..6b292d279 100644 +--- a/sos/plugins/openstack_cinder.py ++++ b/sos/plugins/openstack_cinder.py +@@ -37,14 +37,23 @@ def setup(self): + "systemctl status openstack-cinder-api.service" + ) + ++ ps_status = self.get_command_output("ps -ef") ++ in_ps = False ++ if ps_status['status'] == 0: ++ for line in ps_status['output'].splitlines(): ++ if "cinder_wsgi" in line: ++ in_ps = True ++ break ++ + container_status = self.get_command_output("docker ps") + in_container = False + if container_status['status'] == 0: + for line in container_status['output'].splitlines(): + if line.endswith("cinder_api"): + in_container = True ++ break + +- if (service_status['status'] == 0) or in_container: ++ if (service_status['status'] == 0) or in_container or in_ps: + cinder_config = "" + # if containerized we need to pass the config to the cont. + if in_container: diff --git a/SOURCES/sos-bz1515113-postgresql-from-scl.patch b/SOURCES/sos-bz1515113-postgresql-from-scl.patch new file mode 100644 index 0000000..7c33175 --- /dev/null +++ b/SOURCES/sos-bz1515113-postgresql-from-scl.patch @@ -0,0 +1,868 @@ +From 138bc243aa592cd628f6e41a1b3c35f1f01f3c37 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" +Date: Tue, 8 Aug 2017 16:48:40 +0100 +Subject: [PATCH] [Plugin] add executable command enablement checks + +Add a new list/tuple member to the Plugin class that contains a +list of executable commands that will enable the plugin if any +are present. + +For example, a plugin: + + class MyPlugin(Plugin, RedHatPlugin): + + commands = ('mycmd1', 'mycmd2') + +Will be automatically enabled if either 'mycmd1' or 'mycmd2' +is present and executable in the policy defined PATH for the +run. + +Related: #1051. + +Signed-off-by: Bryn M. Reeves +--- + sos/plugins/__init__.py | 27 ++++++++++++++++++--------- + 1 file changed, 18 insertions(+), 9 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index a31297f6c..2d6f6ff58 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -19,7 +19,7 @@ + from __future__ import with_statement + + from sos.utilities import (sos_get_command_output, import_module, grep, +- fileobj, tail) ++ fileobj, tail, is_executable) + import os + import glob + import re +@@ -111,6 +111,7 @@ class Plugin(object): + version = 'unversioned' + packages = () + files = () ++ commands = () + archive = None + profiles = () + sysroot = '/' +@@ -865,23 +866,31 @@ def get_description(self): + + def check_enabled(self): + """This method will be used to verify that a plugin should execute +- given the condition of the underlying environment. The default +- implementation will return True if neither class.files or +- class.packages is specified. If either are specified the plugin will +- check for the existence of any of the supplied files or packages and +- return True if any exist. It is encouraged to override this method if +- this behavior isn't applicable. ++ given the condition of the underlying environment. ++ ++ The default implementation will return True if none of class.files, ++ class.packages, nor class.commands is specified. If any of these is ++ specified the plugin will check for the existence of any of the ++ corresponding paths, packages or commands and return True if any ++ are present. ++ ++ For plugins with more complex enablement checks this method may be ++ overridden. + """ + # some files or packages have been specified for this package +- if self.files or self.packages: ++ if any([self.files, self.packages, self.commands]): + if isinstance(self.files, six.string_types): + self.files = [self.files] + + if isinstance(self.packages, six.string_types): + self.packages = [self.packages] + ++ if isinstance(self.commands, six.string_types): ++ self.commands = [self.commands] ++ + return (any(os.path.exists(fname) for fname in self.files) or +- any(self.is_installed(pkg) for pkg in self.packages)) ++ any(self.is_installed(pkg) for pkg in self.packages) or ++ any(is_executable(cmd) for cmd in self.commands)) + return True + + def default_enabled(self): +From 947e7089c58ac239bc2fd535ac0c77f93f11b895 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Tue, 3 Oct 2017 15:39:43 +0200 +Subject: [PATCH] [plugins] Add class SCLPlugin for Software Collections + support + +Related to #900 and #1090 + +Original author: Bohuslav Kabrda +Signed-off-by: Pavel Moravec +--- + sos/plugins/__init__.py | 109 ++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 106 insertions(+), 3 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 61a3083e3..540d46596 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -884,6 +884,10 @@ def check_enabled(self): + corresponding paths, packages or commands and return True if any + are present. + ++ For SCLPlugin subclasses, it will check whether the plugin can be run ++ for any of installed SCLs. If so, it will store names of these SCLs ++ on the plugin class in addition to returning True. ++ + For plugins with more complex enablement checks this method may be + overridden. + """ +@@ -898,11 +902,34 @@ def check_enabled(self): + if isinstance(self.commands, six.string_types): + self.commands = [self.commands] + +- return (any(os.path.exists(fname) for fname in self.files) or +- any(self.is_installed(pkg) for pkg in self.packages) or +- any(is_executable(cmd) for cmd in self.commands)) ++ if isinstance(self, SCLPlugin): ++ # save SCLs that match files or packages ++ type(self)._scls_matched = [] ++ for scl in self._get_scls(): ++ files = [f % {"scl_name": scl} for f in self.files] ++ packages = [p % {"scl_name": scl} for p in self.packages] ++ commands = [c % {"scl_name": scl} for c in self.commands] ++ if self._files_pkgs_or_cmds_present(files, ++ packages, ++ commands): ++ type(self)._scls_matched.append(scl) ++ return len(type(self)._scls_matched) > 0 ++ ++ return self._files_pkgs_or_cmds_present(self.files, ++ self.packages, ++ self.commands) ++ ++ if isinstance(self, SCLPlugin): ++ # if files and packages weren't specified, we take all SCLs ++ type(self)._scls_matched = self._get_scls() ++ + return True + ++ def _files_pkgs_or_cmds_present(self, files, packages, commands): ++ return (any(os.path.exists(fname) for fname in files) or ++ any(self.is_installed(pkg) for pkg in packages) or ++ any(is_executable(cmd) for cmd in commands)) ++ + def default_enabled(self): + """This decides whether a plugin should be automatically loaded or + only if manually specified in the command line.""" +@@ -979,6 +1006,82 @@ class RedHatPlugin(object): + pass + + ++class SCLPlugin(RedHatPlugin): ++ """Superclass for plugins operating on Software Collections (SCLs). ++ ++ Subclasses of this plugin class can specify class.files and class.packages ++ using "%(scl_name)s" interpolation. The plugin invoking mechanism will try ++ to match these against all found SCLs on the system. SCLs that do match ++ class.files or class.packages are then accessible via self.scls_matched ++ when the plugin is invoked. ++ ++ Additionally, this plugin class provides "add_cmd_output_scl" (run ++ a command in context of given SCL), and "add_copy_spec_scl" and ++ "add_copy_spec_limit_scl" (copy package from file system of given SCL). ++ ++ For example, you can implement a plugin that will list all global npm ++ packages in every SCL that contains "npm" package: ++ ++ class SCLNpmPlugin(Plugin, SCLPlugin): ++ packages = ("%(scl_name)s-npm",) ++ ++ def setup(self): ++ for scl in self.scls_matched: ++ self.add_cmd_output_scl(scl, "npm ls -g --json") ++ """ ++ ++ @property ++ def scls_matched(self): ++ if not hasattr(type(self), '_scls_matched'): ++ type(self)._scls_matched = [] ++ return type(self)._scls_matched ++ ++ def _get_scls(self): ++ output = sos_get_command_output("scl -l")["output"] ++ return [scl.strip() for scl in output.splitlines()] ++ ++ def add_cmd_output_scl(self, scl, cmds, **kwargs): ++ """Same as add_cmd_output, except that it wraps command in ++ "scl enable" call. ++ """ ++ if isinstance(cmds, six.string_types): ++ cmds = [cmds] ++ scl_cmds = [] ++ scl_cmd_tpl = "scl enable %s \"%s\"" ++ for cmd in cmds: ++ scl_cmds.append(scl_cmd_tpl % (scl, cmd)) ++ self.add_cmd_output(scl_cmds, **kwargs) ++ ++ # config files for Software Collections are under /etc/opt/rh/${scl} and ++ # var files are under /var/opt/rh/${scl}. So we need to insert the paths ++ # after the appropriate root dir. ++ def convert_copyspec_scl(self, scl, copyspec): ++ for rootdir in ['etc', 'var']: ++ p = re.compile('^/%s/' % rootdir) ++ copyspec = p.sub('/%s/opt/rh/%s/' % (rootdir, scl), copyspec) ++ return copyspec ++ ++ def add_copy_spec_scl(self, scl, copyspecs): ++ """Same as add_copy_spec, except that it prepends path to SCL root ++ to "copyspecs". ++ """ ++ if isinstance(copyspecs, six.string_types): ++ copyspecs = [copyspecs] ++ scl_copyspecs = [] ++ for copyspec in copyspecs: ++ scl_copyspecs.append(self.convert_copyspec_scl(scl, copyspec)) ++ self.add_copy_spec(scl_copyspecs) ++ ++ def add_copy_spec_limit_scl(self, scl, copyspec, **kwargs): ++ """Same as add_copy_spec_limit, except that it prepends path to SCL ++ root to "copyspec". ++ """ ++ self.add_copy_spec_limit( ++ self.convert_copyspec_scl(scl, copyspec), ++ **kwargs ++ ) ++ ++ + class PowerKVMPlugin(RedHatPlugin): + """Tagging class for IBM PowerKVM Linux""" + pass +From 62d6435198403abb65b925e7bf63fc39f5394e6d Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Mon, 16 Oct 2017 13:20:44 +0200 +Subject: [PATCH] [postgresql] Collect data for postgreSQL from RHSCL + +Collect postgreSQL data also when postgreSQL is installed from +Red Hat Software Collections. + +Resolves: #1090 + +Signed-off-by: Pavel Moravec +--- + sos/plugins/postgresql.py | 117 +++++++++++++++++++++++++--------------------- + 1 file changed, 65 insertions(+), 52 deletions(-) + +diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py +index 345532223..45c87e890 100644 +--- a/sos/plugins/postgresql.py ++++ b/sos/plugins/postgresql.py +@@ -1,3 +1,4 @@ ++# Copyright (C) 2017 Red Hat, Inc., Pavel Moravec + # Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola + # Copyright (C) 2013 Chris J Arges + # Copyright (C) 2012-2013 Red Hat, Inc., Bryn M. Reeves +@@ -20,7 +21,8 @@ + import os + import tempfile + +-from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin ++from sos.plugins import (Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin, ++ SCLPlugin) + from sos.utilities import find + + +@@ -45,47 +47,43 @@ class PostgreSQL(Plugin): + ('dbport', 'database server port number', '', '5432') + ] + +- def pg_dump(self): +- dest_file = os.path.join(self.tmp_dir, "sos_pgdump.tar") +- # We're only modifying this for ourself and our children so there +- # is no need to save and restore environment variables if the user +- # decided to pass the password on the command line. +- if self.get_option("password") is not False: +- os.environ["PGPASSWORD"] = str(self.get_option("password")) +- +- if self.get_option("dbhost"): +- cmd = "pg_dump -U %s -h %s -p %s -w -f %s -F t %s" % ( +- self.get_option("username"), +- self.get_option("dbhost"), +- self.get_option("dbport"), +- dest_file, +- self.get_option("dbname") +- ) +- else: +- cmd = "pg_dump -C -U %s -w -f %s -F t %s " % ( +- self.get_option("username"), +- dest_file, +- self.get_option("dbname") +- ) +- +- result = self.call_ext_prog(cmd) +- if (result['status'] == 0): +- self.add_copy_spec(dest_file) +- else: +- self._log_error( +- "Unable to execute pg_dump. Error(%s)" % (result['output']) +- ) +- self.add_alert( +- "ERROR: Unable to execute pg_dump. Error(%s)" % +- (result['output']) +- ) +- +- def setup(self): ++ def pg_dump(self, pg_dump_command="pg_dump", filename="sos_pgdump.tar"): + if self.get_option("dbname"): + if self.get_option("password") or "PGPASSWORD" in os.environ: + self.tmp_dir = tempfile.mkdtemp() +- self.pg_dump() +- else: ++ dest_file = os.path.join(self.tmp_dir, filename) ++ # We're only modifying this for ourself and our children so ++ # there is no need to save and restore environment variables if ++ # the user decided to pass the password on the command line. ++ if self.get_option("password") is not False: ++ os.environ["PGPASSWORD"] = str(self.get_option("password")) ++ ++ if self.get_option("dbhost"): ++ cmd = "%s -U %s -h %s -p %s -w -f %s -F t %s" % ( ++ pg_dump_command, ++ self.get_option("username"), ++ self.get_option("dbhost"), ++ self.get_option("dbport"), ++ dest_file, ++ self.get_option("dbname") ++ ) ++ else: ++ cmd = "%s -C -U %s -w -f %s -F t %s " % ( ++ pg_dump_command, ++ self.get_option("username"), ++ dest_file, ++ self.get_option("dbname") ++ ) ++ ++ result = self.call_ext_prog(cmd) ++ if (result['status'] == 0): ++ self.add_copy_spec(dest_file) ++ else: ++ self._log_info( ++ "Unable to execute pg_dump. Error(%s)" % ++ (result['output']) ++ ) ++ else: # no password in env or options + self.soslog.warning( + "password must be supplied to dump a database." + ) +@@ -93,6 +91,9 @@ def setup(self): + "WARN: password must be supplied to dump a database." + ) + ++ def setup(self): ++ self.pg_dump() ++ + def postproc(self): + import shutil + if self.tmp_dir: +@@ -105,33 +106,45 @@ def postproc(self): + self.add_alert("ERROR: Unable to remove %s." % (self.tmp_dir)) + + +-class RedHatPostgreSQL(PostgreSQL, RedHatPlugin): ++class RedHatPostgreSQL(PostgreSQL, SCLPlugin): ++ ++ packages = ('postgresql', 'rh-postgresql95-postgresql-server', ) + + def setup(self): + super(RedHatPostgreSQL, self).setup() + ++ scl = "rh-postgresql95" ++ pghome = self.get_option("pghome") ++ + # Copy PostgreSQL log files. +- for filename in find("*.log", self.get_option("pghome")): ++ for filename in find("*.log", pghome): ++ self.add_copy_spec(filename) ++ for filename in find("*.log", self.convert_copyspec_scl(scl, pghome)): + self.add_copy_spec(filename) ++ + # Copy PostgreSQL config files. +- for filename in find("*.conf", self.get_option("pghome")): ++ for filename in find("*.conf", pghome): ++ self.add_copy_spec(filename) ++ for filename in find("*.conf", self.convert_copyspec_scl(scl, pghome)): + self.add_copy_spec(filename) + +- self.add_copy_spec( +- os.path.join( +- self.get_option("pghome"), +- "data", +- "PG_VERSION" +- ) +- ) +- self.add_copy_spec( +- os.path.join( +- self.get_option("pghome"), ++ self.add_copy_spec(os.path.join(pghome, "data", "PG_VERSION")) ++ self.add_copy_spec(os.path.join(pghome, "data", "postmaster.opts")) ++ ++ self.add_copy_spec_scl(scl, os.path.join(pghome, "data", "PG_VERSION")) ++ self.add_copy_spec_scl(scl, os.path.join( ++ pghome, + "data", + "postmaster.opts" + ) + ) + ++ if scl in self.scls_matched: ++ self.pg_dump( ++ pg_dump_command="scl enable rh-postgresql95 -- pg_dump", ++ filename="sos_scl_pgdump.tar" ++ ) ++ + + class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin): + +From 0b93d1f69ccfcc76e1896ea0e5ff7854be69be13 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Sat, 25 Nov 2017 12:47:35 +0100 +Subject: [PATCH] [plugins] set proper PATH for SCL commands + +As SCL packages are deployed under /opt/${provider}/${scl}/, +calling a SCL command needs that prefix in any path in PATH. + +Consequently, distro-specific SCL default path prefix of the provider must be +defined in sos policies. + +Relevant to: #1154 + +Signed-off-by: Pavel Moravec +--- + sos/plugins/__init__.py | 37 ++++++++++++++++++++++++++++++------- + sos/policies/__init__.py | 4 ++++ + sos/policies/redhat.py | 1 + + 3 files changed, 35 insertions(+), 7 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index aa69b19d..2a8bc516 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -1066,25 +1066,48 @@ class SCLPlugin(RedHatPlugin): + output = sos_get_command_output("scl -l")["output"] + return [scl.strip() for scl in output.splitlines()] + ++ def convert_cmd_scl(self, scl, cmd): ++ """wrapping command in "scl enable" call and adds proper PATH ++ """ ++ # load default SCL prefix to PATH ++ prefix = self.policy().get_default_scl_prefix() ++ # read prefix from /etc/scl/prefixes/${scl} and strip trailing '\n' ++ try: ++ prefix = open('/etc/scl/prefixes/%s' % scl, 'r').read()\ ++ .rstrip('\n') ++ except Exception as e: ++ self._log_error("Failed to find prefix for SCL %s, using %s" ++ % (scl, prefix)) ++ ++ # expand PATH by equivalent prefixes under the SCL tree ++ path = os.environ["PATH"] ++ for p in path.split(':'): ++ path = '%s/%s%s:%s' % (prefix, scl, p, path) ++ ++ scl_cmd = "scl enable %s \"PATH=%s %s\"" % (scl, path, cmd) ++ return scl_cmd ++ + def add_cmd_output_scl(self, scl, cmds, **kwargs): + """Same as add_cmd_output, except that it wraps command in +- "scl enable" call. ++ "scl enable" call and sets proper PATH. + """ + if isinstance(cmds, six.string_types): + cmds = [cmds] + scl_cmds = [] +- scl_cmd_tpl = "scl enable %s \"%s\"" + for cmd in cmds: +- scl_cmds.append(scl_cmd_tpl % (scl, cmd)) ++ scl_cmds.append(convert_cmd_scl(scl, cmd)) + self.add_cmd_output(scl_cmds, **kwargs) + +- # config files for Software Collections are under /etc/opt/rh/${scl} and +- # var files are under /var/opt/rh/${scl}. So we need to insert the paths +- # after the appropriate root dir. ++ # config files for Software Collections are under /etc/${prefix}/${scl} and ++ # var files are under /var/${prefix}/${scl} where the ${prefix} is distro ++ # specific path. So we need to insert the paths after the appropriate root ++ # dir. + def convert_copyspec_scl(self, scl, copyspec): ++ scl_prefix = self.policy().get_default_scl_prefix() + for rootdir in ['etc', 'var']: + p = re.compile('^/%s/' % rootdir) +- copyspec = p.sub('/%s/opt/rh/%s/' % (rootdir, scl), copyspec) ++ copyspec = p.sub('/%s/%s/%s/' % (rootdir, scl_prefix, scl), ++ copyspec) + return copyspec + + def add_copy_spec_scl(self, scl, copyspecs): +diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py +index dffd801c..dc043105 100644 +--- a/sos/policies/__init__.py ++++ b/sos/policies/__init__.py +@@ -194,6 +194,7 @@ No changes will be made to system configuration. + vendor_url = "http://www.example.com/" + vendor_text = "" + PATH = "" ++ default_scl_prefix = "" + + _in_container = False + _host_sysroot = '/' +@@ -271,6 +272,9 @@ No changes will be made to system configuration. + return tempfile.gettempdir() + return opt_tmp_dir + ++ def get_default_scl_prefix(self): ++ return self.default_scl_prefix ++ + def match_plugin(self, plugin_classes): + if len(plugin_classes) > 1: + for p in plugin_classes: +diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py +index c7449439..2dfe0589 100644 +--- a/sos/policies/redhat.py ++++ b/sos/policies/redhat.py +@@ -44,6 +44,7 @@ class RedHatPolicy(LinuxPolicy): + _rpmq_cmd = 'rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"' + _in_container = False + _host_sysroot = '/' ++ default_scl_prefix = '/opt/rh' + + def __init__(self, sysroot=None): + super(RedHatPolicy, self).__init__(sysroot=sysroot) +-- +2.13.6 + +From 419ebe48ea408b6596ff4d7d9837079dc3057fcf Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Sat, 25 Nov 2017 12:58:16 +0100 +Subject: [PATCH] [postgresql] Call SCL pg_dump with proper path + +Also stop storing pg_dump in an auxiliary tempdir but under regular +sos_commands/postgresql directory. + +Resolves: #1154 + +Signed-off-by: Pavel Moravec +--- + sos/plugins/postgresql.py | 43 ++++++++----------------------------------- + 1 file changed, 8 insertions(+), 35 deletions(-) + +diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py +index 45c87e89..9ba696be 100644 +--- a/sos/plugins/postgresql.py ++++ b/sos/plugins/postgresql.py +@@ -34,8 +34,6 @@ class PostgreSQL(Plugin): + + packages = ('postgresql',) + +- tmp_dir = None +- + password_warn_text = " (password visible in process listings)" + + option_list = [ +@@ -47,11 +45,9 @@ class PostgreSQL(Plugin): + ('dbport', 'database server port number', '', '5432') + ] + +- def pg_dump(self, pg_dump_command="pg_dump", filename="sos_pgdump.tar"): ++ def do_pg_dump(self, scl=None, filename="pgdump.tar"): + if self.get_option("dbname"): + if self.get_option("password") or "PGPASSWORD" in os.environ: +- self.tmp_dir = tempfile.mkdtemp() +- dest_file = os.path.join(self.tmp_dir, filename) + # We're only modifying this for ourself and our children so + # there is no need to save and restore environment variables if + # the user decided to pass the password on the command line. +@@ -59,30 +55,21 @@ class PostgreSQL(Plugin): + os.environ["PGPASSWORD"] = str(self.get_option("password")) + + if self.get_option("dbhost"): +- cmd = "%s -U %s -h %s -p %s -w -f %s -F t %s" % ( +- pg_dump_command, ++ cmd = "pg_dump -U %s -h %s -p %s -w -F t %s" % ( + self.get_option("username"), + self.get_option("dbhost"), + self.get_option("dbport"), +- dest_file, + self.get_option("dbname") + ) + else: +- cmd = "%s -C -U %s -w -f %s -F t %s " % ( +- pg_dump_command, ++ cmd = "pg_dump -C -U %s -w -F t %s " % ( + self.get_option("username"), +- dest_file, + self.get_option("dbname") + ) + +- result = self.call_ext_prog(cmd) +- if (result['status'] == 0): +- self.add_copy_spec(dest_file) +- else: +- self._log_info( +- "Unable to execute pg_dump. Error(%s)" % +- (result['output']) +- ) ++ if scl is not None: ++ cmd = self.convert_cmd_scl(scl, cmd) ++ self.add_cmd_output(cmd, suggest_filename=filename) + else: # no password in env or options + self.soslog.warning( + "password must be supplied to dump a database." +@@ -92,18 +79,7 @@ class PostgreSQL(Plugin): + ) + + def setup(self): +- self.pg_dump() +- +- def postproc(self): +- import shutil +- if self.tmp_dir: +- try: +- shutil.rmtree(self.tmp_dir) +- except shutil.Error: +- self.soslog.exception( +- "Unable to remove %s." % (self.tmp_dir) +- ) +- self.add_alert("ERROR: Unable to remove %s." % (self.tmp_dir)) ++ self.do_pg_dump() + + + class RedHatPostgreSQL(PostgreSQL, SCLPlugin): +@@ -140,10 +116,7 @@ class RedHatPostgreSQL(PostgreSQL, SCLPlugin): + ) + + if scl in self.scls_matched: +- self.pg_dump( +- pg_dump_command="scl enable rh-postgresql95 -- pg_dump", +- filename="sos_scl_pgdump.tar" +- ) ++ self.do_pg_dump(scl=scl, filename="pgdump-scl-%s.tar" % scl) + + + class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin): +-- +2.13.6 + +From ede50e9cb4a5f2755eaeaf608fb2b3708f911422 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Wed, 20 Dec 2017 11:47:33 +0100 +Subject: [PATCH] [plugins] allow add_cmd_output to collect binary output + +If a command output is a true binary data, allow add_cmd_output to +collect the raw content and dont try to decode it as UTF-8. + +Resolves: #1169 + +Signed-off-by: Pavel Moravec +--- + sos/archive.py | 16 ++++++++++------ + sos/plugins/__init__.py | 33 ++++++++++++++++++--------------- + sos/plugins/postgresql.py | 3 ++- + sos/utilities.py | 5 +++-- + 4 files changed, 33 insertions(+), 24 deletions(-) + +diff --git a/sos/archive.py b/sos/archive.py +index 607312a71..4bc2bedea 100644 +--- a/sos/archive.py ++++ b/sos/archive.py +@@ -82,7 +82,7 @@ def log_debug(self, msg): + def add_file(self, src, dest=None): + raise NotImplementedError + +- def add_string(self, content, dest): ++ def add_string(self, content, dest, treat_binary): + raise NotImplementedError + + def add_link(self, source, link_name): +@@ -198,12 +198,14 @@ def add_file(self, src, dest=None): + self.log_debug("added %s to FileCacheArchive '%s'" % + (file_name, self._archive_root)) + +- def add_string(self, content, dest): ++ def add_string(self, content, dest, treat_binary=False): + src = dest + dest = self.dest_path(dest) + self._check_path(dest) +- f = codecs.open(dest, 'w', encoding='utf-8') +- if isinstance(content, bytes): ++ f = codecs.open(dest, ++ 'wb' if treat_binary else 'w', ++ encoding=None if treat_binary else 'utf-8') ++ if isinstance(content, bytes) and not treat_binary: + content = content.decode('utf8', 'ignore') + f.write(content) + if os.path.exists(src): +@@ -212,8 +214,10 @@ def add_string(self, content, dest): + except OSError as e: + self.log_error( + "Unable to add '%s' to FileCacheArchive: %s" % (dest, e)) +- self.log_debug("added string at '%s' to FileCacheArchive '%s'" +- % (src, self._archive_root)) ++ self.log_debug("added %sstring at '%s' to FileCacheArchive '%s'" ++ % ('binary ' if treat_binary else '', ++ src, ++ self._archive_root)) + + def add_link(self, source, link_name): + dest = self.dest_path(link_name) +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 2a8bc516e..156f5ed36 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -587,7 +587,8 @@ def getmtime(path): + self.archive.add_link(link_path, _file) + + def get_command_output(self, prog, timeout=300, stderr=True, +- chroot=True, runat=None, env=None): ++ chroot=True, runat=None, env=None, ++ treat_binary=False): + if chroot or self.commons['cmdlineopts'].chroot == 'always': + root = self.sysroot + else: +@@ -595,7 +596,7 @@ def get_command_output(self, prog, timeout=300, stderr=True, + + result = sos_get_command_output(prog, timeout=timeout, stderr=stderr, + chroot=root, chdir=runat, +- env=env) ++ env=env, treat_binary=treat_binary) + + if result['status'] == 124: + self._log_warn("command '%s' timed out after %ds" +@@ -586,7 +586,8 @@ class Plugin(object): + % (prog.split()[0], root)) + return self.get_command_output(prog, timeout=timeout, + chroot=False, runat=runat, +- env=env) ++ env=env, ++ treat_binary=treat_binary) + self._log_debug("could not run '%s': command not found" % prog) + return result + +@@ -632,14 +634,14 @@ def check_ext_prog(self, prog): + + def _add_cmd_output(self, cmd, suggest_filename=None, + root_symlink=None, timeout=300, stderr=True, +- chroot=True, runat=None, env=None): ++ chroot=True, runat=None, env=None, treat_binary=False): + """Internal helper to add a single command to the collection list.""" + cmdt = ( + cmd, suggest_filename, + root_symlink, timeout, stderr, +- chroot, runat, env ++ chroot, runat, env, treat_binary + ) +- _tuplefmt = "('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s')" ++ _tuplefmt = "('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s', '%s')" + _logstr = "packed command tuple: " + _tuplefmt + self._log_debug(_logstr % cmdt) + self.collect_cmds.append(cmdt) +@@ -647,7 +649,7 @@ def _add_cmd_output(self, cmd, suggest_filename=None, + + def add_cmd_output(self, cmds, suggest_filename=None, + root_symlink=None, timeout=300, stderr=True, +- chroot=True, runat=None, env=None): ++ chroot=True, runat=None, env=None, treat_binary=False): + """Run a program or a list of programs and collect the output""" + if isinstance(cmds, six.string_types): + cmds = [cmds] +@@ -656,7 +658,7 @@ def add_cmd_output(self, cmds, suggest_filename=None, + for cmd in cmds: + self._add_cmd_output(cmd, suggest_filename, + root_symlink, timeout, stderr, +- chroot, runat, env) ++ chroot, runat, env, treat_binary) + + def get_cmd_output_path(self, name=None, make=True): + """Return a path into which this module should store collected +@@ -683,14 +684,15 @@ class Plugin(object): + + def get_cmd_output_now(self, exe, suggest_filename=None, + root_symlink=False, timeout=300, stderr=True, +- chroot=True, runat=None, env=None): ++ chroot=True, runat=None, env=None, ++ treat_binary=False): + """Execute a command and save the output to a file for inclusion in the + report. + """ + start = time() + result = self.get_command_output(exe, timeout=timeout, stderr=stderr, + chroot=chroot, runat=runat, +- env=env) ++ env=env, treat_binary=treat_binary) + # 126 means 'found but not executable' + if result['status'] == 126 or result['status'] == 127: + return None +@@ -729,7 +732,7 @@ def get_cmd_output_now(self, exe, suggest_filename=None, + outfn = self._make_command_filename(exe) + + outfn_strip = outfn[len(self.commons['cmddir'])+1:] +- self.archive.add_string(result['output'], outfn) ++ self.archive.add_string(result['output'], outfn, treat_binary) + if root_symlink: + self.archive.add_link(outfn, root_symlink) + +@@ -839,16 +842,16 @@ def _collect_cmd_output(self): + timeout, + stderr, + chroot, runat, +- env ++ env, treat_binary + ) = progs[0] +- self._log_debug("unpacked command tuple: " + +- "('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s')" % +- progs[0]) ++ self._log_debug(("unpacked command tuple: " + ++ "('%s', '%s', '%s', %s, '%s', '%s', '%s', '%s'," + ++ "'%s')") % progs[0]) + self._log_info("collecting output of '%s'" % prog) + self.get_cmd_output_now(prog, suggest_filename=suggest_filename, + root_symlink=root_symlink, timeout=timeout, + stderr=stderr, chroot=chroot, runat=runat, +- env=env) ++ env=env, treat_binary=treat_binary) + + def _collect_strings(self): + for string, file_name in self.copy_strings: +diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py +index 9ba696be2..07db22fdd 100644 +--- a/sos/plugins/postgresql.py ++++ b/sos/plugins/postgresql.py +@@ -69,7 +69,8 @@ def do_pg_dump(self, scl=None, filename="pgdump.tar"): + + if scl is not None: + cmd = self.convert_cmd_scl(scl, cmd) +- self.add_cmd_output(cmd, suggest_filename=filename) ++ self.add_cmd_output(cmd, suggest_filename=filename, ++ treat_binary=True) + else: # no password in env or options + self.soslog.warning( + "password must be supplied to dump a database." +diff --git a/sos/utilities.py b/sos/utilities.py +index 55bb1dc96..a9040ba28 100644 +--- a/sos/utilities.py ++++ b/sos/utilities.py +@@ -110,7 +110,8 @@ def is_executable(command): + + + def sos_get_command_output(command, timeout=300, stderr=False, +- chroot=None, chdir=None, env=None): ++ chroot=None, chdir=None, env=None, ++ treat_binary=False): + """Execute a command and return a dictionary of status and output, + optionally changing root or current working directory before + executing command. +@@ -164,7 +165,7 @@ def _child_prep_fn(): + + return { + 'status': p.returncode, +- 'output': stdout.decode('utf-8', 'ignore') ++ 'output': stdout if treat_binary else stdout.decode('utf-8', 'ignore') + } + + diff --git a/SPECS/sos.spec b/SPECS/sos.spec index 7a5a241..fee0dc8 100644 --- a/SPECS/sos.spec +++ b/SPECS/sos.spec @@ -2,7 +2,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 3.4 -Release: 6%{?dist} +Release: 13%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz License: GPLv2+ @@ -28,7 +28,11 @@ Patch8: sos-bz1449904-ceph-tmp-mount-exclude.patch Patch9: sos-bz1393961-missing-filesystem-nonfatal.patch Patch10: sos-bz1400407-samba-dc-connect.patch Patch11: sos-bz1470573-tripleo-add-ui-logs.patch -Patch12: sos-3.4-centos-branding.patch +Patch12: sos-bz1463635-openstack-containerized-tripleo.patch +Patch13: sos-bz1482574-jars-redundant-os-walk.patch +Patch14: sos-bz1491964-gluster-block-plugin.patch +Patch15: sos-bz1511087-openstack-containerized-further-updates.patch +Patch16: sos-bz1515113-postgresql-from-scl.patch %description Sos is a set of tools that gathers information about system @@ -51,6 +55,10 @@ support technicians and developers. %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 %build make @@ -74,8 +82,39 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sos.conf %changelog -* Mon Jul 31 2017 CentOS Sources - 3.4-6.el7.centos -- Roll in CentOS Branding +* Thu Jan 04 2018 Pavel Moravec = 3.4-13 +- [plugins] allow add_cmd_output to collect binary output + Resolves: bz1515113 + +* Thu Jan 04 2018 Pavel Moravec = 3.4-12 +- [openstack_cinder] check for api service running + Resolves: bz1511087 +- [plugins] allow add_cmd_output to collect binary output + Resolves: bz1515113 + +* Fri Dec 08 2017 Pavel Moravec = 3.4-11 +- [postgresql] Call SCL pg_dump with proper path + Resolves: bz1515113 + +* Mon Nov 20 2017 Pavel Moravec = 3.4-10 +- [postgresql] Collect data for postgreSQL from RHSCL + Resolves: bz1515113 + +* Wed Nov 15 2017 Pavel Moravec = 3.4-9 +- [openstack_*] further updates to OSP plugins in containers + Resolves: bz1511087 + +* Thu Oct 12 2017 Pavel Moravec = 3.4-8 +- [gnocchi] Tripleo specific containerized services logs + Resolves: bz1463635 + +* Tue Oct 10 2017 Pavel Moravec = 3.4-7 +- [openstack plugins] Tripleo specific containerized services + Resolves: bz1463635 +- [jars] Scan only /usr/{share,lib}/java by default + Resolves: bz1482574 +- [gluster_block] Added new plugin gluster_block + Resolves: bz1491964 * Wed Jul 12 2017 Pavel Moravec = 3.4-6 - [tripleo] Add ui logs