From fa79548fe7c2ba5780554f17e86702842f0bc673 Mon Sep 17 00:00:00 2001
From: Siddhant Srivastava <32227121+alter-mage@users.noreply.github.com>
Date: Tue, 1 Nov 2022 09:42:25 -0700
Subject: [PATCH] feat: warning log for discontinued component (#1349)
---
pom.xml | 9 ++-------
.../greengrass/componentmanager/ComponentManager.java | 10 ++++++++++
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index e57511b940..fc3dbb6e24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,12 +28,7 @@
software.amazon.awssdk
bom
-
- 2.17.81
+ 2.17.295
pom
import
@@ -134,7 +129,7 @@
software.amazon.awssdk
greengrassv2-data
- 2.15.x-SNAPSHOT
+ 2.17.x-SNAPSHOT
software.amazon.awssdk
diff --git a/src/main/java/com/aws/greengrass/componentmanager/ComponentManager.java b/src/main/java/com/aws/greengrass/componentmanager/ComponentManager.java
index ae94ea9a86..5ab2a4b0f8 100644
--- a/src/main/java/com/aws/greengrass/componentmanager/ComponentManager.java
+++ b/src/main/java/com/aws/greengrass/componentmanager/ComponentManager.java
@@ -47,6 +47,7 @@
import software.amazon.awssdk.http.HttpStatusCode;
import software.amazon.awssdk.services.greengrassv2data.model.GreengrassV2DataException;
import software.amazon.awssdk.services.greengrassv2data.model.ResolvedComponentVersion;
+import software.amazon.awssdk.services.greengrassv2data.model.VendorGuidance;
import java.io.File;
import java.io.IOException;
@@ -206,6 +207,15 @@ private ComponentIdentifier negotiateVersionWithCloud(String componentName,
resolvedComponentVersion = RetryUtils.runWithRetry(clientExceptionRetryConfig,
() -> componentServiceHelper.resolveComponentVersion(componentName, null, versionRequirements),
"resolve-component-version", logger);
+
+ VendorGuidance vendorGuidance = resolvedComponentVersion.vendorGuidance();
+ if (VendorGuidance.DISCONTINUED.equals(vendorGuidance)) {
+ logger.atWarn().kv(COMPONENT_NAME, componentName)
+ .kv("componentVersion", resolvedComponentVersion.componentVersion())
+ .kv("versionRequirements", versionRequirements).log("This component version has been"
+ + " discontinued by its publisher. You can deploy this component version, but we"
+ + " recommend that you use a different version of this component");
+ }
} catch (InterruptedException e) {
throw e;
} catch (NoAvailableComponentVersionException e) {