Bug 1123944

Summary: oo-app-info does not find gears / users based on app fqdn
Product: OpenShift Container Platform Reporter: Eric Rich <erich>
Component: NodeAssignee: Luke Meyer <lmeyer>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: high    
Version: 2.1.0CC: adellape, bleanhar, jokerman, libra-onpremise-devel, mmccomas, xiama
Target Milestone: ---Keywords: EasyFix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-broker-util-1.23.8.10-1.el6op Doc Type: Bug Fix
Doc Text:
When the oo-app-info command was used to search for an application by its fully-qualified domain name (FQDN), the domain for the FQDN was assumed to be "rhcloud.com". As a result, the search did not work outside of the OpenShift Online environment. This bug fix updates the search to be generalized for any cloud domain, and searching for an application by its FQDN now works as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-26 13:53:06 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 Eric Rich 2014-07-28 17:20:12 UTC
Description of problem:

oo-app-info never seems to do a search / return any results when searching for an fqdn. 

Version-Release number of selected component (if applicable): 
OpenShift Enterprise 2.1.3

How reproducible: Very

Steps to Reproduce:
1. # oo-app-info -f app-namespace.domain.com

Actual results:

Loading broker environment... 

Error: No apps found for fqdn: 'app-namespace.domain.com'

Expected results:

Loading broker environment... Done.                                                                                                                                                                        
================================================================================

      Login:         demo
      Plan:           ()

      App Name:      app
      App UUID:      53d674a6e3c9c3e8a2000005
      Creation Time: 2014-07-28 04:04:54 PM
      URL:           http://app-namespace.domain.com
    
      Group Instance[0]:
          Components: 
              Cartridge Name: php-5.4
              Component Name: php-5.4 
              Cartridge Name: acme-mock-plugin-0.2
              Component Name: acme-mock-plugin-0.2 
           Gear[0]
              Server Identity: node.domain.com
              Gear UUID:       53d674a6e3c9c3e8a2000005
              Gear UID:        5568
          
      Current DNS
      -----------
     app-namespace.domain.com is an alias for app.domain.com.
     app.domain.com has address 10.10.10.1    
================================================================================

Comment 2 Brenton Leanhardt 2014-07-29 14:44:28 UTC
This patch should do it:

diff --git a/broker-util/lib/app_info.rb b/broker-util/lib/app_info.rb
index 4b20d7f..6ab4830 100755
--- a/broker-util/lib/app_info.rb
+++ b/broker-util/lib/app_info.rb
@@ -87,7 +87,7 @@ class AppInfo
 end

 class AppQuery
-  FQDN_REGEX = /(http:\/\/)?(\w+)-(\w+)(\.\w+)?\.rhcloud.com\Z/
+  FQDN_REGEX = /(http:\/\/)?(\w+)-(\w+)(\.\w+)?\.#{Regexp.escape(Rails.application.config.openshift[:domain_suffix])}\Z/

   #
   # Entrypoint for openshift application query methods

Comment 3 Luke Meyer 2014-08-04 17:56:07 UTC
This sort of thing drives me bonkers.

Comment 5 openshift-github-bot 2014-08-05 19:13:39 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/b7b1da5ee4e7e141d1d1bc2ce3769f9c71860998
oo-app-info: don't assume rhcloud.com app domain

Bug 1123944 - oo-app-info does not find gears / users based on app fqdn
https://bugzilla.redhat.com/show_bug.cgi?id=1123944

The search for an app fqdn was poorly implemented, as it assumed the
domain on the fqdn is rhcloud.com. This change generalizes the search to
use the configured cloud domain in the fqdn.

Comment 6 Luke Meyer 2014-08-05 19:26:17 UTC
Can't exactly test this upstream, due to bug 1126888 - but it works under OSE.

Comment 10 errata-xmlrpc 2014-08-26 13:53:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1095.html