diff options
| author | Zuul <zuul@review.opendev.org> | 2021-04-08 12:22:32 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2021-04-08 12:22:32 +0000 |
| commit | 5bac375f73ac417b156516d0dc1ee113896edc54 (patch) | |
| tree | 430cdc8ed32b25eedebfcf7233ebdfa6564e3f10 /ironic_python_agent/utils.py | |
| parent | fcb65cae18f4a6b4b05fb70677e2fa114e0558a9 (diff) | |
| parent | df418984f037856813b6bc5e495ef602a6737ee3 (diff) | |
| download | ironic-python-agent-5bac375f73ac417b156516d0dc1ee113896edc54.tar.gz | |
Merge "Capture the early logging"
Diffstat (limited to 'ironic_python_agent/utils.py')
| -rw-r--r-- | ironic_python_agent/utils.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py index 63d22e76..03de236c 100644 --- a/ironic_python_agent/utils.py +++ b/ironic_python_agent/utils.py @@ -78,6 +78,8 @@ DEVICE_EXTRACTOR = re.compile(r'^(?:(.*\d)p|(.*\D))(?:\d+)$') PARTED_TABLE_TYPE_REGEX = re.compile(r'^.*partition\s+table\s*:\s*(gpt|msdos)', re.IGNORECASE) +_EARLY_LOG_BUFFER = [] + def execute(*cmd, **kwargs): """Convenience wrapper around ironic_lib's execute() method. @@ -187,7 +189,16 @@ def _get_vmedia_params(): def _early_log(msg, *args): """Log via printing (before oslo.log is configured).""" - print('ironic-python-agent:', msg % args, file=sys.stderr) + log_entry = msg % args + _EARLY_LOG_BUFFER.append(log_entry) + print('ironic-python-agent:', log_entry, file=sys.stderr) + + +def log_early_log_to_logger(): + """Logs early logging events to the configured logger.""" + + for entry in _EARLY_LOG_BUFFER: + LOG.info("Early logging: %s", entry) def _copy_config_from(path): |
