Bug 1016782

Summary: nil scales_to value from broker on cartridge
Product: OpenShift Online Reporter: Jessica Forrester <jforrest>
Component: PodAssignee: Lili Nader <lnader>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: dmcphers, jhou, lnader, mfisher
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 03:23:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jessica Forrester 2013-10-08 16:52:54 UTC
Description of problem:
A nil value for scales_to on a cartridge is getting reported back from the rest api.  The only details are from the stack trace from the UI that was caught in our error reporting (see below).  The app that caused this no longer exists, so the steps to recreate it are unknown, but suspect a downloadable cartridge may have been used.

ArgumentError: comparison of Fixnum with nil failed 
…penshift-origin-console-1.15.7/app/models/
cartridge.rb: 112:in `each'
…penshift-origin-console-1.15.7/app/models/
cartridge.rb: 112:in `min'
…penshift-origin-console-1.15.7/app/models/
cartridge.rb: 112:in `effective_scales_to'
…penshift-origin-console-1.15.7/app/models/
cartridge.rb: 104:in `will_scale_to'
…nshift-origin-console-1.15.7/app/models/
application.rb: 217:in `block (2 levels) in gear_ranges'
…nshift-origin-console-1.15.7/app/models/
application.rb: 215:in `each'
…nshift-origin-console-1.15.7/app/models/
application.rb: 215:in `block in gear_ranges'
…nshift-origin-console-1.15.7/app/models/
application.rb: 212:in `each'
…nshift-origin-console-1.15.7/app/models/
application.rb: 212:in `inject'
…nshift-origin-console-1.15.7/app/models/
application.rb: 212:in `gear_ranges'
…s/gems/haml-4.0.3/lib/haml/helpers/
action_view_mods.rb:  45:in `block in capture_with_haml'
…oot/usr/share/gems/gems/haml-4.0.3/lib/haml/
helpers.rb: 368:in `call'
…oot/usr/share/gems/gems/haml-4.0.3/lib/haml/
helpers.rb: 368:in `block in capture_haml'
…oot/usr/share/gems/gems/haml-4.0.3/lib/haml/
helpers.rb: 617:in `with_haml_buffer'
…oot/usr/share/gems/gems/haml-4.0.3/lib/haml/
helpers.rb: 364:in `capture_haml'
…hare/gems/gems/haml-4.0.3/lib/haml/helpers/
xss_mods.rb:  61:in `capture_haml_with_haml_xss'
…s/gems/haml-4.0.3/lib/haml/helpers/
action_view_mods.rb:  45:in `capture_with_haml'
…sr/share/gems/gems/journey-1.0.4/lib/journey/
router.rb:  68:in `block in call'
…sr/share/gems/gems/journey-1.0.4/lib/journey/
router.rb:  56:in `each'
…sr/share/gems/gems/journey-1.0.4/lib/journey/
router.rb:  56:in `call'
…e/gems/gems/rack-recaptcha-0.6.5/lib/rack/
recaptcha.rb:  50:in `_call'
…e/gems/gems/rack-recaptcha-0.6.5/lib/rack/
recaptcha.rb:  37:in `call'
…3/root/usr/share/gems/gems/rack-1.4.1/lib/rack/
etag.rb:  23:in `call'
…/share/gems/gems/rack-1.4.1/lib/rack/
conditionalget.rb:  25:in `call'
…e/gems/gems/rack-1.4.1/lib/rack/session/abstract/
id.rb: 205:in `context'
…e/gems/gems/rack-1.4.1/lib/rack/session/abstract/
id.rb: 200:in `call'
…ot/usr/share/gems/gems/rack-1.4.1/lib/rack/
sendfile.rb: 102:in `call'

Comment 1 Dan McPherson 2013-10-08 17:10:33 UTC
At a min we can catch this in rest_cartridge and return 1,-1 for min/max.  It seems though for a downloadable cart the logic to determine the scaling component is broken.

Comment 3 Dan McPherson 2013-10-18 18:53:17 UTC
https://github.com/openshift/origin-server/pull/3931

Comment 4 Jianwei Hou 2013-10-21 10:32:01 UTC
Verified on STG

Create scalable application with custom cartridge https://raw.github.com/jhou1/openshift-custom-perl/master/metadata/manifest.yml, the min/max of the cartridge defined in manifest.yml was set properly after the appliaction is created.

app1 @ http://app1-jhou.stg.rhcloud.com/ (uuid: 526501d6dbd93c4b10000632)
-------------------------------------------------------------------------
  Domain:     jhou
  Created:    6:28 PM
  Gears:      1 (defaults to small)
  Git URL:    ssh://526501d6dbd93c4b10000632.rhcloud.com/~/git/app1.git/
  SSH:        526501d6dbd93c4b10000632.rhcloud.com
  Deployment: manual

  1jhou-perl-5.10 (Perl 5.10)
  ---------------------------
    From:    https://raw.github.com/jhou1/openshift-custom-perl/master/metadata/manifest.yml
    Scaling: x1 (minimum: 2, maximum: 4) on small gears

  haproxy-1.4 (Web Load Balancer)
  -------------------------------
    Gears: Located with 1jhou-perl-5.10