summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java/org
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-13 10:18:48 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-13 21:51:07 -0500
commit4974a05441d412a6e812e5716a0518e9e12a9acf (patch)
treee2aa245ea30c7f6576ff306ec201b90f3a44cfcf /adapters/mso-openstack-adapters/src/main/java/org
parent641d9e6b68a964dc69dbec7c63f82e73b61433e2 (diff)
Strip off TenantId from self link url
Strip off TenantId from self link url Change-Id: I58ac9fe693059eb8cb93d85fb88604cb9c0a0db2 Issue-ID: SO-1502 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 974315374a..dfe5912fbf 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -25,6 +25,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -174,11 +176,13 @@ public class HeatStackAudit {
return vserversToAudit;
}
- protected Optional<String> extractResourcePathFromHref(String href) {
- URI uri;
+ protected Optional<String> extractResourcePathFromHref(String href) {
try {
- uri = new URI(href);
- return Optional.of(uri.getPath().replaceFirst("/v\\d+", "")+RESOURCES);
+ Optional<String> stackPath = extractStackPathFromHref(href);
+ if (stackPath.isPresent()){
+ return Optional.of(stackPath.get()+RESOURCES);
+ }else
+ return Optional.empty();
} catch (Exception e) {
logger.error("Error parsing URI", e);
}
@@ -186,10 +190,14 @@ public class HeatStackAudit {
}
protected Optional<String> extractStackPathFromHref(String href) {
- URI uri;
try {
- uri = new URI(href);
- return Optional.of(uri.getPath().replaceFirst("/v\\d+", ""));
+ URI uri = new URI(href);
+ Pattern p = Pattern.compile("/stacks.*");
+ Matcher m = p.matcher(uri.getPath());
+ if (m.find()){
+ return Optional.of(m.group());
+ }else
+ return Optional.empty();
} catch (Exception e) {
logger.error("Error parsing URI", e);
}