-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves: #3348 Signed-off-by: Arif Ali <[email protected]>
- Loading branch information
Showing
1 changed file
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# This file is part of the sos project: https://github.com/sosreport/sos | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions of | ||
# version 2 of the GNU General Public License. | ||
# | ||
# See the LICENSE file in the source distribution for further information. | ||
|
||
from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin | ||
|
||
|
||
class OpenStackMasakari(Plugin): | ||
|
||
short_desc = 'OpenStack Masakari' | ||
plugin_name = "openstack_masakari" | ||
profiles = ('openstack', 'openstack_controller') | ||
containers = ('.*masakari_api',) | ||
var_puppet_gen = "/var/lib/config-data/puppet-generated/masakari" | ||
|
||
def setup(self): | ||
|
||
config_dir = "%s/etc/masakari" % ( | ||
self.var_puppet_gen if self.container_exists('.*masakari_api') else | ||
'' | ||
) | ||
masakari_cmd = "masakari-manage --config-dir %s db version" % config_dir | ||
self.add_cmd_output(masakari_cmd, suggest_filename="masakari_db_version") | ||
|
||
self.add_copy_spec([ | ||
"/etc/masakari/", | ||
"/etc/masakarimonitors/", | ||
self.var_puppet_gen + "/etc/masakari/", | ||
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", | ||
]) | ||
|
||
if self.get_option("all_logs"): | ||
self.add_copy_spec([ | ||
"/var/log/masakari/*", | ||
]) | ||
else: | ||
self.add_copy_spec([ | ||
"/var/log/masakari/*.log", | ||
]) | ||
|
||
self.add_file_tags({ | ||
".*/etc/masakari/masakari.conf": "masakari_conf" | ||
}) | ||
|
||
def apply_regex_sub(self, regexp, subst): | ||
self.do_path_regex_sub("/etc/masakari/*", regexp, subst) | ||
self.do_path_regex_sub( | ||
self.var_puppet_gen + "/etc/masakari/*", | ||
regexp, subst | ||
) | ||
|
||
def postproc(self): | ||
protect_keys = [".*password.*", "transport_url", | ||
"memcache_secret_key", "rabbit_password"] | ||
connection_keys = ["connection", "sql_connection"] | ||
|
||
self.apply_regex_sub( | ||
r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys), | ||
r"\1*********" | ||
) | ||
self.apply_regex_sub( | ||
r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" % | ||
"|".join(connection_keys), | ||
r"\1*********\6" | ||
) | ||
|
||
|
||
class DebianMasakari(OpenStackMasakari, DebianPlugin, UbuntuPlugin): | ||
|
||
short_desc = 'OpenStack Masakari information for Debian based distributions' | ||
packages = ( | ||
'masakari-engine', | ||
'masakari-api', | ||
) | ||
|
||
services = ( 'masakari-engine', ) | ||
|
||
def setup(self): | ||
super(DebianMasakari, self).setup() | ||
if self.get_option("all_logs"): | ||
self.add_copy_spec([ | ||
"/var/log/apache2/masakari*", | ||
]) | ||
else: | ||
self.add_copy_spec([ | ||
"/var/log/apache2/masakari*.log", | ||
]) | ||
|
||
|
||
class RedHatMasakari(OpenStackMasakari, RedHatPlugin): | ||
|
||
short_desc = 'OpenStack Masakari information for Red Hat distributions' | ||
packages = ('openstack-selinux',) | ||
|
||
def setup(self):` | ||
Check failure Code scanning / CodeQL Syntax error Error
Syntax Error (in Python 3).
|
||
super(RedHatMasakari, self).setup() | ||
self.add_copy_spec("/etc/sudoers.d/masakari") | ||
|
||
if self.get_option("all_logs"): | ||
self.add_copy_spec([ | ||
"/var/log/containers/masakari/*" | ||
]) | ||
else: | ||
self.add_copy_spec([ | ||
"/var/log/containers/masakari/*.log" | ||
]) | ||
|
||
|
||
# vim: et ts=4 sw=4 |