diff options
Diffstat (limited to 'cloudinit/config/cc_update_etc_hosts.py')
-rw-r--r-- | cloudinit/config/cc_update_etc_hosts.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cloudinit/config/cc_update_etc_hosts.py b/cloudinit/config/cc_update_etc_hosts.py index 695bc019..c3e5b71e 100644 --- a/cloudinit/config/cc_update_etc_hosts.py +++ b/cloudinit/config/cc_update_etc_hosts.py @@ -8,7 +8,7 @@ """Update Etc Hosts: Update the hosts file (usually ``/etc/hosts``)""" -from logging import Logger +import logging from textwrap import dedent from cloudinit import templater, util @@ -95,11 +95,10 @@ meta: MetaSchema = { } __doc__ = get_meta_doc(meta) +LOG = logging.getLogger(__name__) -def handle( - name: str, cfg: Config, cloud: Cloud, log: Logger, args: list -) -> None: +def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None: manage_hosts = util.get_cfg_option_str(cfg, "manage_etc_hosts", False) hosts_fn = cloud.distro.hosts_fn @@ -113,7 +112,7 @@ def handle( ) (hostname, fqdn, _) = util.get_hostname_fqdn(cfg, cloud) if not hostname: - log.warning( + LOG.warning( "Option 'manage_etc_hosts' was set, but no hostname was found" ) return @@ -135,15 +134,15 @@ def handle( elif manage_hosts == "localhost": (hostname, fqdn, _) = util.get_hostname_fqdn(cfg, cloud) if not hostname: - log.warning( + LOG.warning( "Option 'manage_etc_hosts' was set, but no hostname was found" ) return - log.debug("Managing localhost in %s", hosts_fn) + LOG.debug("Managing localhost in %s", hosts_fn) cloud.distro.update_etc_hosts(hostname, fqdn) else: - log.debug( + LOG.debug( "Configuration option 'manage_etc_hosts' is not set," " not managing %s in module %s", hosts_fn, |