Bug 859565

Summary: .dev.rhcloud.com matches
Product: OKD Reporter: Mike McGrath <mmcgrath>
Component: ContainersAssignee: Ram Ranganathan <ramr>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 2.xCC: jhou, mfisher, ramr, xtian
Target Milestone: ---Flags: ramr: needinfo+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: devenv_2550 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-06 18:48:54 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:

Description Mike McGrath 2012-09-21 22:08:49 UTC
Some of our logic is using grep for .dev.rhcloud.com.  For example:


cartridges/diy-0.1.old/info/bin/build.sh:if `echo $OPENSHIFT_GEAR_DNS | grep -q .stg.rhcloud.com` || `echo $OPENSHIFT_GEAR_DNS | grep -q .dev.rhcloud.com`



grep .dev.rhcloud.com would also match blahdev.rhcloud.com even though the latter is prod and the former is dev.

Comment 1 Mike McGrath 2012-09-24 18:42:45 UTC
To further test this one, create an application with somethingdev as the domain (in prod).

See if application is available after update, we've had a few notes come in this week with that issue, they all were blah-somethingdev.rhcloud.com

Comment 2 Ram Ranganathan 2012-09-25 19:53:05 UTC
Yeah, looks like the jboss abstract + python + perl + diy all have it. 

Just changing those to [e]grep -q "\.dev\.rhcloud\.com" should fix it (similar treatment for stg). 

Will fix it along w/ another bug am working on.

Comment 3 Ram Ranganathan 2012-09-28 03:30:44 UTC
Fixed and wating on merge of pull request:
   https://github.com/openshift/crankcase/pull/544

Comment 4 Xiaoli Tian 2012-09-28 08:09:03 UTC
Above code is merged in devenv_2550

Comment 7 Ram Ranganathan 2012-09-28 17:50:32 UTC
This works fine for me on devenv -- what's the errors/reason it failed QA?  Can you please add some more info/logs. 

Thanks.

Comment 8 Jianwei Hou 2012-09-29 02:50:45 UTC
(In reply to comment #7)
> This works fine for me on devenv -- what's the errors/reason it failed QA? 
> Can you please add some more info/logs. 
> 
> Thanks.

Hi,Ram: in this script: https://github.com/ramr/crankcase/blob/56ac756dbfb6abaa8f5f8945baabb9fbd122b633/cartridges/python-2.6/info/bin/build.sh
there was a line(12): elif `echo $openshift_gear_dns | grep -qe "\.rhcloud\.com"`

I think $openshift_gear_dns should be upper case, like $OPENSHIFT_GEAR_DNS.
Otherwise, the regular expression won't be matched on prod

Comment 9 Ram Ranganathan 2012-09-30 06:53:12 UTC
@Hou, good catch -- you are right, that regexp won't match anything since the 
value would be "" and so  it won't match prod.  
Hmm, seems like that's a day 1 bug.

Comment 10 Ram Ranganathan 2012-10-01 18:46:17 UTC
Fixed with pull request: 
    https://github.com/openshift/crankcase/pull/558 

Waiting on merge.

Comment 11 Jianwei Hou 2012-10-08 02:20:54 UTC
Verified on devenv_2295

Tested for python app, regexp matches for both dev and prod

Steps:
1. Create a python app
2. cd /var/lib/stickshift/$UUID/.env, modify OPENSHIFT_GEAR_DNS
for devenv: export OPENSHIFT_GEAR_DNS='py1-jhou.dev.rhcloud.com'
for prod: export OPENSHIFT_GEAR_DNS='py1-jhou.rhcloud.com'
3. Test regexp for both vars, test passed

So move this bug to verified.