From a7c4fa2fa956b5fb3ec0b448c523a421dcbe6a78 Mon Sep 17 00:00:00 2001 From: Siddhant Srivastava <32227121+alter-mage@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:40:35 -0700 Subject: [PATCH] chore: update logging for bootstrap on rollback (#1557) --- .../deployment/bootstrap/BootstrapManager.java | 9 +++++++-- .../greengrass/lifecyclemanager/KernelAlternatives.java | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/aws/greengrass/deployment/bootstrap/BootstrapManager.java b/src/main/java/com/aws/greengrass/deployment/bootstrap/BootstrapManager.java index ae69782850..7a9716a44c 100644 --- a/src/main/java/com/aws/greengrass/deployment/bootstrap/BootstrapManager.java +++ b/src/main/java/com/aws/greengrass/deployment/bootstrap/BootstrapManager.java @@ -177,6 +177,7 @@ public boolean isBootstrapRequired(Map newConfig, Set co } }); if (componentsRequiresBootstrapTask.isEmpty()) { + logger.atInfo().log("No component found with a pending bootstrap task"); // Force restart if // 1. any nucleus config change requires restart or // 2. if any plugin will be removed in the deployment to ensure plugin cleanup @@ -369,6 +370,9 @@ private boolean nucleusConfigValidAndNeedsRestart(Map deployment } } + if (needsRestart) { + logger.atInfo().log("Bootstrap required as some component configs changed"); + } return needsRestart; } @@ -478,8 +482,9 @@ public void deleteBootstrapTaskList(Path persistedTaskFilePath) throws IOExcepti logger.atError().log("No bootstrap task list to delete: the provided file path was null"); return; } - logger.atInfo().kv("filePath", persistedTaskFilePath).log("Deleting bootstrap task list"); - Files.deleteIfExists(persistedTaskFilePath); + if (Files.deleteIfExists(persistedTaskFilePath)) { + logger.atInfo().kv("filePath", persistedTaskFilePath).log("Deleted bootstrap task list"); + } } /** diff --git a/src/main/java/com/aws/greengrass/lifecyclemanager/KernelAlternatives.java b/src/main/java/com/aws/greengrass/lifecyclemanager/KernelAlternatives.java index 78c72d61b3..ade4d36ef7 100644 --- a/src/main/java/com/aws/greengrass/lifecyclemanager/KernelAlternatives.java +++ b/src/main/java/com/aws/greengrass/lifecyclemanager/KernelAlternatives.java @@ -462,6 +462,8 @@ public boolean prepareBootstrapOnRollbackIfNeeded(Context context, return false; } } else { + logger.atInfo().log("No component with a pending rollback bootstrap task found: " + + "No rollback deployment exists or rollback deployment has no bootstrap tasks"); // Bootstrap-on-rollback is not required, so ensure that the task file is deleted. try { bootstrapManager.deleteBootstrapTaskList(rollbackBootstrapTaskFilePath);