diff options
| author | zdc <zdc@users.noreply.github.com> | 2022-04-07 20:24:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-07 20:24:57 +0300 |
| commit | 45c1d42e15f4a5fe5e176e1516b2da9d21e7837a (patch) | |
| tree | 0535c3cf76b60dbf585416b4490c5bd9c9c99359 /cloudinit/warnings.py | |
| parent | 96226f37cdbdaef2fbc51de7b9ca75b61a16792b (diff) | |
| parent | aa60d48c2711cdcd9f88a4e5c77379adb0408231 (diff) | |
| download | vyos-cloud-init-45c1d42e15f4a5fe5e176e1516b2da9d21e7837a.tar.gz vyos-cloud-init-45c1d42e15f4a5fe5e176e1516b2da9d21e7837a.zip | |
Merge pull request #52 from vyos/current
T2117: Backport Cloud-init 22.1 with our changes to VyOS 1.3
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 |
