Skip to content

Commit

Permalink
Check for available EngId before using arch
Browse files Browse the repository at this point in the history
  • Loading branch information
kflahert committed Oct 16, 2023
1 parent 5e942d6 commit f4ae1d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Collection;
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.candlepin.subscriptions.ApplicationProperties;
import org.candlepin.subscriptions.db.model.HardwareMeasurementType;
import org.candlepin.subscriptions.db.model.HostHardwareType;
Expand Down Expand Up @@ -329,7 +330,8 @@ private void handleSla(
private void normalizeQpcFacts(NormalizedFacts normalizedFacts, InventoryHostFacts hostFacts) {
// Check if this is a RHEL host and set product.
if (hostFacts.getQpcProducts() != null && hostFacts.getQpcProducts().contains("RHEL")) {
if (hostFacts.getSystemProfileArch() != null) {
if (hostFacts.getSystemProfileArch() != null
&& CollectionUtils.isEmpty(hostFacts.getQpcProductIds())) {
switch (hostFacts.getSystemProfileArch()) {
case "x86_64", "i686", "i386":
normalizedFacts.addProduct("RHEL for x86");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,14 @@ void testQpcSystemArchSetRhelForIbmPower() {
assertThat(normalized.getProducts(), Matchers.hasItem("RHEL for IBM Power"));
}

@Test
void testQpcProductIdFromEngId() {
var host = createQpcHost("RHEL", "Test", clock.now());
host.setQpcProductIds("69");
NormalizedFacts normalized = normalizer.normalize(host, hypervisorData());
assertThat(normalized.getProducts(), Matchers.hasItem("RHEL for x86"));
}

private void assertClassification(
NormalizedFacts check, boolean isHypervisor, boolean isHypervisorUnknown, boolean isVirtual) {
assertEquals(isHypervisor, check.isHypervisor());
Expand Down

0 comments on commit f4ae1d9

Please sign in to comment.