Bug 993440
Summary: | REST API gives an undescriptive error and logs a backtrace if an application depends on a feature that no cartridge provides | ||
---|---|---|---|
Product: | OKD | Reporter: | Miciah Dashiel Butler Masters <mmasters> |
Component: | Master | Assignee: | Miciah Dashiel Butler Masters <mmasters> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | libra bugs <libra-bugs> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 2.x | CC: | wjiang, xtian |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-01-30 00:46:38 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Miciah Dashiel Butler Masters
2013-08-05 23:52:24 UTC
Suggested fix: https://github.com/openshift/origin-server/pull/3298 The fix looks good. Actually, I'm rewriting it because with recent changes, the steps to reproduce hit the same problem in RestGearGroup or RestGearGroup15 instead of RestApplication, and because Clayton advised me to rescue the UnfulfilledRequirementException in OpenShift::Controller::ApiResponse#render_exception instead of in ApplicationsController#show. Unfortunately, there's a lot of code duplication surrounding this code. Would it be best to check whether CartridgeCache.find_cartridge returns nil in RestApplication, RestApplication10, RestApplication13, RestApplication15, RestGearGroup, and RestGearGroup15? It feels stupid to have to make this same change in many places, but I don't think we want to modify find_cartridge to raise the exception, and the alternative would be to create yet another wrapper around find_cartridge. Probably the best solution is to create a new method in CartridgeCache to throw an exception if cart is nil and then call it instead of CartridgeCache.find_cartridge(feature, app) in all the places where it is not acceptable for cart to be nil I implemented the fix described in Comment 4 (checking the return value of find_cartridge in all the relevant models), but I cannot test it because of bug 998026. Assigning to mmasters since he has been working on it. Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/f25fd33696d84debc0811eba94e1d46c00a99d3a Add and use find_cartridge_or_raise_exception Add OpenShift::CartridgeCache::find_cartridge_or_raise_exception, which wraps find_cartridge and raises OpenShift::OOException if no cartridge provides the requested feature. In RestApplication#initialize, RestApplication10#initialize, RestApplication13#initialize, RestApplication15#initialize, RestGearGroup#initialize, and RestGearGroup15#initialize, use find_cartridge_or_raise_exception instead of find_cartridge in place of repetitive error checking and to perform the error checking in more places. This commit is related to bug 993440. I updated and merged the pull request. In fact, this bug was fixed by agupta's commit https://github.com/openshift/origin-server/commit/28e5454ab7477c36360fe0e68d26ca7724ff503a to fix bug 1005007 and bug 1006526, which was merged while my pull request was waiting for review. I subsequently got a review from agupta for my pull request and have merged the changes in my pull request that weren't superseded by his changes. In any case, this bug is fixed now. Tried on devenv_4073 and can not reproduce this issue, so verify this issue. (In reply to weiwei jiang from comment #11) > Tried on devenv_4073 and can not reproduce this issue, so verify this issue. Tried on devenv_4173 and can not reproduce this issue, so verify this issue. Back to ON_QA to re-test or providing the verifying steps. Tried on latest origin, and can not reproduce this issue, so verified this one. 1. setup a origin devenv 2. create a app for example: python-2.7 3. oo-admin-cartridge -l 4. erase cartridge with oo-admin-cartridge -c erase -n python -v 0.0.8 5. check if the app can be control without error. |