imds-generator: do not enable IMDS logic if detect_container() failed

This commit is contained in:
Mike Yuan
2026-07-25 19:37:47 +09:00
committed by Yu Watanabe
parent 37f760f787
commit 8c98dac0dc
+2 -1
View File
@@ -136,7 +136,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
if (arg_enabled < 0) {
Virtualization v = detect_container();
if (v < 0)
log_debug_errno(v, "Container detection failed, ignoring: %m");
return log_error_errno(v, "Container detection failed: %m");
if (v > 0) {
log_debug("Running in a container, disabling IMDS logic.");
arg_enabled = false;
@@ -148,6 +148,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
}
}
assert(arg_enabled >= 0);
if (!arg_enabled) {
log_debug("IMDS not enabled, skipping generator.");
return 0;