use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus.FAILED in project cloudbreak by hortonworks.
the class FreeIpaOperationCheckerTask method checkStatus.
@Override
public boolean checkStatus(T operationPollerObject) {
OperationStatus operationStatus = ThreadBasedUserCrnProvider.doAsInternalActor(operationPollerObject.getRegionalAwareInternalCrnGeneratorFactory().iam().getInternalCrnForServiceAsString(), () -> operationPollerObject.getOperationV1Endpoint().getOperationStatus(operationPollerObject.getOperationId(), operationPollerObject.getAccountId()));
LOGGER.debug("OperationStatus for operationId[{}]: {}", operationPollerObject.getOperationId(), operationStatus);
if (OperationState.COMPLETED.equals(operationStatus.getStatus())) {
return true;
} else if (OperationState.RUNNING.equals(operationStatus.getStatus())) {
return false;
} else {
String failureDetails = extractFailureDetails(operationStatus);
throw new FreeIpaOperationFailedException(String.format("FreeIPA [%s] operation [%s] failed with state [%s] and error message [%s]. " + "Failure details: [%s]", operationStatus.getOperationType(), operationPollerObject.getOperationId(), operationStatus.getStatus(), operationStatus.getError(), failureDetails));
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus.FAILED in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method generateServiceKeytab.
private void generateServiceKeytab(com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
try {
ServiceKeytabRequest serviceKeytabRequest = new ServiceKeytabRequest();
serviceKeytabRequest.setEnvironmentCrn(environmentCrn);
serviceKeytabRequest.setServiceName("test");
serviceKeytabRequest.setServerHostName("test.local");
serviceKeytabRequest.setDoNotRecreateKeytab(Boolean.FALSE);
ipaClient.getKerberosMgmtV1Endpoint().generateServiceKeytab(serviceKeytabRequest, null);
} catch (Exception e) {
logger.error("Generate Service keytab test failed during upgrade", e);
throw new TestFailException("Generate Service keytab test failed during upgrade with: " + e.getMessage(), e);
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus.FAILED in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method syncUsers.
private void syncUsers(TestContext testContext, com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn, String accountId) {
try {
SyncOperationStatus lastSyncOperationStatus = ipaClient.getUserV1Endpoint().getLastSyncOperationStatus(environmentCrn);
if (lastSyncOperationStatus.getStatus() == SynchronizationStatus.RUNNING) {
waitToCompleted(testContext, lastSyncOperationStatus.getOperationId(), "Initial or periodic usersync");
}
SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest();
request.setAccountId(accountId);
request.setEnvironments(Set.of(environmentCrn));
request.setWorkloadCredentialsUpdateType(WorkloadCredentialsUpdateType.FORCE_UPDATE);
try {
SyncOperationStatus syncOperationStatus = ipaClient.getUserV1Endpoint().synchronizeAllUsers(request);
waitToCompleted(testContext, syncOperationStatus.getOperationId(), "Full forced usersync");
} catch (WebApplicationException e) {
if (e.getResponse() != null && Response.Status.CONFLICT.getStatusCode() == e.getResponse().getStatus()) {
logger.info("Usersync is already running");
} else {
throw e;
}
}
} catch (Exception e) {
logger.error("Full forced usersync test failed during upgrade", e);
throw new TestFailException("Full forced usersync test failed during upgrade with: " + e.getMessage(), e);
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus.FAILED in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method addAndDeleteDnsARecord.
private void addAndDeleteDnsARecord(com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
try {
AddDnsARecordRequest aRecordRequest = new AddDnsARecordRequest();
aRecordRequest.setHostname("test-a-record");
aRecordRequest.setCreateReverse(true);
aRecordRequest.setEnvironmentCrn(environmentCrn);
aRecordRequest.setIp("1.2.3.4");
ipaClient.getDnsV1Endpoint().addDnsARecord(aRecordRequest);
ipaClient.getDnsV1Endpoint().deleteDnsARecord(environmentCrn, null, aRecordRequest.getHostname());
} catch (Exception e) {
logger.error("DNS A record test failed during upgrade", e);
throw new TestFailException("DNS A record test failed during upgrade with: " + e.getMessage(), e);
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.user.model.SynchronizationStatus.FAILED in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method generateHostKeyTab.
private void generateHostKeyTab(com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
try {
HostKeytabRequest hostKeytabRequest = new HostKeytabRequest();
hostKeytabRequest.setEnvironmentCrn(environmentCrn);
hostKeytabRequest.setServerHostName("test.local");
hostKeytabRequest.setDoNotRecreateKeytab(Boolean.FALSE);
ipaClient.getKerberosMgmtV1Endpoint().generateHostKeytab(hostKeytabRequest);
} catch (Exception e) {
logger.error("Generate Host keytab test failed during upgrade", e);
throw new TestFailException("Generate Host keytab test failed during upgrade with: " + e.getMessage(), e);
}
}
Aggregations