Skip to content

Commit

Permalink
[utilities][ceph] wildcard support for path in files, fix ceph paths
Browse files Browse the repository at this point in the history
This lets files triggers use * and also updates the
ceph plugins to trigger only if folders are non empty

Closes: #3311
Signed-off-by: Nikhil Kshirsagar <[email protected]>
  • Loading branch information
nkshirsagar authored and TurboTurtle committed Jul 20, 2023
1 parent 97bc495 commit 221f587
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
plugin_name = 'ceph_mds'
profiles = ('storage', 'virt', 'container', 'ceph')
containers = ('ceph-(.*-)?fs.*',)
files = ('/var/lib/ceph/mds/',)
files = ('/var/lib/ceph/mds/*',)

def setup(self):
self.add_file_tags({
Expand Down
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):

plugin_name = 'ceph_mgr'
profiles = ('storage', 'virt', 'container', 'ceph')
files = ('/var/lib/ceph/mgr/', '/var/lib/ceph/*/mgr*')
files = ('/var/lib/ceph/mgr/*', '/var/lib/ceph/*/mgr*')
containers = ('ceph-(.*-)?mgr.*',)

def setup(self):
Expand Down
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
# but by default they are not capable of running various ceph commands in
# this plugin - the `ceph` binary is functional directly on the host
containers = ('ceph-(.*-)?mon.*',)
files = ('/var/lib/ceph/mon/', '/var/lib/ceph/*/mon*',
files = ('/var/lib/ceph/mon/*', '/var/lib/ceph/*/mon*',
'/var/snap/microceph/common/data/mon/*')
ceph_version = 0

Expand Down
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
plugin_name = 'ceph_osd'
profiles = ('storage', 'virt', 'container', 'ceph')
containers = ('ceph-(.*-)?osd.*',)
files = ('/var/lib/ceph/osd/', '/var/lib/ceph/*/osd*',
files = ('/var/lib/ceph/osd/*', '/var/lib/ceph/*/osd*',
'/var/snap/microceph/common/data/osd/*')

def setup(self):
Expand Down
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CephRGW(Plugin, RedHatPlugin, UbuntuPlugin):
plugin_name = 'ceph_rgw'
profiles = ('storage', 'virt', 'container', 'webserver', 'ceph')
containers = ('ceph-(.*)?rgw.*',)
files = ('/var/lib/ceph/radosgw',)
files = ('/var/lib/ceph/radosgw/*',)

def setup(self):
self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log',
Expand Down
2 changes: 2 additions & 0 deletions sos/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ def _os_wrapper(path, sysroot, method, module=os.path):


def path_exists(path, sysroot):
if '*' in path:
return _os_wrapper(path, sysroot, 'glob', module=glob)
return _os_wrapper(path, sysroot, 'exists')


Expand Down

0 comments on commit 221f587

Please sign in to comment.