Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
GairePravesh committed Aug 16, 2023
2 parents a424966 + d71e6b5 commit d24711c
Show file tree
Hide file tree
Showing 72 changed files with 532 additions and 211 deletions.
14 changes: 7 additions & 7 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ env:
UBUNTU_PROJECT: "ubuntu-os-cloud"

# Images exist on GCP already
CENTOS_9_IMAGE_NAME: "centos-stream-9-v20221102"
CENTOS_8_IMAGE_NAME: "centos-stream-8-v20230306"
DEBIAN_IMAGE_NAME: "debian-11-bullseye-v20230306"
CENTOS_9_IMAGE_NAME: "centos-stream-9-v20230809"
CENTOS_8_IMAGE_NAME: "centos-stream-8-v20230809"
DEBIAN_IMAGE_NAME: "debian-11-bullseye-v20230809"
FEDORA_IMAGE_NAME: "fedora-cloud-base-gcp-38-1-6-x86-64"
FEDORA_PRIOR_IMAGE_NAME: "fedora-cloud-base-gcp-37-1-7-x86-64"
UBUNTU_IMAGE_NAME: "ubuntu-2204-jammy-v20230302"
UBUNTU_PRIOR_IMAGE_NAME: "ubuntu-2004-focal-v20230302"
UBUNTU_PRIOR2_IMAGE_NAME: "ubuntu-1804-bionic-v20230324"
UBUNTU_SNAP_IMAGE_NAME: "ubuntu-2204-jammy-v20230302"
UBUNTU_IMAGE_NAME: "ubuntu-2204-jammy-v20230727"
UBUNTU_PRIOR_IMAGE_NAME: "ubuntu-2004-focal-v20230724"
UBUNTU_PRIOR2_IMAGE_NAME: "ubuntu-1804-bionic-v20230605"
UBUNTU_SNAP_IMAGE_NAME: "ubuntu-2204-jammy-v20230727"

# Curl-command prefix for downloading task artifacts, simply add the
# the url-encoded task name, artifact name, and path as a suffix.
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/snap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ on:
push:
branches:
- main
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
concurrency:
group: snap-build
cancel-in-progress: true
Expand All @@ -25,8 +28,16 @@ jobs:
- run: |
sudo sos help
- uses: snapcore/action-publish@v1
if: ${{ github.event_name == 'push' }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ steps.build-snap.outputs.snap }}
release: "latest/edge"
- uses: snapcore/action-publish@v1
if: ${{ github.event_name == 'release' }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with:
snap: ${{ steps.build-snap.outputs.snap }}
release: "latest/candidate"
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://api.cirrus-ci.com/github/sosreport/sos.svg?branch=main)](https://cirrus-ci.com/github/sosreport/sos) [![Documentation Status](https://readthedocs.org/projects/sos/badge/?version=main)](https://sos.readthedocs.io/en/main/?badge=main)
[![Build Status](https://api.cirrus-ci.com/github/sosreport/sos.svg?branch=main)](https://cirrus-ci.com/github/sosreport/sos) [![Documentation Status](https://readthedocs.org/projects/sos/badge/?version=main)](https://sos.readthedocs.io/en/main/?badge=main) [![sosreport](https://snapcraft.io/sosreport/badge.svg)](https://snapcraft.io/sosreport)


# SoS

Expand Down Expand Up @@ -147,6 +148,12 @@ Ubuntu (14.04 LTS and above) users install via apt:

```
# sudo apt install sosreport
```

### Snap Installation

```
# snap install sosreport --classic
```

[0]: https://github.com/sosreport/sos/wiki/Contribution-Guidelines
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
version = '4.5.5'
version = '4.5.6'
# The full version, including alpha/beta/rc tags.
release = '4.5.5'
release = '4.5.6'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion man/en/sos-clean.1
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ on the system from a previous execution.

.SH MAINTAINER
.nf
Jake Hunsaker <jhunsake@redhat.com>
Maintained on GitHub at https://github.com/sosreport/sos
.fi
.SH AUTHORS & CONTRIBUTORS
See \fBAUTHORS\fR file in the package documentation.
6 changes: 5 additions & 1 deletion man/en/sos-collect.1
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,8 @@ Sosreport option. Override the default compression type.
.BR sos.conf (5)

.SH MAINTAINER
Jake Hunsaker <[email protected]>
.nf
Maintained on GitHub at https://github.com/sosreport/sos
.fi
.SH AUTHORS & CONTRIBUTORS
See \fBAUTHORS\fR file in the package documentation.
2 changes: 1 addition & 1 deletion man/en/sos-report.1
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ Display usage message.

.SH MAINTAINER
.nf
Jake Hunsaker <jhunsake@redhat.com>
Maintained on GitHub at https://github.com/sosreport/sos
.fi
.SH AUTHORS & CONTRIBUTORS
See \fBAUTHORS\fR file in the package documentation.
Expand Down
2 changes: 1 addition & 1 deletion man/en/sos.1
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Display usage message.
.BR sos.conf (5)
.SH MAINTAINER
.nf
Jake Hunsaker <jhunsake@redhat.com>
Maintained on GitHub at https://github.com/sosreport/sos
.fi
.SH AUTHORS & CONTRIBUTORS
See \fBAUTHORS\fR file in the package documentation.
1 change: 1 addition & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ parts:
- python3
- snapcraft
- gettext
- python3-venv
stage-packages:
- python3.10-minimal
- libpython3.10-minimal
Expand Down
5 changes: 4 additions & 1 deletion sos.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 4.5.5
Version: 4.5.6
Release: 1%{?dist}
Source0: https://github.com/sosreport/sos/archive/%{name}-%{version}.tar.gz
License: GPL-2.0-or-later
Expand Down Expand Up @@ -86,6 +86,9 @@ rm -rf %{buildroot}/usr/config/
%config(noreplace) %{_sysconfdir}/sos/sos.conf

%changelog
* Thu Jul 20 2023 Jake Hunsaker <[email protected]> = 4.5.6
- New upstream release

* Fri Jun 23 2023 Jake Hunsaker <[email protected]> = 4.5.5
- New upstream release

Expand Down
2 changes: 1 addition & 1 deletion sos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
This module houses the i18n setup and message function. The default is to use
gettext to internationalize messages.
"""
__version__ = "4.5.5"
__version__ = "4.5.6"

import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion sos/cleaner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def obfuscate_file(self, filename, short_name=None, arc_name=None):
% (short_name, err), caller=arc_name)
tfile.seek(0)
if subs:
shutil.copy(tfile.name, filename)
shutil.copyfile(tfile.name, filename)
tfile.close()

_ob_short_name = self.obfuscate_string(short_name.split('/')[-1])
Expand Down
6 changes: 6 additions & 0 deletions sos/cleaner/archives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
def extract_archive(archive_path, tmpdir):
archive = tarfile.open(archive_path)
path = os.path.join(tmpdir, 'cleaner')
# set extract filter since python 3.12 (see PEP-706 for more)
# Because python 3.10 and 3.11 raises false alarms as exceptions
# (see #3330 for examples), we can't use data filter but must
# fully trust the archive (legacy behaviour)
archive.extraction_filter = getattr(tarfile, 'fully_trusted_filter',
(lambda member, path: member))
archive.extractall(path)
archive.close()
return os.path.join(path, archive.name.split('/')[-1].split('.tar')[0])
Expand Down
2 changes: 1 addition & 1 deletion sos/cleaner/mappings/mac_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ def sanitize_item(self, item):
if re.match('(([0-9a-fA-F]{4}:){3}([0-9a-fA-F]){4})', item):
return self.mac6_quad_template % hextets
# match 48-bit IPv4 MAC addresses
if re.match('([0-9a-fA-F]:?){12}', item):
if re.match('([0-9a-fA-F][:_]?){12}', item):
return self.mac_template % hextets
4 changes: 2 additions & 2 deletions sos/cleaner/parsers/mac_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
)
# aa:bb:cc:dd:ee:ff avoiding ipv6 substring matches
IPV4_REG = (
r'((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-])?([0-9a-fA-F]{2}([:-])){5}'
r'([0-9a-fA-F]){2}(\'|\")?(\/|\,|\-|\.|\s|$)))'
r'((?<!([0-9a-fA-F\'\"]:)|::)'
r'(([^:\-])?(([0-9a-fA-F]{2}([:\-\_])){5,6}([0-9a-fA-F]{2}))))'
)


Expand Down
2 changes: 1 addition & 1 deletion sos/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _update_from_section(section, config):
try:
try:
with open(config_file) as f:
config.readfp(f)
config.read_file(f, config_file)
except DuplicateOptionError as err:
raise exit("Duplicate option '%s' in section '%s' in file %s"
% (err.option, err.section, config_file))
Expand Down
16 changes: 12 additions & 4 deletions sos/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,18 @@ def _get_eth_devs(self, namespace=None):
filt_devs = ['bonding_masters']
_eth_devs = []
if not namespace:
_eth_devs = [
dev for dev in listdir('/sys/class/net', self.opts.sysroot)
if dev not in filt_devs
]
try:
# Override checking sysroot here, as network devices will not
# be under the sysroot in live environments or in containers
# that are correctly setup to collect from the host
_eth_devs = [
dev for dev in listdir('/sys/class/net', None)
if dev not in filt_devs
]
except Exception as err:
self.soslog.warning(
f'Failed to manually determine network devices: {err}'
)
else:
try:
_nscmd = "ip netns exec %s ls /sys/class/net" % namespace
Expand Down
7 changes: 4 additions & 3 deletions sos/report/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def set_value(self, val):
if type('') in self.val_type:
self.value = str(val)
return
if not any([type(val) == _t for _t in self.val_type]):
if not any([type(val) is _t for _t in self.val_type]):
valid = []
for t in self.val_type:
if t is None:
Expand Down Expand Up @@ -1274,12 +1274,13 @@ def do_file_sub(self, srcpath, regexp, subst):
"""
try:
path = self._get_dest_for_srcpath(srcpath)
common_flags = re.IGNORECASE | re.MULTILINE
if hasattr(regexp, "pattern"):
pattern = regexp.pattern
flags = regexp.flags | re.IGNORECASE
flags = regexp.flags | common_flags
else:
pattern = regexp
flags = re.IGNORECASE
flags = common_flags
self._log_debug("substituting scrpath '%s'" % srcpath)
self._log_debug("substituting '%s' for '%s' in '%s'"
% (subst, pattern, path))
Expand Down
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CephAnsible(Plugin, RedHatPlugin, DebianPlugin):
short_desc = 'CEPH distributed storage - Ansible installer'

plugin_name = 'ceph_ansible'
profiles = ('storage',)
profiles = ('storage', 'ceph')

packages = ('ceph-ansible',)

Expand Down
73 changes: 40 additions & 33 deletions sos/report/plugins/ceph_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Ceph_Common(Plugin, RedHatPlugin, UbuntuPlugin):
short_desc = 'CEPH common'

plugin_name = 'ceph_common'
profiles = ('storage', 'virt', 'container')
profiles = ('storage', 'virt', 'container', 'ceph')

containers = ('ceph-(.*-)?(mon|rgw|osd).*',)
ceph_hostname = gethostname()
Expand All @@ -27,7 +27,6 @@ class Ceph_Common(Plugin, RedHatPlugin, UbuntuPlugin):
'libcephfs1',
'ceph-fs-common',
'calamari-server',
'librados2'
)

services = (
Expand All @@ -41,45 +40,53 @@ class Ceph_Common(Plugin, RedHatPlugin, UbuntuPlugin):

# This check will enable the plugin regardless of being
# containerized or not
files = ('/etc/ceph/ceph.conf',)
files = ('/etc/ceph/ceph.conf',
'/var/snap/microceph/*',)

def setup(self):
all_logs = self.get_option("all_logs")

self.add_file_tags({
'.*/ceph.conf': 'ceph_conf',
'/var/log/ceph(.*)?/ceph.log.*': 'ceph_log',
})

if not all_logs:
self.add_copy_spec("/var/log/calamari/*.log",)
microceph_pkg = self.policy.package_manager.pkg_by_name('microceph')
if not microceph_pkg:
self.add_file_tags({
'.*/ceph.conf': 'ceph_conf',
'/var/log/ceph(.*)?/ceph.log.*': 'ceph_log',
})

if not all_logs:
self.add_copy_spec("/var/log/calamari/*.log",)
else:
self.add_copy_spec("/var/log/calamari",)

self.add_copy_spec([
"/var/log/ceph/**/ceph.log",
"/var/log/ceph/**/ceph.audit.log*",
"/var/log/calamari/*.log",
"/etc/ceph/",
"/etc/calamari/",
"/var/lib/ceph/tmp/",
])

self.add_forbidden_path([
"/etc/ceph/*keyring*",
"/var/lib/ceph/*keyring*",
"/var/lib/ceph/*/*keyring*",
"/var/lib/ceph/*/*/*keyring*",
"/var/lib/ceph/osd",
"/var/lib/ceph/mon",
# Excludes temporary ceph-osd mount location like
# /var/lib/ceph/tmp/mnt.XXXX from sos collection.
"/var/lib/ceph/tmp/*mnt*",
"/etc/ceph/*bindpass*"
])
else:
self.add_copy_spec("/var/log/calamari",)

self.add_copy_spec([
"/var/log/ceph/**/ceph.log",
"/var/log/ceph/**/ceph.audit.log*",
"/var/log/calamari/*.log",
"/etc/ceph/",
"/etc/calamari/",
"/var/lib/ceph/tmp/",
])
self.add_copy_spec([
"/var/snap/microceph/common/logs/ceph.log",
"/var/snap/microceph/common/logs/ceph.audit.log",
])

self.add_cmd_output([
"ceph -v",
])

self.add_forbidden_path([
"/etc/ceph/*keyring*",
"/var/lib/ceph/*keyring*",
"/var/lib/ceph/*/*keyring*",
"/var/lib/ceph/*/*/*keyring*",
"/var/lib/ceph/osd",
"/var/lib/ceph/mon",
# Excludes temporary ceph-osd mount location like
# /var/lib/ceph/tmp/mnt.XXXX from sos collection.
"/var/lib/ceph/tmp/*mnt*",
"/etc/ceph/*bindpass*"
])

# vim: set et ts=4 sw=4 :
2 changes: 1 addition & 1 deletion sos/report/plugins/ceph_iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CephISCSI(Plugin, RedHatPlugin, UbuntuPlugin):
short_desc = "CEPH iSCSI"

plugin_name = "ceph_iscsi"
profiles = ("storage", "virt", "container")
profiles = ("storage", "virt", "container", "ceph")
packages = ("ceph-iscsi",)
services = ("rbd-target-api", "rbd-target-gw")
containers = ("rbd-target-api.*", "rbd-target-gw.*")
Expand Down
4 changes: 2 additions & 2 deletions sos/report/plugins/ceph_mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
short_desc = 'CEPH mds'
plugin_name = 'ceph_mds'
profiles = ('storage', 'virt', 'container')
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
4 changes: 2 additions & 2 deletions sos/report/plugins/ceph_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
short_desc = 'CEPH mgr'

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

def setup(self):
Expand Down
Loading

0 comments on commit d24711c

Please sign in to comment.