Bug 1122339 - Backtrace is shown when adding a node to district if the node can not be found
Summary: Backtrace is shown when adding a node to district if the node can not be found
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
Version: 2.x
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Abhishek Gupta
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-23 02:48 UTC by Jianwei Hou
Modified: 2015-05-15 00:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-18 16:50:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jianwei Hou 2014-07-23 02:48:59 UTC
Description of problem:
When adding a node to district, if the node does not exist, or if the node is not reachable from the broker, oo-admin-ctl-district is broken and backtrace is displayed.

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

How reproducible:
Always

Steps to Reproduce:
1. Create a district
2. Stop the mcollective of node and add this node to broker(or add a node that does not exist)

Actual results:
[root@ip-10-153-190-194 ~]# oo-broker oo-admin-ctl-district -c add-node -n test -i ip-10-153-190-19
/usr/sbin/oo-admin-ctl-district:217:in `block in <main>': undefined method `casecmp' for nil:NilClass (NoMethodError)
	from /usr/sbin/oo-admin-ctl-district:179:in `block in collate_errors'
	from /usr/sbin/oo-admin-ctl-district:177:in `each'
	from /usr/sbin/oo-admin-ctl-district:177:in `collate_errors'
	from /usr/sbin/oo-admin-ctl-district:214:in `<main>'

Expected results:
Instead of backtrace, oo-admin-ctl-district should show that it can not add this node to broker

Additional info:

Comment 1 Zamir SUN 2014-07-27 02:39:28 UTC
https://github.com/openshift/origin-server/pull/5663

I added detection to make sure node_platform is not nil before casecmp
If node_platform is nil I then return with error

Comment 2 Zamir SUN 2014-08-28 06:21:05 UTC
I saw this is a dup with bug 1102553.
https://bugzilla.redhat.com/show_bug.cgi?id=1102553

Comment 3 openshift-github-bot 2014-08-28 17:53:15 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/e17edc775d8debf9706c5a677e730084b5635b50
fix bug 1122339
https://bugzilla.redhat.com/show_bug.cgi?id=1122339
add detection to make sure node_platform is not nil before casecmp

Comment 4 Qixuan Wang 2014-09-16 03:48:11 UTC
Tested on devenv_5167, when the node is not reachable from the broker, it can show proper message. So move the bug to verified, thanks.

[root@ip-10-81-186-51 openshift]# /etc/init.d/ruby193-mcollective stop
Shutting down mcollective:                                 [  OK  ]
[root@ip-10-81-186-51 openshift]# oo-broker oo-admin-ctl-district -c add-node -n dist_1 -i ip-10-81-186-51


{"_id"=>"5417e19fe22aa22272000001",
 "uuid"=>"1499132e3d7011e48e60da48c8899057",
 "available_uids"=>"<6000 uids hidden>",
 "name"=>"dist_1",
 "platform"=>"linux",
 "gear_size"=>"small",
 "available_capacity"=>6000,
 "max_uid"=>6999,
 "max_capacity"=>6000,
 "active_servers_size"=>0,
 "updated_at"=>2014-09-16 07:07:11 UTC,
 "created_at"=>2014-09-16 07:07:11 UTC}

ERROR OUTPUT:
Cannot connect to node.

For the node doesn't exist, please refer to bug 1102553.


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