Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
BZ-1203469: Fail to manually import JBoss EAP based products when pro…
Browse files Browse the repository at this point in the history
…duct slot is unknown

If a JBoss EAP 6/AS 7 instance does not include a bin/product.conf file,
it is assumed to be an AS 7 instance. However, if it does include a
product.conf file but the slot value is unknown by the as-7 plug-in, an
attempt is made to determine its type from its home directory name. If
this does not work, discovery is aborted and the JBoss EAP 6 / AS 7
instance can not be imported into inventory.

Even when an AS7 resource is manually added, this same problem occurs.

This fix allows a manual import to be successful even if the product
type can not be determined. A warning is now logged to identify that an
unsupported product was found and the product type falls back to AS.

(cherry picked from commit 0226e3c)

Conflicts:
	modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java

  See [BZ 1300727] for more details, but this commit squashes the following four commits and cherry-picks from 3.1.x->3.3.x
    0b4745e
    5bcfe33
    0a9a4ee
    181b92a

Conflicts:
	modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
  • Loading branch information
loleary authored and spinder committed Mar 8, 2016
1 parent 9411d7c commit d41551f
Showing 1 changed file with 16 additions and 2 deletions.
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
* Copyright (C) 2005-2014 Red Hat, Inc.
* Copyright (C) 2011-2015 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -222,6 +222,12 @@ protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContex
serverPluginConfig.setNativeLocalAuth(hostConfig.isNativeLocalOnly());
pluginConfig.setSimpleValue("realm", hostConfig.getManagementSecurityRealm());
String apiVersion = hostConfig.getDomainApiVersion();
JBossProductType productType = JBossProductType.AS;
try {
productType = JBossProductType.determineJBossProductType(homeDir, apiVersion);
} catch (Exception e) {
log.warn("Managed product type for [" + homeDir + "] could not be determined or is unsupported: " + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
}
JBossProductType productType = JBossProductType.determineJBossProductType(homeDir, apiVersion);
if(productType == JBossProductType.EAP7) {
// Ignore here, use EAP7 / Wildfly 10 plugin to do the detection
Expand Down Expand Up @@ -872,7 +878,15 @@ public ProductInfo getFromRemote() {
try {
String productName = getServerAttribute(connection, "product-name");
if ((productName != null) && !productName.isEmpty())
productType = JBossProductType.getValueByProductName(productName);
try {
productType = JBossProductType.getValueByProductName(productName);
} catch (Exception e) {
// if the product type can not be determined, log a warning
// to indicate that the product may not be supported and
// fall back to a product type of AS.
log.warn("Unknown or unsupported product type for product [" + productName + "]: " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
productType = JBossProductType.AS;
}
else {
Integer apiVersion = getServerAttribute(connection, "management-major-version");
if (apiVersion == 1) {
Expand Down

0 comments on commit d41551f

Please sign in to comment.