diff options
author | zdc <zdc@users.noreply.github.com> | 2022-03-26 15:41:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 15:41:59 +0200 |
commit | aa60d48c2711cdcd9f88a4e5c77379adb0408231 (patch) | |
tree | 349631a02467dae0158f6f663cc8aa8537974a97 /cloudinit/warnings.py | |
parent | 5c4b3943343a85fbe517e5ec1fc670b3a8566b4b (diff) | |
parent | 31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba (diff) | |
download | vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.tar.gz vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.zip |
Merge pull request #51 from zdc/T2117-sagitta-22.1
T2117: Cloud-init updated to 22.1
Diffstat (limited to 'cloudinit/warnings.py')
-rw-r--r-- | cloudinit/warnings.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/cloudinit/warnings.py b/cloudinit/warnings.py index 1da90c40..7ddd2f8d 100644 --- a/cloudinit/warnings.py +++ b/cloudinit/warnings.py @@ -1,16 +1,16 @@ # This file is part of cloud-init. See LICENSE file for license information. +import os +import time + from cloudinit import helpers from cloudinit import log as logging from cloudinit import util -import os -import time - LOG = logging.getLogger() WARNINGS = { - 'non_ec2_md': """ + "non_ec2_md": """ This system is using the EC2 Metadata Service, but does not appear to be running on Amazon EC2 or one of cloud-init's known platforms that provide a EC2 Metadata service. In the future, cloud-init may stop @@ -35,7 +35,7 @@ putting that content into datasource: Ec2: strict_id: false""", - 'dsid_missing_source': """ + "dsid_missing_source": """ A new feature in cloud-init identified possible datasources for this system as: {dslist} @@ -64,8 +64,9 @@ warnings: def _get_warn_dir(cfg): paths = helpers.Paths( - path_cfgs=cfg.get('system_info', {}).get('paths', {})) - return paths.get_ipath_cur('warnings') + path_cfgs=cfg.get("system_info", {}).get("paths", {}) + ) + return paths.get_ipath_cur("warnings") def _load_warn_cfg(cfg, name, mode=True, sleep=None): @@ -77,7 +78,7 @@ def _load_warn_cfg(cfg, name, mode=True, sleep=None): if not cfg or not isinstance(cfg, dict): return default - ncfg = util.get_cfg_by_path(cfg, ('warnings', name)) + ncfg = util.get_cfg_by_path(cfg, ("warnings", name)) if ncfg is None: return default @@ -128,7 +129,8 @@ def show_warning(name, cfg=None, sleep=None, mode=True, **kwargs): util.write_file( os.path.join(_get_warn_dir(cfg), name), - topline + "\n".join(fmtlines) + "\n" + topline) + topline + "\n".join(fmtlines) + "\n" + topline, + ) LOG.warning("%s%s\n%s", topline, "\n".join(fmtlines), closeline) @@ -136,4 +138,5 @@ def show_warning(name, cfg=None, sleep=None, mode=True, **kwargs): LOG.debug("sleeping %d seconds for warning '%s'", sleep, name) time.sleep(sleep) + # vi: ts=4 expandtab |