Bug 1323191

Summary: value control at region number selection
Product: Red Hat CloudForms Management Engine Reporter: Felix Dewaleyne <fdewaley>
Component: ApplianceAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED NOTABUG QA Contact: Alex Newman <anewman>
Severity: medium Docs Contact:
Priority: high    
Version: 5.5.0CC: abellott, anewman, fdewaley, jhardy, ncarboni, obarenbo
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: All   
OS: All   
Whiteboard: appliance:black:cli:validation
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-25 14:26:26 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 Felix Dewaleyne 2016-04-01 13:39:38 UTC
Description of problem:
value control at region number selection

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

How reproducible:
all the time

Steps to Reproduce:
1. when creating the database, choose region 0
2.
3.

Actual results:
it is possible to use the region but this seems to have an impact on the appliance with the collapse of a lot of ids when they are converted from string to number.

Expected results:
do not allow users to choose a region number that breaks the IDs

Additional info:
this is raised more as a question : "do we want to prevent users from using region 0?" or should we promote more care in the conversion of IDs?

Comment 2 Nick Carboni 2016-04-20 16:43:47 UTC
Region number 0 should be fine. It is the default value for all upstream appliances.

If the issue is writing a script to determine the region number from an id, that is implemented here (https://github.com/ManageIQ/manageiq/blob/master/lib/extensions/ar_region.rb#L48-L50). So matching a 13 digit long number is not adequate as we allow quite a large range of region ids (https://github.com/ManageIQ/manageiq/blob/master/gems/pending/appliance_console/database_configuration.rb#L30).

What issue is using region id 0 causing?

Comment 3 Nick Carboni 2016-04-25 14:26:26 UTC
This was caused by flawed logic in customer code.

`if /\d{13}/.match(id_or_name.to_s)` does not properly determine if something is an id or not.