Description of problem: When a cartridge that does not belong to an application is passed in to --cartridge option of oo-admin-ctl-app, the program got broken, the exception is handled by mongoid Version-Release number of selected component (if applicable): on devenv_3897 How reproducible: Always Steps to Reproduce: 1. Create a scalable php application 2. Set the multiplier of the application, pass in 'diy-0.1' to the --cartridge option oo-admin-ctl-app -l jhou -a php1s -c set-multiplier --cartridge diy-0.1 --multiplier 2 Actual results: The program is broken [root@ip-10-182-168-224 ~]# oo-admin-ctl-app -l jhou -a php1s -c set-multiplier --cartridge diy-0.1 --multiplier 2 /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/finders.rb:96:in `find_by': (Mongoid::Errors::DocumentNotFound) Problem: Document not found for class ComponentInstance with attributes {:cartridge_name=>"diy-0.1"}. Summary: When calling ComponentInstance.find_by with a hash of attributes, all attributes provided must match a document in the database or this error will be raised. Resolution: Search for attributes that are in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error. from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/criteria.rb:731:in `block in method_missing' from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/scoping.rb:190:in `with_scope' from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/criteria.rb:730:in `method_missing' from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/embedded/many.rb:398:in `block in method_missing' from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/scoping.rb:190:in `with_scope' from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/embedded/many.rb:397:in `method_missing' from /usr/sbin/oo-admin-ctl-app:195:in `<main>' Expected results: Maybe we should properly handle this exception when a cartridge is not in the component_instances of the application Additional info: This is also reproducible when doing start/create and such commands.
Fixed in https://github.com/openshift/origin-server/pull/4144
Commits pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/313678bb4abaa3c099b716f1804164dc1ca11b60 Bug 1019246 - Handle errors in setting multiplier for the cartridge https://github.com/openshift/origin-server/commit/2bfe6bb847fe344a6c4f78a834e1d378564dcce2 Merge pull request #4144 from pravisankar/dev/ravi/bug1019246 Merged by openshift-bot
Verified on devenv_4016, the exception is handled now. [root@ip-10-158-73-211 ~]# oo-admin-ctl-app -l jhou -a php1s -c set-multiplier --cartridge php-5.3 --multiplier 3 Cannot set multiplier factor. Cartridge php-5.3 needs to be a sparse cart.