Bug 985218

Summary: KeyError when erase a non-exist cartridge by oo-admin-cartridge
Product: OpenShift Online Reporter: Yan Du <yadu>
Component: ContainersAssignee: Michal Fojtik <mfojtik>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 2.xCC: jhonce, mfojtik
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: 2013-08-29 12:48:18 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 Yan Du 2013-07-17 06:40:12 UTC
Description of problem:
Using oo-admin-cartridge to erase a non-exist cartridge

[root@ip-10-164-13-112 ~]# oo-admin-cartridge -a erase -n zend -v 5.7 -c 0.0.1
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.1/lib/openshift-origin-node/model/cartridge_repository.rb:199:in `erase': key not found: (zend, 5.7, 0.0.1) (KeyError)
    from /usr/sbin/oo-admin-cartridge:50:in `apply'
    from /usr/sbin/oo-admin-cartridge:134:in `<main>'



Version-Release number of selected component (if applicable):
devenv-3513



How reproducible:
Always


Steps to Reproduce:
1. erase a non-exist cartridge
   oo-admin-cartridge -a erase -n zend -v 5.7 -c 0.0.1


Actual results:
[root@ip-10-164-13-112 ~]# oo-admin-cartridge -a erase -n zend -v 5.7 -c 0.0.1
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.12.1/lib/openshift-origin-node/model/cartridge_repository.rb:199:in `erase': key not found: (zend, 5.7, 0.0.1) (KeyError)
    from /usr/sbin/oo-admin-cartridge:50:in `apply'
    from /usr/sbin/oo-admin-cartridge:134:in `<main>'



Expected results:
no error show. just a friendly message display, like the cartrdige doesn't exist.

Comment 1 Michal Fojtik 2013-08-14 14:03:41 UTC
Hi Yan,

I made a pull request with fix for this bug:

https://github.com/openshift/origin-server/pull/3353

Please let me know if it works for you :-)

Comment 2 Yan Du 2013-08-15 03:59:52 UTC
test on devenv_3653

[root@ip-10-164-87-105 ~]# oo-admin-cartridge -a erase -n zend -v 5.7 -c 0.0.1
requested cartridge does not exists (key not found: (zend, 5.7, 0.0.1))

error doesn't show up when erase a non-exist cartridge. move the bug to verified. Thanks.