Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 906228

Summary: Can not use number as the name of scalable application .
Product: OpenShift Container Platform Reporter: xjia <xjia>
Component: NodeAssignee: Luke Meyer <lmeyer>
Status: CLOSED DEFERRED QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 1.0.0CC: bleanhar, chunchen, jharris, libra-onpremise-devel, mgao, xtian, yujzhang
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 868143 Environment:
Last Closed: 2013-03-07 21:48:59 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:
Embargoed:
Bug Depends On: 868143    
Bug Blocks:    

Description xjia 2013-01-31 08:33:03 UTC
Version-Release number of selected component (if applicable):
http://buildvm-devops.usersys.redhat.com/puddle/build/OpenShiftEnterprise/1.1.x/2013-01-29.1/

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.

+++ This bug was initially created as a clone of Bug #868143 +++

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 ).

--- Additional comment from Lili Nader on 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.

--- Additional comment from Justin Harris on 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...

--- Additional comment from Clayton Coleman on 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?'

--- Additional comment from Dan McPherson on 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.rhcloud.com/~/git/19.git/
  SSH:     51034cff514f62366b000001.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.

--- Additional comment from Yujie Zhang on 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.

Comment 3 chunchen 2013-02-27 09:01:46 UTC
reproduced by CLI with rhc-1.5.5, please refer to the following information:

Version-Release number of selected component (if applicable):
Origin clien(rhc-1.5.5)
OSE-1.1.1 (supported api version 1.2)
OSE puddle 1.1.z/2013-02-22.2

How reproducible:
always

Steps to Reproduce:
1. Create a scalable app
   rhc app create 90 python-2.6 -s
  
Actual results:
The server did not respond correctly. This may be an issue with the server configuration or with your connection to the server (such as a Web proxy or firewall). Please verify that you can access the OpenShift
server https://10.66.78.17/broker/rest/domains/ddy/applications

Expected results:
Should can use number as the name of scalable application

Comment 4 Brenton Leanhardt 2013-03-07 21:48:59 UTC
We're just going to pick this up with the rebase.