This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git


The following commit(s) were added to refs/heads/master by this push:
     new f3450ee  add more detail on the features/bundles installed
f3450ee is described below

commit f3450ee20a18d759ba2517731212f28f12ec7885
Author: Alex Heneveld <[email protected]>
AuthorDate: Mon Sep 20 23:08:40 2021 +0100

    add more detail on the features/bundles installed
---
 .../main/java/org/apache/brooklyn/core/BrooklynVersion.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java 
b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
index df70ce3..0ba4a5c 100644
--- a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
+++ b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
@@ -379,6 +379,15 @@ public class BrooklynVersion implements 
BrooklynVersionService {
             return newFeature(headers);
         }
 
+        private static void ifHeaderAddKey(Dictionary<String, String> headers, 
String header, Map<String, String> additionalData, String key) {
+            if (!additionalData.containsKey(key)) {
+                String v = headers.get(header);
+                if (v!=null && !v.toLowerCase().equals("unknown")) {
+                    additionalData.put(key, headers.get(header));
+                }
+            }
+        }
+
         /** @return Present if any attribute name begins with {@link 
#BROOKLYN_FEATURE_PREFIX}, absent otherwise. */
         private static Optional<BrooklynFeature> 
newFeature(Dictionary<String,String> headers) {
             Map<String, String> additionalData = Maps.newHashMap();
@@ -401,6 +410,9 @@ public class BrooklynVersion implements 
BrooklynVersionService {
                     .or(Optional.fromNullable(Constants.BUNDLE_NAME))
                     .or(headers.get(Constants.BUNDLE_SYMBOLICNAME));
 
+            ifHeaderAddKey(headers, "Implementation-SHA-1", additionalData, 
"buildSha1");
+            ifHeaderAddKey(headers, "Implementation-Branch", additionalData, 
"buildBranch");
+
             return Optional.of(new BrooklynFeature(
                     name,
                     headers.get(Constants.BUNDLE_SYMBOLICNAME),

Reply via email to