Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 990798 - Met "Mongoid::Errors::Validations" when oo-admin-ctl-domain with invalid key type
Summary: Met "Mongoid::Errors::Validations" when oo-admin-ctl-domain with invalid key ...
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
Version: 2.x
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: ---
Assignee: Ravi Sankar
QA Contact: libra bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2013-08-01 03:23 UTC by chunchen
Modified: 2016-09-30 02:15 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-01-24 03:22:44 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description chunchen 2013-08-01 03:23:34 UTC
Description of problem:
When run oo-admin-ctl-domain with invalidate key type, will meet errors like "Mongoid::Errors::Validations".

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

How reproducible:

Steps to Reproduce:
1. SSH into a instance
2. Run oo-admin-ctl-domain with invalidate key type
oo-admin-ctl-domain -l chunchen+2 -n cdm2 -c create -s keycontent -t invalidate_type -k ssh1

Actual results:
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/persistence.rb:310:in `fail_validate!':  (Mongoid::Errors::Validations)
  Validation of CloudUser failed.
  The following errors were found: Ssh keys is invalid
  Try persisting the document with valid data or remove the validations.
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/persistence.rb:96:in `save!'
	from /usr/sbin/oo-admin-ctl-domain:153:in `<main>'

Expected results:
Should prompt friendly messages instead of errors.

Additional info:

Comment 1 chunchen 2013-08-01 03:28:10 UTC
sorry for the typo, the "invalidate" should be "invalid" in the description.

Comment 2 Abhishek Gupta 2013-08-19 22:46:58 UTC
The key validations need to be moved from the controller into the model and the model should return exception based on that (UserException, if nothing specific is required). The controller and the admin tools should then handle those exceptions and return error messages to the user.

Comment 3 Ravi Sankar 2013-11-08 01:08:35 UTC
Fixed in

Comment 4 openshift-github-bot 2013-11-08 02:33:29 UTC
Commit pushed to master at
Bug 990798 - oo-admin-ctl-domain with invalidate key type will show appropriate error message

Comment 5 chunchen 2013-11-08 07:17:15 UTC
It's fixed, verified on devenv_4008, please refer to the following results:

]# oo-admin-ctl-domain -l chunchen -n ccy2 -c create -s keycontent -t invalidate_type -k ssh1
An error occurred during ssh key addition. Errors: {:ssh_keys=>["is invalid"]}

Note You need to log in before you can comment on or make changes to this bug.