Bug 868143 - Can not use number as the name of scalable application .
Can not use number as the name of scalable application .
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Kubernetes (Show other bugs)
2.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Dan McPherson
libra bugs
:
Depends On:
Blocks: 906228
  Show dependency treegraph
 
Reported: 2012-10-19 02:47 EDT by Mengjiao Gao
Modified: 2015-05-14 22:07 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 906228 (view as bug list)
Environment:
Last Closed: 2013-02-13 19:51:47 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)
Error page when used number as the scalable app name. (155.29 KB, image/png)
2012-10-19 02:47 EDT, Mengjiao Gao
no flags Details

  None (edit)
Description Mengjiao Gao 2012-10-19 02:47:43 EDT
Created attachment 629813 [details]
Error page when used number as the scalable app name.

Description of problem:
When I tested on the fork_ami_US1375_BZ867779_scaling_and_gear_sizes_in_app_creation_fixed_248, I found that if I set the app name as a number (such as "19" ) and set the app type as a scalable app, I will always get error page like the attachment shown when I clicked "create application' button .And the app cannot be created successfully.

If I changed the app name to  words without number, or to names with both letters and number (such as "ruby","r18","18r"), I can created scalable apps successfully.

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

How reproducible:
always

Steps to Reproduce:
1.Go to website and login.
2.Created a scalable app, and set its name as numbers (such as "19").
3.Click the "create application' button in the app created page.
  
Actual results:
Got error page like the attachment shown. And cannot create the app successfully.

Expected results:
The app should be created successfully.

Additional info:
    If I use CLI command to create the scalable app used a number as its name, I will get error as below:(this can reproduce both on the form-ami and devenv_2348)
###############################################
[root@dhcp-8-205 ~]# rhc app create -l 111 -s -a 1889 -t python-2.6 
Password: 

Creating application: 1889 in 1122
nil
**********
/usr/lib/ruby/gems/1.8/gems/rhc-0.99.5/lib/rhc-common.rb:522:in `create_app': undefined method `uuid' for []:Array (NoMethodError)
        from /usr/lib/ruby/gems/1.8/gems/rhc-0.99.5/bin/rhc-app:229:in `create_app'
        from /usr/lib/ruby/gems/1.8/gems/rhc-0.99.5/bin/rhc-app:504
        from /usr/bin/rhc-app:19:in `load'
        from /usr/bin/rhc-app:19
###############################################

    If I use number such as "188" as the name of a non-scalable app, the app can be created successful (both work via website and CLI ).
Comment 1 Lili Nader 2012-10-22 19:10:43 EDT
I could no reproduce this using the REST API directly.  I believe it is a bug in website.
Comment 2 Justin Harris 2012-11-15 18:31:49 EST
Verified that this is also broken for the CLI.  This is looking like a broker bug to me...
Comment 3 Clayton Coleman 2012-12-18 11:03:24 EST
Broker bug, reproduced in latest code.  Rails is coercing 19 to a Fixnum, broker should force .to_s on the parameter.

ESC[0;37m2012-12-18 11:01:57.128ESC[0m [ESC[31mFATALESC[0m] NoMethodError (undefined method `length' fo
r 19:Fixnum):
  openshift-origin-controller (1.3.1) app/models/application.rb:29:in `block in <class:Application>'
  activemodel (3.2.8) lib/active_model/validator.rb:181:in `call'
  activemodel (3.2.8) lib/active_model/validator.rb:181:in `validate_each'
  activemodel (3.2.8) lib/active_model/validator.rb:153:in `block in validate'
  activemodel (3.2.8) lib/active_model/validator.rb:150:in `each'
  activemodel (3.2.8) lib/active_model/validator.rb:150:in `validate'
  activesupport (3.2.8) lib/active_support/callbacks.rb:310:in `_callback_before_9'
  activesupport (3.2.8) lib/active_support/callbacks.rb:418:in `_run__3107530055360231994__validate__32
4785107521598667__callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_validate_callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
  activemodel (3.2.8) lib/active_model/validations.rb:227:in `run_validations!'
  activemodel (3.2.8) lib/active_model/validations.rb:194:in `valid?'
Comment 4 Dan McPherson 2013-01-25 22:29:18 EST
Fixed with model refactor or before.  Couldn't recreate:

dmcphers@mcpherson:~/code/li (master)$ rhc app create -l danmcp10 -a 19 -t php-5.3 --no-git --no-dns -s
Password: 

Application Options
-------------------
  Namespace:  danmcp10
  Cartridges: php-5.3
  Gear Size:  default
  Scaling:    yes

Creating application '19' ... done

19 @ http://19-danmcp10.dev.rhcloud.com/ (uuid: 51034cff514f62366b000001)
-------------------------------------------------------------------------
  Created: Jan 26  3:26 AM
  Gears:   1 (defaults to small)
  Git URL: ssh://51034cff514f62366b000001@19-danmcp10.dev.rhcloud.com/~/git/19.git/
  SSH:     51034cff514f62366b000001@19-danmcp10.dev.rhcloud.com

  php-5.3 (PHP 5.3)
  -----------------
    Scaling: x1 (minimum: 1, maximum: available) on small gears

  haproxy-1.4 (OpenShift Web Balancer)
  ------------------------------------
    Gears: Located with php-5.3

RESULT:
Application 19 was created.
Comment 5 Yujie Zhang 2013-01-28 01:37:16 EST
Tested on devenv_2734, user can use number as the name to create scalable app successfully, so verify this bug.

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