Bug 1040647

Summary: oo-diagnostics test_broker_certificate NoMethodError: undefined method scan for nil
Product: OpenShift Container Platform Reporter: Luke Meyer <lmeyer>
Component: NodeAssignee: Luke Meyer <lmeyer>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 2.0.0CC: bleanhar, jialiu, jpazdziora, libra-onpremise-devel, mschuppe, oe, xiama
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-openshift-origin-common-1.17.2.4-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1047934 (view as bug list) Environment:
Last Closed: 2014-02-04 18:47:24 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:
Bug Depends On:    
Bug Blocks: 1047934    

Description Luke Meyer 2013-12-11 19:14:27 UTC
Description of problem:
test_broker_certificate isn't quite reliable.

Version-Release number of selected component (if applicable):
rubygem-openshift-origin-common-1.17.2.2-1.el6op.noarch
(this may have been around for a while though)

How reproducible:
Not sure, it does not seem to happen every time.

Steps to Reproduce:
1. Use openshift.sh to create broker with hostname broker.hosts.ose20.example.com
2. oo-diagnostics test_broker_certificate

Results:
FAIL: rescue in block in run_tests
error running test_broker_certificate: #<NoMethodError: undefined method `scan' for nil:NilClass>

Additional info:
The problem at least in this case was that this line returns nil:

  apacheconfig = `httpd -S 2> /dev/null`.slice(/^\*:443.*\n[[:space:]][^\n]*\n[^[:space:]]/m)

It's expecting httpd -S to return at least one line after the :443 match with a space and something else on it. In my case at least, it doesn't:

# httpd -S 2> /dev/null
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   broker.hosts.ose20.example.com (/etc/httpd/conf.d/000002_openshift_origin_broker_proxy.conf:14)
*:443                  broker.hosts.ose20.example.com (/etc/httpd/conf.d/000002_openshift_origin_broker_proxy.conf:25)


BTW [[:space:]] is a long way to say \s and [^[:space:]] is a really long way to say \S

Comment 1 Luke Meyer 2013-12-11 19:19:17 UTC
I should note, the httpd output in parentheses is all on the same line as the vhost name (if the terminal is wide enough). So there are only two lines of actual vhost output.

One other unrelated thing to mention: 
response = `curl -k -s -v https://#{Socket.gethostname} -o /dev/null 2>&1`
Socket.gethostname isn't necessarily going to match the broker servername. It isn't necessarily even going to resolve; it can be anything someone puts after "hostname", and they may have valid reasons for that. So, should probably check https://localhost/ or something.

Comment 3 Luke Meyer 2013-12-23 15:43:54 UTC
The check should be improved with rubygem-openshift-origin-common-1.17.2.4-1 so this does not occur.

Comment 4 Ma xiaoqiang 2013-12-24 02:42:19 UTC
check on rubygem-openshift-origin-common-1.17.2.4-1.el6op.noarch
# oo-diagnostics 
<--snip-->
WARN: test_broker_certificate
Using a self-signed certificate for the broker
WARN: test_yum_configuration
        oo-admin-yum-validator reported some possible problems
        with your package source configuration:
--------------------------------------------------------------
      No roles have been specified. Attempting to guess the roles for this system...
If the roles listed below are incorrect or incomplete, please re-run this script with the appropriate --role arguments
    broker
    client
Detected OpenShift Enterprise repository subscription managed by Red Hat Subscription Manager.
Detected installed OpenShift Enterprise version 2.0

Checking if yum-plugin-priorities is installed
Checking channel/repository priorities
Resolving repository/channel/subscription priority conflicts
To resolve conflicting repositories, update repo priority by running:
# yum-config-manager --setopt=openshift_node.priority=40 openshift_node --save
# yum-config-manager --setopt=openshift_infrastructure.priority=40 openshift_infrastructure --save
Please re-run this tool after making any recommended repairs to this system

--------------------------------------------------------------
        Incorrect package source configuration could lead to
        failure to install the correct RPMs.

Comment 5 Luke Meyer 2014-01-02 15:43:05 UTC
*** Bug 1047778 has been marked as a duplicate of this bug. ***

Comment 7 Oden Eriksson 2014-01-10 11:24:43 UTC
Hello,

I rolled a package (rubygem-openshift-origin-common-1.18.5-0.0.el6op) using the code from https://github.com/openshift/origin-server/releases/tag/rubygem-openshift-origin-common-1.18.5-1. This fixes the problem on OpenShift Enterprise 2.0.0c. Will this be an official update soon?

Comment 8 Johnny Liu 2014-01-10 12:26:27 UTC
Yes, a new official release is coming soon. Then you will get the fix.