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 1064107 - oo-stats show "undefined method `each' in `district_nodes_clone'" when there are district without any nodes.
Summary: oo-stats show "undefined method `each' in `district_nodes_clone'" when there ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Ravi Sankar
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-12 03:05 UTC by Liang Xia
Modified: 2015-05-15 00:25 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-26 19:12:28 UTC


Attachments (Terms of Use)

Description Liang Xia 2014-02-12 03:05:29 UTC
Description of problem:
When some district doesn't have any nodes, 'oo-stats -d' will show:
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:200:
in `district_nodes_clone': undefined method `each' for nil:NilClass (NoMethodError)

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

How reproducible:
always

Steps to Reproduce:
1.Lanuch a instance and run 'oo-stats -d'.
2.Create an app and run 'oo-stats -d'.
3.Create an district but do not add node to it and run 'oo-stats -d'.
4.Delete the app and add the node into district, then run 'oo-stats -d'.

Actual results:
Step 1,2,4 works fine, but
In step 3, show:
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:200:in `district_nodes_clone': undefined method `each' for nil:NilClass (NoMethodError)
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:188:in `block in get_district_entries'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:569:in `call'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:569:in `block (2 levels) in with_each_record'
    from /opt/rh/ruby193/root/usr/local/share/gems/gems/mongo-1.8.1/lib/mongo/cursor.rb:286:in `each'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:568:in `block in with_each_record'
    from /opt/rh/ruby193/root/usr/local/share/gems/gems/mongo-1.8.1/lib/mongo/collection.rb:276:in `find'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:565:in `with_each_record'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:183:in `get_district_entries'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:40:in `block in gather_statistics'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:27:in `time_msecs'
    from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.20.3/app/models/admin/stats/maker.rb:40:in `gather_statistics'
    from /usr/sbin/oo-stats:112:in `gather_statistics'
    from /usr/sbin/oo-stats:510:in `<main>'

Expected results:
Usage summary listed without errors.

Additional info:

Comment 1 Ravi Sankar 2014-02-12 19:25:53 UTC
Fixed in https://github.com/openshift/origin-server/pull/4750

Comment 2 openshift-github-bot 2014-02-12 23:30:14 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/bf1ef4c37c25d56cd4f31215415b28bd8263cc9e
Bug 1064107 - Minor fix in district_nodes_clone(), maker.rb

Comment 3 Liang Xia 2014-02-13 09:56:07 UTC
Verified on devenv_4370 and it has been fixed. 

# oo-stats -d
...
Districts:
   Name Nodes DistAvailCap GearsActv EffAvailGears LoActvUsgPct AvgActvUsgPct
------- ----- ------------ --------- ------------- ------------ -------------
qasmall     2        5,997         2           178          1.1           1.1
dis_non     0        6,000         0             0          0.0             0


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