diff options
Diffstat (limited to 'cloudinit/config/cc_install_hotplug.py')
-rw-r--r-- | cloudinit/config/cc_install_hotplug.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/cloudinit/config/cc_install_hotplug.py b/cloudinit/config/cc_install_hotplug.py index b95b8a4c..621e3be5 100644 --- a/cloudinit/config/cc_install_hotplug.py +++ b/cloudinit/config/cc_install_hotplug.py @@ -1,7 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. """Install hotplug udev rules if supported and enabled""" +import logging import os -from logging import Logger from textwrap import dedent from cloudinit import stages, subp, util @@ -56,6 +56,7 @@ meta: MetaSchema = { } __doc__ = get_meta_doc(meta) +LOG = logging.getLogger(__name__) HOTPLUG_UDEV_PATH = "/etc/udev/rules.d/10-cloud-init-hook-hotplug.rules" @@ -68,9 +69,7 @@ LABEL="cloudinit_end" """ -def handle( - name: str, cfg: Config, cloud: Cloud, log: Logger, args: list -) -> None: +def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None: network_hotplug_enabled = ( "updates" in cfg and "network" in cfg["updates"] @@ -90,19 +89,19 @@ def handle( ) if not (hotplug_supported and hotplug_enabled): if os.path.exists(HOTPLUG_UDEV_PATH): - log.debug("Uninstalling hotplug, not enabled") + LOG.debug("Uninstalling hotplug, not enabled") util.del_file(HOTPLUG_UDEV_PATH) subp.subp(["udevadm", "control", "--reload-rules"]) elif network_hotplug_enabled: - log.warning( + LOG.warning( "Hotplug is unsupported by current datasource. " "Udev rules will NOT be installed." ) else: - log.debug("Skipping hotplug install, not enabled") + LOG.debug("Skipping hotplug install, not enabled") return if not subp.which("udevadm"): - log.debug("Skipping hotplug install, udevadm not found") + LOG.debug("Skipping hotplug install, udevadm not found") return # This may need to turn into a distro property at some point |