use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class BackendEngineKatelloErrataResource method list.
@Override
public KatelloErrata list() {
ErrataData errataData = null;
try {
QueryReturnValue returnValue = runQuery(QueryType.GetErrataForEngine, new GetErrataCountsParameters());
if (!returnValue.getSucceeded()) {
backendFailure(returnValue.getExceptionString());
}
errataData = returnValue.getReturnValue();
} catch (Exception e) {
handleError(e, false);
}
if (errataData == null) {
return new KatelloErrata();
}
return mapCollection(errataData.getErrata());
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class BackendVmKatelloErrataResource method list.
@Override
public KatelloErrata list() {
ErrataData errataData = null;
try {
QueryReturnValue returnValue = runQuery(QueryType.GetErrataForVm, new GetErrataCountsParameters(asGuid(vmId)));
if (!returnValue.getSucceeded()) {
backendFailure(returnValue.getExceptionString());
}
errataData = returnValue.getReturnValue();
} catch (Exception e) {
handleError(e, false);
}
if (errataData == null) {
return new KatelloErrata();
}
return mapCollection(errataData.getErrata());
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class GetErrataCountsForHostQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VdsStatic host = vdsStaticDao.get(getParameters().getId());
if (host == null) {
failWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NOT_EXIST);
return;
}
Provider<?> provider = getHostProvider(host);
if (provider == null) {
failWith(EngineMessage.NO_FOREMAN_PROVIDER_FOR_HOST);
return;
}
HostProviderProxy proxy = getHostProviderProxy(provider);
ErrataData errataForHost = proxy.getErrataForHost(host.getHostName(), getParameters().getErrataFilter());
setReturnValue(errataForHost.getErrataCounts());
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class GetErrataCountsForVmQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
VM vm = vmDao.get(getParameters().getId());
if (vm == null) {
failWith(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_EXIST);
return;
}
Provider<?> provider = getHostProvider(vm);
if (provider == null) {
failWith(EngineMessage.NO_FOREMAN_PROVIDER_FOR_VM);
return;
}
HostProviderProxy proxy = getHostProviderProxy(provider);
String vmHostName = vm.getDynamicData().getVmHost();
if (StringUtils.isBlank(vmHostName)) {
failWith(EngineMessage.NO_HOST_NAME_FOR_VM);
}
ErrataData errataForVm = proxy.getErrataForHost(vmHostName, getParameters().getErrataFilter());
setReturnValue(errataForVm.getErrataCounts());
}
use of org.ovirt.engine.core.common.businessentities.ErrataData in project ovirt-engine by oVirt.
the class KatelloProvider method runErrataListMethod.
protected ErrataData runErrataListMethod(String relativeUrl, String hostName) {
ErrataData errataData = new ErrataData();
try {
ErrataWrapper wrapper = objectMapper.readValue(provider.runHttpGetMethod(relativeUrl), ErrataWrapper.class);
errataData.setErrata(mapErrata(Arrays.asList(wrapper.getResults())));
errataData.setErrataCounts(mapErrataCounts(wrapper));
Stream.of(Erratum.ErrataType.values()).forEach(errataType -> addErrataCountForType(errataData, errataType));
} catch (Exception e) {
log.error("Failed to retrieve errata for content host '{}' via url '{}': {}", hostName, relativeUrl, e.getMessage());
log.debug("Exception", e);
return ErrataData.emptyData();
}
return errataData;
}
Aggregations