PATH:
usr
/
lib
/
python3.9
/
site-packages
/
cloudinit
# Copyright (C) 2012 Canonical Ltd. # Copyright (C) 2012 Yahoo! Inc. # # Author: Scott Moser <scott.moser@canonical.com> # Author: Joshua Harlow <harlowja@yahoo-inc.com> # # This file is part of cloud-init. See LICENSE file for license information. import inspect import logging import signal import sys from io import StringIO from cloudinit import version as vr from cloudinit.log import log_util LOG = logging.getLogger(__name__) BACK_FRAME_TRACE_DEPTH = 3 EXIT_FOR = { signal.SIGINT: ("Cloud-init %(version)s received SIGINT, exiting...", 1), signal.SIGTERM: ("Cloud-init %(version)s received SIGTERM, exiting...", 1), # Can't be caught... # signal.SIGKILL: ('Cloud-init killed, exiting...', 1), signal.SIGABRT: ("Cloud-init %(version)s received SIGABRT, exiting...", 1), } def _pprint_frame(frame, depth, max_depth, contents): if depth > max_depth or not frame: return frame_info = inspect.getframeinfo(frame) prefix = " " * (depth * 2) contents.write("%sFilename: %s\n" % (prefix, frame_info.filename)) contents.write("%sFunction: %s\n" % (prefix, frame_info.function)) contents.write("%sLine number: %s\n" % (prefix, frame_info.lineno)) _pprint_frame(frame.f_back, depth + 1, max_depth, contents) def _handle_exit(signum, frame): (msg, rc) = EXIT_FOR[signum] msg = msg % ({"version": vr.version_string()}) contents = StringIO() contents.write("%s\n" % (msg)) _pprint_frame(frame, 1, BACK_FRAME_TRACE_DEPTH, contents) log_util.multi_log(contents.getvalue(), log=LOG, log_level=logging.ERROR) sys.exit(rc) def attach_handlers(): sigs_attached = 0 for signum in EXIT_FOR.keys(): signal.signal(signum, _handle_exit) sigs_attached += len(EXIT_FOR) return sigs_attached
[+]
__pycache__
[-] util.py
[edit]
[+]
mergers
[-] cloud.py
[edit]
[-] ssh_util.py
[edit]
[-] gpg.py
[edit]
[+]
reporting
[-] importer.py
[edit]
[-] subp.py
[edit]
[-] helpers.py
[edit]
[-] persistence.py
[edit]
[-] atomic_helper.py
[edit]
[-] type_utils.py
[edit]
[-] lifecycle.py
[edit]
[-] stages.py
[edit]
[+]
distros
[-] user_data.py
[edit]
[-] version.py
[edit]
[+]
analyze
[-] warnings.py
[edit]
[-] settings.py
[edit]
[-] simpletable.py
[edit]
[-] apport.py
[edit]
[-] performance.py
[edit]
[+]
config
[+]
log
[-] signal_handler.py
[edit]
[-] features.py
[edit]
[-] netinfo.py
[edit]
[-] event.py
[edit]
[+]
cmd
[-] temp_utils.py
[edit]
[-] url_helper.py
[edit]
[-] socket.py
[edit]
[-] registry.py
[edit]
[+]
sources
[+]
handlers
[-] safeyaml.py
[edit]
[-] templater.py
[edit]
[+]
net
[+]
..
[+]
filters
[-] dmi.py
[edit]
[-] __init__.py
[edit]