use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SubscriptionManagerTasks method service_level.
/**
* "subscription-manager service-level"
* @param show
* @param list
* @param set
* @param unset TODO
* @param username
* @param password
* @param org
* @param serverurl TODO
* @param insecure TODO
* @param proxy
* @param proxyuser
* @param proxypassword
* @param noproxy TODO
* @return
*/
public SSHCommandResult service_level(Boolean show, Boolean list, String set, Boolean unset, String username, String password, String org, String serverurl, Boolean insecure, String proxy, String proxyuser, String proxypassword, String noproxy) {
SSHCommandResult sshCommandResult = service_level_(show, list, set, unset, username, password, org, serverurl, insecure, proxy, proxyuser, proxypassword, noproxy);
if (Boolean.valueOf(System.getProperty("sm.server.old", "false"))) {
Assert.assertEquals(sshCommandResult.getStderr().trim(), "ERROR: The service-level command is not supported by the server.");
throw new SkipException(sshCommandResult.getStderr().trim());
}
// assert the banner
String bannerRegex = "\\+-+\\+\\n\\s*Available Service Levels\\s*\\n\\+-+\\+";
if (list != null && list) {
// when explicitly asked to list
Assert.assertTrue(Pattern.compile(".*" + bannerRegex + ".*", Pattern.DOTALL).matcher(sshCommandResult.getStdout()).find(), "Stdout from service-level (with option --list) contains the expected banner regex: " + bannerRegex);
} else {
Assert.assertTrue(!Pattern.compile(".*" + bannerRegex + ".*", Pattern.DOTALL).matcher(sshCommandResult.getStdout()).find(), "Stdout from service-level (without option --list) does not contain the banner regex: " + bannerRegex);
}
// assert the "Current service level: "
String serviceLevelMsg = "Current service level: ";
// Bug 825286 - subscription-manager service-level --show
String serviceLevelNotSetMsg = "Service level preference not set";
if (// when explicitly asked to show
(show != null && show) || ((show == null || !show) && (list == null || !list) && (set == null) && (unset == null || !unset))) {
// or when no options are explicity asked, then the default behavior is --show
if (!sshCommandResult.getStdout().contains(serviceLevelNotSetMsg)) {
Assert.assertTrue(sshCommandResult.getStdout().contains(serviceLevelMsg), "Stdout from service-level (with option --show) contains the expected feedback: " + serviceLevelMsg);
} else {
Assert.assertTrue(!sshCommandResult.getStdout().contains(serviceLevelMsg), "Stdout from service-level (without option --show) does not contain feedback: " + serviceLevelNotSetMsg);
}
}
// assert the "Service level set to: "
String serviceLevelSetMsg = "Service level set to: ";
if (set != null && !set.isEmpty()) {
Assert.assertTrue(sshCommandResult.getStdout().contains(serviceLevelSetMsg + set), "Stdout from service-level (with option --set) contains the expected feedback: " + serviceLevelSetMsg + set);
} else {
// TEMPORARY WORKAROUND FOR BUG
boolean invokeWorkaroundWhileBugIsOpen = true;
try {
String bugId = "835050";
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping service-level unset feedback message while this bug is open.");
} else
// END OF WORKAROUND
Assert.assertTrue(!sshCommandResult.getStdout().contains(serviceLevelSetMsg), "Stdout from service-level (without option --set) does not contain feedback: " + serviceLevelSetMsg);
}
// assert the "Service level preference has been unset"
String serviceLevelUnsetMsg = "Service level preference has been unset";
if ((unset != null && unset) || (set != null && set.isEmpty())) {
Assert.assertTrue(sshCommandResult.getStdout().contains(serviceLevelUnsetMsg), "Stdout from service-level (with option --unset) contains the expected feedback: " + serviceLevelUnsetMsg);
} else {
Assert.assertTrue(!sshCommandResult.getStdout().contains(serviceLevelUnsetMsg), "Stdout from service-level (without option --unset) does not contain the feedback: " + serviceLevelUnsetMsg);
}
// assert the exit code was a success
Assert.assertEquals(sshCommandResult.getExitCode(), Integer.valueOf(0), "The exit code from the service-level command indicates a success.");
// from the service-level command
return sshCommandResult;
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SubscriptionManagerTasks method unsubscribe.
/**
* unsubscribe and assert all results are successful
* @param poolIds TODO
* @param noproxy TODO
*/
public SSHCommandResult unsubscribe(Boolean all, List<BigInteger> serials, List<String> poolIds, String proxy, String proxyuser, String proxypassword, String noproxy) {
SSHCommandResult sshCommandResult = unsubscribe_(all, serials, poolIds, proxy, proxyuser, proxypassword, noproxy);
// assert results
Assert.assertEquals(sshCommandResult.getExitCode(), Integer.valueOf(0), "The exit code from the unsubscribe command indicates a success.");
// TEMPORARY WORKAROUND
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1287610 - yum message in output when FIPS is enabled
String bugId = "1287610";
try {
if (redhatReleaseX.equals("7") && isFipsEnabled && invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping the stderr assertion from unsubscribe on rhel '" + redhatReleaseXY + "' while FIPS bug '" + bugId + "' is open");
} else
// END OF WORKAROUND
Assert.assertEquals(sshCommandResult.getStderr(), "", "Stderr from the unsubscribe.");
return sshCommandResult;
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SubscriptionManagerTasks method unsubscribeFromSerialNumber.
/**
* unsubscribe from entitlement certificate serial and assert results
* @param serialNumber
* @return - false when no unsubscribe took place
*/
public boolean unsubscribeFromSerialNumber(BigInteger serialNumber) {
String certFilePath = entitlementCertDir + "/" + serialNumber + ".pem";
String certKeyFilePath = entitlementCertDir + "/" + serialNumber + "-key.pem";
File certFile = new File(certFilePath);
boolean certFileExists = RemoteFileTasks.testExists(sshCommandRunner, certFilePath);
if (certFileExists)
Assert.assertTrue(RemoteFileTasks.testExists(sshCommandRunner, certKeyFilePath), "Entitlement Certificate file with serial '" + serialNumber + "' (" + certFilePath + ") and corresponding key file (" + certKeyFilePath + ") exist before unsubscribing.");
List<File> beforeEntitlementCertFiles = getCurrentEntitlementCertFiles();
log.info("Attempting to unsubscribe from certificate serial: " + serialNumber);
SSHCommandResult result = unsubscribe_(false, serialNumber, null, null, null, null, null);
// assert the results
String expectedStdoutMsg;
if (!certFileExists) {
String regexForSerialNumber = serialNumber.toString();
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=639320 - jsefler 10/1/2010
boolean invokeWorkaroundWhileBugIsOpen = true;
String bugId = "639320";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
regexForSerialNumber = "[\\d,]*";
}
// END OF WORKAROUND
// Assert.assertContainsMatch(result.getStderr(), "Entitlement Certificate with serial number "+regexForSerialNumber+" could not be found.",
// "Stderr from an attempt to unsubscribe from Entitlement Certificate serial "+serialNumber+" that was not found in "+entitlementCertDir);
// Assert.assertContainsMatch(result.getStdout(), "Entitlement Certificate with serial number "+regexForSerialNumber+" could not be found.",
// "Stdout from an attempt to unsubscribe from Entitlement Certificate serial "+serialNumber+" that was not found in "+entitlementCertDir);
// Assert.assertEquals(result.getExitCode(), Integer.valueOf(255), "The unsubscribe should fail when its corresponding entitlement cert file ("+certFilePath+") does not exist.");
// added by bug 867766
expectedStdoutMsg = "Unsuccessfully unsubscribed serial numbers:";
// changed by bug 874749
expectedStdoutMsg = "Unsuccessfully removed serial numbers:";
// changed by bug 895447 subscription-manager commit 8e10e76fb5951e0b5d6c867c6c7209d8ec80dead
expectedStdoutMsg = "Serial numbers unsuccessfully removed at the server:";
// commit f64d5a6b012f49bb4d6d6653441d4de9bf373660 1319678: Alter the return message for removing entitlements at server
if (isPackageVersion("subscription-manager", ">=", "1.17.8-1"))
expectedStdoutMsg = "The entitlement server failed to remove these serial numbers:";
Assert.assertTrue(result.getStdout().contains(expectedStdoutMsg), "Stdout from unsubscribe contains expected message: " + expectedStdoutMsg);
if (isPackageVersion("subscription-manager", ">=", "1.16.6-1")) {
// commit 0d80caacf5e9483d4f10424030d6a5b6f472ed88 1285004: Adds check for access to the required manager capabilty
// [root@jsefler-6 ~]# subscription-manager remove --serial 8375727538260415740 --serial 2872676222813362535
// Serial numbers unsuccessfully removed at the server:
// 2872676222813362535
// 8375727538260415740
String expectedStdoutRegex = expectedStdoutMsg + "(?:\\n \\d+)*?\\n " + serialNumber;
Assert.assertContainsMatch(result.getStdout(), expectedStdoutRegex);
} else {
expectedStdoutMsg = " Entitlement Certificate with serial number " + serialNumber + " could not be found.";
expectedStdoutMsg = " Entitlement Certificate with serial number '" + serialNumber + "' could not be found.";
Assert.assertTrue(result.getStdout().contains(expectedStdoutMsg), "Stdout from unsubscribe contains expected message: " + expectedStdoutMsg);
}
// TEMPORARY WORKAROUND
invokeWorkaroundWhileBugIsOpen = true;
// Bug 1287610 - yum message in output when FIPS is enabled
bugId = "1287610";
try {
if (redhatReleaseX.equals("7") && isFipsEnabled && invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping the stderr assertion from unsubscribe on rhel '" + redhatReleaseXY + "' while FIPS bug '" + bugId + "' is open");
} else
// END OF WORKAROUND
Assert.assertEquals(result.getStderr(), "", "Stderr from unsubscribe.");
// changed by bug 873791
Assert.assertEquals(result.getExitCode(), Integer.valueOf(1), "ExitCode from unsubscribe when the serial's entitlement cert file (" + certFilePath + ") does not exist.");
return false;
}
// assert the entitlement certFilePath is removed
Assert.assertTrue(!RemoteFileTasks.testExists(sshCommandRunner, certFilePath), "Entitlement Certificate with serial '" + serialNumber + "' (" + certFilePath + ") has been removed.");
// assert the entitlement certKeyFilePath is removed
// TEMPORARY WORKAROUND FOR BUG: https://bugzilla.redhat.com/show_bug.cgi?id=708362 - jsefler 08/25/2011
boolean invokeWorkaroundWhileBugIsOpen = true;
String bugId = "708362";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
boolean assertCertKeyFilePathIsRemoved = true;
if (invokeWorkaroundWhileBugIsOpen)
log.warning("Skipping the assertion that the Entitlement Certificate key with serial '" + serialNumber + "' (" + certKeyFilePath + ") has been removed while bug is open.");
else
// END OF WORKAROUND
Assert.assertTrue(!RemoteFileTasks.testExists(sshCommandRunner, certKeyFilePath), "Entitlement Certificate key with serial '" + serialNumber + "' (" + certKeyFilePath + ") has been removed.");
// assert that only ONE entitlement cert file was removed
List<File> afterEntitlementCertFiles = getCurrentEntitlementCertFiles();
Assert.assertTrue(afterEntitlementCertFiles.size() == beforeEntitlementCertFiles.size() - 1, "Only ONE entitlement certificate has been removed (count was '" + beforeEntitlementCertFiles.size() + "'; is now '" + afterEntitlementCertFiles.size() + "') after unsubscribing from serial: " + serialNumber);
// assert that the other cert files remain unchanged
/* CANNOT MAKE THIS ASSERT/ASSUMPTION ANYMORE BECAUSE REMOVAL OF AN ENTITLEMENT CAN AFFECT A MODIFIER PRODUCT THAT PROVIDES EXTRA CONTENT FOR THIS SERIAL (A MODIFIER PRODUCT IS ALSO CALLED EUS) 2/21/2011 jsefler
if (!beforeEntitlementCertFiles.remove(certFile)) Assert.fail("Failed to remove certFile '"+certFile+"' from list. This could be an automation logic error.");
Assert.assertEquals(afterEntitlementCertFiles,beforeEntitlementCertFiles,"After unsubscribing from serial '"+serialNumber+"', the other entitlement cert serials remain unchanged");
*/
// added by bug 867766
expectedStdoutMsg = "Successfully unsubscribed serial numbers:";
// changed by bug 874749
expectedStdoutMsg = "Successfully removed serial numbers:";
// changed by bug 895447 subscription-manager commit 8e10e76fb5951e0b5d6c867c6c7209d8ec80dead
expectedStdoutMsg = "Serial numbers successfully removed at the server:";
// commit f64d5a6b012f49bb4d6d6653441d4de9bf373660 1319678: Alter the return message for removing entitlements at server
if (isPackageVersion("subscription-manager", ">=", "1.17.8-1"))
expectedStdoutMsg = "The entitlement server successfully removed these serial numbers:";
Assert.assertTrue(result.getStdout().contains(expectedStdoutMsg), "Stdout from unsubscribe contains expected message: " + expectedStdoutMsg);
// added by bug 867766
expectedStdoutMsg = " " + serialNumber;
Assert.assertTrue(result.getStdout().contains(expectedStdoutMsg), "Stdout from unsubscribe contains expected message: " + expectedStdoutMsg);
// TEMPORARY WORKAROUND
invokeWorkaroundWhileBugIsOpen = true;
// Bug 1287610 - yum message in output when FIPS is enabled
bugId = "1287610";
try {
if (redhatReleaseX.equals("7") && isFipsEnabled && invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping the stderr assertion from unsubscribe on rhel '" + redhatReleaseXY + "' while FIPS bug '" + bugId + "' is open");
} else
// END OF WORKAROUND
Assert.assertEquals(result.getStderr(), "", "Stderr from unsubscribe.");
// added by bug 873791
Assert.assertEquals(result.getExitCode(), Integer.valueOf(0), "ExitCode from unsubscribe when the serial's entitlement cert file (" + certFilePath + ") does exist.");
return true;
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SubscriptionManagerCLITestScript method ensureSELinuxIsEnforcingBeforeSuite.
@BeforeSuite(groups = { "setup" }, dependsOnMethods = { "setupBeforeSuite" }, description = "Ensure SELinux is Enforcing before running the test suite.")
public void ensureSELinuxIsEnforcingBeforeSuite() {
for (SubscriptionManagerTasks clienttasks : Arrays.asList(client1tasks, client2tasks)) {
if (clienttasks != null) {
// mark the audit.log file so it can be asserted for denials in verifyNoSELinuxDenialsWereLoggedAfterClass()
RemoteFileTasks.markFile(clienttasks.sshCommandRunner, clienttasks.auditLogFile, selinuxSuiteMarker);
// TEMPORARY WORKAROUND
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1257940 - systemd-hwdb should be confined
String bugId = "1257940";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping BeforeSuite assertion that selinux is Enforcing while bug " + bugId + " is open.");
continue;
}
// END OF WORKAROUND
// TEMPORARY WORKAROUND
invokeWorkaroundWhileBugIsOpen = true;
// Bug 1342401 - Allow NetworkManager to create temporary /etc/resolv.conf.XXXXXX file
bugId = "1342401";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping BeforeSuite assertion that selinux is Enforcing while bug " + bugId + " is open.");
continue;
}
// END OF WORKAROUND
// TEMPORARY WORKAROUND
invokeWorkaroundWhileBugIsOpen = true;
// Bug 1343648 - SELinux label for /etc/udev/hwdb.bin is etc_t instead of systemd_hwdb_etc_t after "#systemd-hwdb update"
bugId = "1343648";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping BeforeSuite assertion that selinux is Enforcing while bug " + bugId + " is open.");
continue;
}
// END OF WORKAROUND
// TEMPORARY WORKAROUND
invokeWorkaroundWhileBugIsOpen = true;
// Bug 1350756 - SELinux label for /etc/udev/hwdb.bin is etc_t instead of systemd_hwdb_etc_t after "#systemd-hwdb update"
bugId = "1350756";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Skipping BeforeSuite assertion that selinux is Enforcing while bug " + bugId + " is open.");
continue;
}
// END OF WORKAROUND
// assert selinux is Enforcing
Assert.assertEquals(clienttasks.sshCommandRunner.runCommandAndWait("getenforce").getStdout().trim(), "Enforcing", "SELinux mode is set to enforcing on client " + clienttasks.sshCommandRunner.getConnection().getRemoteHostname());
}
}
}
use of com.redhat.qe.auto.bugzilla.BugzillaAPIException in project rhsm-qe by RedHatQE.
the class SubscriptionManagerCLITestScript method restoreProductCertsAfterThisTest.
@AfterGroups(groups = { "setup" }, value = { // list of individual tests that could cause the product-id yum plugin to install a productid from the CDN repodata that you want to remove after the test
"testWithNotifyOnlyOffVerifyYumSearchDisabledReposAssumingYesResponses", "testWithNotifyOnlyOffVerifyYumSearchDisabledReposWithYesYesNoResponses", "testInstallAndRemoveAnyPackageFromEnabledRepoAfterSubscribingToPool", "testInstallAndRemoveYumGroupFromEnabledRepoAfterSubscribingToPool", "testYumInstallSucceedsWhenServiceRsyslogIsStopped" }, alwaysRun = true)
public void restoreProductCertsAfterThisTest() {
if (clienttasks == null)
return;
List<ProductCert> productCertsAfterThisTest = clienttasks.getCurrentProductCerts();
// Extraneous RHEL product certs are easily possible especially on a HTB installation as explained in https://bugzilla.redhat.com/show_bug.cgi?id=1538957#c5
for (ProductCert productCertAfterThisTest : productCertsAfterThisTest) {
for (ProductCert productCertBeforeThisTest : productCertsBeforeThisTest) {
// do nothing when this productCertAfterTest was also present BeforeTest
if (productCertBeforeThisTest.file.equals(productCertAfterThisTest.file))
continue;
// do nothing if this productCertAfterTest is located in the default directory
if (productCertAfterThisTest.file.getPath().startsWith(clienttasks.productCertDefaultDir))
continue;
// TEMPORARY WORKAROUND
if (doesStringContainMatches(productCertAfterThisTest.productNamespace.providedTags, "rhel-" + clienttasks.redhatReleaseX + "(,|$)")) {
boolean invokeWorkaroundWhileBugIsOpen = true;
// Bug 1525238 - yum plugin for productid neglects to remove HTB product cert from /etc/pki/product/ because it is tagged as a provider of "rhel-7"
String bugId = "1525238";
try {
if (invokeWorkaroundWhileBugIsOpen && BzChecker.getInstance().isBugOpen(bugId)) {
log.fine("Invoking workaround for " + BzChecker.getInstance().getBugState(bugId).toString() + " Bugzilla " + bugId + ". (https://bugzilla.redhat.com/show_bug.cgi?id=" + bugId + ")");
SubscriptionManagerCLITestScript.addInvokedWorkaround(bugId);
} else {
invokeWorkaroundWhileBugIsOpen = false;
}
} catch (BugzillaAPIException be) {
/* ignore exception */
} catch (RuntimeException re) {
/* ignore exception */
}
if (invokeWorkaroundWhileBugIsOpen) {
log.warning("Removing product cert '" + productCertAfterThisTest.productName + " " + productCertAfterThisTest.file + "' from restoreProductCertsAfterThisTest() while bug '" + bugId + "' is open.");
}
}
// END OF WORKAROUND
// remove the product cert
log.info("Removing product cert '" + productCertAfterThisTest.productName + " " + productCertAfterThisTest.file + "' from restoreProductCertsAfterThisTest().");
client.runCommandAndWait("rm -f " + productCertAfterThisTest.file);
}
}
// clear the protected variable
productCertsBeforeThisTest.clear();
productCertsBeforeThisTest = null;
}
Aggregations