Bug 1167625
| Summary: | Fail to start openshift-routing-daemon service when no port is specified for ACTIVEMQ_HOST. | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Johnny Liu <jialiu> |
| Component: | Node | Assignee: | chris alfonso <calfonso> |
| Status: | CLOSED ERRATA | QA Contact: | libra bugs <libra-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | high | ||
| Version: | 2.2.0 | CC: | adellape, bleanhar, hbrock, jokerman, libra-onpremise-devel, mmccomas |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | rubygem-openshift-origin-routing-daemon-0.20.2.3-1.el6op | Doc Type: | Bug Fix |
| Doc Text: |
In OpenShift Enterprise environments using the routing daemon, when multiple hosts were specified in the ACTIVEMQ_HOST parameter in the /etc/openshift/routing-daemon.conf file, the routing daemon failed to start if ports were not specified along with the hosts. This was due to a bug in the routing daemon. This bug fix updates the routing daemon to define the ports for multiple ActiveMQ hosts whether specified on in the ACTIVEMQ_HOST parameter or the ACTIVE_MQ_PORT parameter. As a result, the routing daemon now restarts successfully in this scenario.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-12-10 13:25:25 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: | |||
After added more debug info, found the workaround for issue #2 actually did not work either, because @port is also is nil in the instance_eval block, so here is updated workaround:
Replace the follwoing code
@user = @cfg['ACTIVEMQ_USER'] || 'routinginfo'
@password = @cfg['ACTIVEMQ_PASSWORD'] || 'routinginfopasswd'
@port = (@cfg['ACTIVEMQ_PORT'] || 61613).to_i
@hosts = (@cfg['ACTIVEMQ_HOST'] || 'activemq.example.com').split(',').map do |hp|
hp.split(":").instance_eval do |h,p|
{
:host => h,
# Originally, ACTIVEMQ_HOST allowed specifying only one host, with
# the port specified separately in ACTIVEMQ_PORT.
:port => p || @cfg['ACTIVEMQ_PORT'] || '61613',
}
end
end
to
@user = @cfg['ACTIVEMQ_USER'] || 'routinginfo'
@password = @cfg['ACTIVEMQ_PASSWORD'] || 'routinginfopasswd'
cfgcfg = @cfg
@hosts = (@cfg['ACTIVEMQ_HOST'] || 'activemq.example.com').split(',').map do |hp|
hp.split(":").instance_eval do |h,p|
{
:host => h,
# Originally, ACTIVEMQ_HOST allowed specifying only one host, with
# the port specified separately in ACTIVEMQ_PORT.
:port => p || cfgcfg['ACTIVEMQ_PORT'] || '61613',
}
end
end
The instance_eval is reseting the instance variable @cfg. I'll fix that issue. Good find! Opened PR upstream. Will merge to enterprise-server after it makes it upstream. https://github.com/openshift/origin-server/pull/5976 Verified this bug with rubygem-openshift-origin-routing-daemon-0.20.2.3-1.el6op.noarch, and PASS. When the following config value is set in /etc/openshift/routing-daemon.conf ACTIVEMQ_HOST=10.66.79.157,10.66.79.143 ACTIVEMQ_USER=routinginfo ACTIVEMQ_PASSWORD=routinginfopasswd ACTIVEMQ_PORT=61613 ACTIVEMQ_DESTINATION=/topic/routinginfo restart routing-daemon service successfully. When the following config value is set in /etc/openshift/routing-daemon.conf ACTIVEMQ_HOST=10.66.79.157,10.66.79.143:61614 ACTIVEMQ_USER=routinginfo ACTIVEMQ_PASSWORD=routinginfopasswd ACTIVEMQ_PORT=61613 ACTIVEMQ_DESTINATION=/topic/routinginfo restart routing-daemon service successfully. 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. https://rhn.redhat.com/errata/RHBA-2014-1979.html |
Description of problem: Here is my config in /etc/openshift/routing-daemon.conf ACTIVEMQ_HOST=10.66.79.143,10.66.79.157 ACTIVEMQ_USER=routinginfo ACTIVEMQ_PASSWORD=routinginfopasswd ACTIVEMQ_PORT=61613 ACTIVEMQ_DESTINATION=/topic/routinginfo The related code in lib/openshift/routing/daemon.rb: @user = @cfg['ACTIVEMQ_USER'] || 'routinginfo' @password = @cfg['ACTIVEMQ_PASSWORD'] || 'routinginfopasswd' @port = (@cfg['ACTIVEMQ_PORT'] || 61613).to_i @hosts = (@cfg['ACTIVEMQ_HOST'] || 'activemq.example.com').split(',').map do |hp| hp.split(":").instance_eval do |h,p,ssl| { :host => h, # Originally, ACTIVEMQ_HOST allowed specifying only one host, with # the port specified separately in ACTIVEMQ_PORT. :port => p || @cfg['ACTIVEMQ_PORT'] || '61613', } end end Issue #1: in the above code, ssl parameter should be removed from the block. Issue #2: @cfg is nil in the instance_eval block, so when starting this service, will throw the following error: /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-routing-daemon-0.20.2.1/lib/openshift/routing/daemon.rb:48:in `block (2 levels) in read_config': undefined method `[]' for nil:NilClass (NoMethodError) The workaround is replace :port => p || @cfg['ACTIVEMQ_PORT'] || '61613', to :port => p || @port, Issue #3: in /etc/init.d/openshift-routing-daemon, there is the following lines: # load any custom configuration elements for Watchman path = "/etc/sysconfig/watchman" if File.exists? path config = ParseConfig.new path config.get_params.each { |k| ENV[k] = config[k] } end Obviously these code is for watchman, so should remove them from openshift-routing-daemon Version-Release number of selected component (if applicable): rubygem-openshift-origin-routing-daemon-0.20.2.1-1.el6op.noarch How reproducible: Always Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: