diff options
author | David Timber <dxdt@dev.snart.me> | 2022-05-15 21:56:24 +0800 |
---|---|---|
committer | David Timber <dxdt@dev.snart.me> | 2022-05-15 21:56:24 +0800 |
commit | e80babb6e02c647101766c802a0378d12149fda7 (patch) | |
tree | 88132f5bc8cc1111f205e23d9cf01e749fac3be0 /src/palhm/__init__.py | |
parent | f0e3d3ef8f9dad895f7b6bc1768630f0ef17912e (diff) |
Load yaml only for boot-report
Diffstat (limited to 'src/palhm/__init__.py')
-rw-r--r-- | src/palhm/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/palhm/__init__.py b/src/palhm/__init__.py index e34e58a..f9ab9b3 100644 --- a/src/palhm/__init__.py +++ b/src/palhm/__init__.py @@ -1,8 +1,8 @@ +from imp import load_module import platform import sys import time -import yaml from .exceptions import InvalidConfigError import io import json @@ -139,6 +139,8 @@ class BootReport: "More details as follows.") def __init__ (self, jobj: dict): + self.yaml = import_module("yaml") + mua = jobj["mua"] if mua == "mailx": self._mua_f = self._do_send_mailx elif mua == "stdout": self._mua_f = self._do_send_stdout @@ -196,7 +198,7 @@ class BootReport: raise ChildProcessError("systemd-analyze", p.returncode) body["systemd-analyze"] = p.stdout.decode().strip() - yield yaml.dump(root_doc) + yield self.yaml.dump(root_doc) def do_send (self, ctx: GlobalContext) -> int: return self._mua_f(ctx) |