From 274b946262d1685d643da5b93854d37ec6e7bd08 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Thu, 17 Mar 2022 10:25:45 +0100 Subject: [PATCH] cmd/status: Check for proper file for stats from cloud-init-generator cloud-init-generator creates `/enabled` when it enables cloud-init and removes it when it disables. Nothing creates `/disabled`. So the status should check for the non existance of `/enabled` instead of the existance of `/disabled` to check that cloud-init-generator has disabled it. --- cloudinit/cmd/status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinit/cmd/status.py b/cloudinit/cmd/status.py index 5176549dd51..5d9824ae7db 100644 --- a/cloudinit/cmd/status.py +++ b/cloudinit/cmd/status.py @@ -103,7 +103,7 @@ def _is_cloudinit_disabled(disable_file, paths): elif "cloud-init=disabled" in cmdline_parts: is_disabled = True reason = "Cloud-init disabled by kernel parameter cloud-init=disabled" - elif os.path.exists(os.path.join(paths.run_dir, "disabled")): + elif not os.path.exists(os.path.join(paths.run_dir, "enabled")): is_disabled = True reason = "Cloud-init disabled by cloud-init-generator" elif os.path.exists(os.path.join(paths.run_dir, "enabled")):