Bug 985035

Summary: frontend_httpd.rb should require openshift-origin-node/model/application_container
Product: OpenShift Online Reporter: Andy Grimm <agrimm>
Component: ContainersAssignee: Dan Mace <dmace>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: bmeng, dmace, dmcphers, jgoulding, kraman, rmillner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-07 22:55: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:

Description Andy Grimm 2013-07-16 15:33:08 UTC
frontend_httpd.rb uses the ApplicationContainer module now, but does not "require" it, and the result is a quiet failure.  Example:

# oo-exec-ruby irb
>> require 'openshift-origin-node/model/frontend_httpd'
=> true
>> foo = OpenShift::Runtime::FrontendHttpServer.all
=> #<Enumerator: #<Enumerator::Generator:0x00000002b96610>:each>
>> foo.next
StopIteration: iteration reached an end
	from (irb):3:in `next'
	from (irb):3
	from /opt/rh/ruby193/root/usr/bin/irb:12:in `<main>'

At this point, if you look at /var/log/openshift/node/platform.log, you will see an error like this:

July 16 11:23:27 ERROR Failed to instantiate FrontendHttpServer for 51e4fdb1dbd93ce2c2000435: uninitialized constant OpenShift::Runtime::FrontendHttpServer::ApplicationContainer

Now, if we add in application_container, it works, of course:

>> require 'openshift-origin-node/model/application_container'
=> true
>> foo = OpenShift::Runtime::FrontendHttpServer.all
=> #<Enumerator: #<Enumerator::Generator:0x00000003b225c0>:each>
>> foo.next
=> #<OpenShift::Runtime::FrontendHttpServer:0x00000002b8d150 @config=#<OpenShift::Config:0x00000002b8d100 ...

Comment 1 Dan Mace 2013-07-16 15:53:11 UTC
Marking UpcomingRelease: FrontendHttpd shouldn't depend on ApplicationContainer, and using the node library as a gem from an irb session isn't a supported scenario. If the error occurs during a normal node operation, we'll treat it as a blocker.

Comment 2 Rob Millner 2013-07-16 17:00:16 UTC
I agree.  FrontendHttpd gained ApplicationContainer as a dependency during the LXC patch in order to use the root context call - but this code already runs in root context and its expected to work sanely in environments where application containers are damaged.

I've already started reverting that dependency - will kill it completely in this sprint.

Comment 3 Dan Mace 2013-07-26 14:02:04 UTC
https://github.com/openshift/origin-server/pull/3177

Went ahead and fixed the require pending a refactor. This will make the class usable in other consuming scripts/classes.

Comment 4 openshift-github-bot 2013-07-26 16:08:05 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/dca1d8068a142ad1819b4590bda8bbf5e1bfa997
Bug 985035: Add missing requires to frontend_httpd

Comment 5 Meng Bo 2013-07-29 06:19:06 UTC
Checked on devenv_3569, as comment#3, the dependency application_container added to the frontend_httpd.rb.

[root@ip-10-164-72-80 model]# oo-exec-ruby irb
irb(main):001:0> require 'openshift-origin-node/model/frontend_httpd'
=> true
irb(main):002:0> foo = OpenShift::Runtime::FrontendHttpServer.all
=> #<Enumerator: #<Enumerator::Generator:0x00000001df56f0>:each>
irb(main):003:0> foo.next
=> #<OpenShift::Runtime::FrontendHttpServer:0x00000001adee80 @config=#<OpenShift::Config:0x00000001adee30 @conf=#<ParseConfig:0x000000012ffac0 @config_file="/etc/openshift/node.conf"...
....


Move bug to fixed.