Bug 990798 - Met "Mongoid::Errors::Validations" when oo-admin-ctl-domain with invalid key type
Met "Mongoid::Errors::Validations" when oo-admin-ctl-domain with invalid key ...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Kubernetes (Show other bugs)
2.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Ravi Sankar
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-31 23:23 EDT by chunchen
Modified: 2016-09-29 22:15 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-23 22:22:44 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description chunchen 2013-07-31 23:23:34 EDT
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):
devenv_stage_429

How reproducible:
always

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)
Problem:
  Validation of CloudUser failed.
Summary:
  The following errors were found: Ssh keys is invalid
Resolution:
  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-07-31 23:28:10 EDT
sorry for the typo, the "invalidate" should be "invalid" in the description.
Comment 2 Abhishek Gupta 2013-08-19 18:46:58 EDT
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-07 20:08:35 EST
Fixed in https://github.com/openshift/origin-server/pull/4130
Comment 4 openshift-github-bot 2013-11-07 21:33:29 EST
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/0c60f7574b5a82027b53b7078f2050c3d09c0645
Bug 990798 - oo-admin-ctl-domain with invalidate key type will show appropriate error message
Comment 5 chunchen 2013-11-08 02:17:15 EST
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.