Skip to content

Commit

Permalink
feat: warning log for discontinued component (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-mage authored and indougnito committed Nov 2, 2022
1 parent b45ab27 commit fa79548
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<!--
Do not upgrade this version without additional testing. Newer versions have incompatible
serialization changes.
https://github.com/aws/aws-sdk-java-v2/issues/3127
-->
<version>2.17.81</version>
<version>2.17.295</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -134,7 +129,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>greengrassv2-data</artifactId>
<version>2.15.x-SNAPSHOT</version>
<version>2.17.x-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fa79548

Please sign in to comment.