Skip to content

Commit

Permalink
[maas] Support MAAS 3.5
Browse files Browse the repository at this point in the history
In MAAS 3.5, system journal is used by all the services, therefore the
log size is significantly increased compared to the previous MAAS
versions. For snap this means that `journalctl` might need a long time
to collect and filter the log files before outputting them.

This sometimes leads to `maas` plugin timeouts with 3.5 snap, as `sos`
performs automatic log collection for services listed in `services`
tuple without any filters other than unit name, unless explicitly
specified by user. We want the plugin to work without additional params,
so we service declaration for 3.5 snap is ommitted. Logs are collected
via `add_journal` call with a sane default limit to avoid timeouts.

Signed-off-by: Igor Brovtsin <[email protected]>
  • Loading branch information
brigaccess authored and TurboTurtle committed Aug 25, 2023
1 parent e11a594 commit d43b980
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sos/report/plugins/maas.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ class Maas(Plugin, UbuntuPlugin):
'maas-rackd',
'maas-regiond',
'maas-syslog',
# For the snap:
# MAAS 3.5 deb:
'maas-temporal',
'maas-apiserver',
'maas-agent',
# For the pre-3.5 snap:
'snap.maas.supervisor',
# MAAS 3.5 snap uses `snap.maas.pebble` service, but it's not
# included here to prevent automatic journald log collection.
)

option_list = [
Expand Down Expand Up @@ -69,6 +75,15 @@ def setup(self):
'snap info maas',
'maas status'
])

if self.is_service("snap.maas.pebble"):
# Because `snap.maas.pebble` is not in the services
# tuple to prevent timeouts caused by log collection,
# service status and logs are collected here.
self.add_service_status("snap.maas.pebble")
since = self.get_option("since") or "-1days"
self.add_journal(units="snap.maas.pebble", since=since)

# Don't send secrets
self.add_forbidden_path("/var/snap/maas/current/bind/session.key")
self.add_copy_spec([
Expand Down

0 comments on commit d43b980

Please sign in to comment.