If you are not seeing something to the effect of: Error Received: #<Qmf2::Data:0x7f77ced19028 @schema=nil, @impl=#Cqmf2::Data:0x7f77ced19078> in your connector log right after the logged debug message that starts with "build method called with", this may be difficult to test. Everyone should be getting this error right now, but that does not seem to be the case. If you get that error, this fixes it, and tests that it works by removing a console method stub and running the real call against factory. The stub is apparently why I did not see the error before.
[PATCH conductor] Bugfix: build and push always throw 500 errors
Something changed recently in the data return from qmf, so the check we were using to see which type of object we got back was no longer valid. --- .../image_factory_connector.rb | 4 ++-- .../image_factory_connector/spec/connector_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb b/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb index e438dfe..2ecbd58 100644 --- a/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb +++ b/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb @@ -63,7 +63,7 @@ class ImageFactoryConnector < Sinatra::Base post "/build" do settings.logger.debug "build method called with #{params.inspect}" @b=settings.console.build_image("#{params[:template]}", "#{params[:target]}") - if @b.respond_to?(:image_id) + if @b.respond_to?(:agent) builder :image else settings.logger.error "Error Received: #{@b.inspect}" @@ -74,7 +74,7 @@ class ImageFactoryConnector < Sinatra::Base post "/push" do settings.logger.debug "push method called with #{params.inspect}" @b=settings.console.push_image("#{params[:image_id]}", "#{params[:provider]}", "#{params[:credentials]}") - if @b.respond_to?(:image_id) + if @b.respond_to?(:agent) builder :image else settings.logger.error "Error Received: #{@b.inspect}" diff --git a/services/image_factory/image_factory_connector/spec/connector_spec.rb b/services/image_factory/image_factory_connector/spec/connector_spec.rb index 207e896..6519ac1 100644 --- a/services/image_factory/image_factory_connector/spec/connector_spec.rb +++ b/services/image_factory/image_factory_connector/spec/connector_spec.rb @@ -23,7 +23,7 @@ require 'spec_helper'
describe 'image_factory_connector app' do class BuildAdaptor - attr_accessor :image_id + attr_accessor :image_id, :agent end
def app @@ -48,9 +48,8 @@ describe 'image_factory_connector app' do
# TODO: clean up these xml checks so they are in some fixture (or similar) and not repeated it 'calls the console build_image method and returns xml response with uuid' do - app.console.stub!(:build_image).and_return(@b) post 'build', {:template => '<template></template>', :target => 'mock'} - last_response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>#{@b.image_id}</uuid>\n</image>\n" + last_response.body.should include("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>") end
it 'receives complex xml properly' do @@ -61,6 +60,7 @@ describe 'image_factory_connector app' do post 'push', {:image_id => uuid, :provider => provider, :credentials => creds} last_response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>#{@b.image_id}</uuid>\n</image>\n" end + it 'calls the console push_image method and returns xml response with uuid' do app.console.stub(:push_image).and_return(@b) post 'push', {:image_id => @b.image_id, :provider => 'mock', :credentials => 'some creds'}
On Thu, Mar 31, 2011 at 04:16:03PM -0400, Jason Guiditta wrote:
Something changed recently in the data return from qmf, so the check we were using to see which type of object we got back was no longer valid.
.../image_factory_connector.rb | 4 ++-- .../image_factory_connector/spec/connector_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb b/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb index e438dfe..2ecbd58 100644 --- a/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb +++ b/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb @@ -63,7 +63,7 @@ class ImageFactoryConnector < Sinatra::Base post "/build" do settings.logger.debug "build method called with #{params.inspect}" @b=settings.console.build_image("#{params[:template]}", "#{params[:target]}")
- if @b.respond_to?(:image_id)
- if @b.respond_to?(:agent) builder :image else settings.logger.error "Error Received: #{@b.inspect}"
@@ -74,7 +74,7 @@ class ImageFactoryConnector < Sinatra::Base post "/push" do settings.logger.debug "push method called with #{params.inspect}" @b=settings.console.push_image("#{params[:image_id]}", "#{params[:provider]}", "#{params[:credentials]}")
- if @b.respond_to?(:image_id)
- if @b.respond_to?(:agent) builder :image else settings.logger.error "Error Received: #{@b.inspect}"
diff --git a/services/image_factory/image_factory_connector/spec/connector_spec.rb b/services/image_factory/image_factory_connector/spec/connector_spec.rb index 207e896..6519ac1 100644 --- a/services/image_factory/image_factory_connector/spec/connector_spec.rb +++ b/services/image_factory/image_factory_connector/spec/connector_spec.rb @@ -23,7 +23,7 @@ require 'spec_helper'
describe 'image_factory_connector app' do class BuildAdaptor
- attr_accessor :image_id
attr_accessor :image_id, :agent end
def app
@@ -48,9 +48,8 @@ describe 'image_factory_connector app' do
# TODO: clean up these xml checks so they are in some fixture (or similar) and not repeated it 'calls the console build_image method and returns xml response with uuid' do
- app.console.stub!(:build_image).and_return(@b) post 'build', {:template => '<template></template>', :target => 'mock'}
- last_response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>#{@b.image_id}</uuid>\n</image>\n"
last_response.body.should include("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>") end
it 'receives complex xml properly' do
@@ -61,6 +60,7 @@ describe 'image_factory_connector app' do post 'push', {:image_id => uuid, :provider => provider, :credentials => creds} last_response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>#{@b.image_id}</uuid>\n</image>\n" end
- it 'calls the console push_image method and returns xml response with uuid' do app.console.stub(:push_image).and_return(@b) post 'push', {:image_id => @b.image_id, :provider => 'mock', :credentials => 'some creds'}
ACK. This fixes the 500 error and appears to fix the occasional 404s as well.
-- Matt
On Thu, 2011-03-31 at 18:13 -0400, Matt Wagner wrote:
On Thu, Mar 31, 2011 at 04:16:03PM -0400, Jason Guiditta wrote:
Something changed recently in the data return from qmf, so the check we were using to see which type of object we got back was no longer valid.
.../image_factory_connector.rb | 4 ++-- .../image_factory_connector/spec/connector_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git
a/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb b/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb
index e438dfe..2ecbd58 100644
a/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb
+++
b/services/image_factory/image_factory_connector/lib/image_factory_connector/image_factory_connector.rb
@@ -63,7 +63,7 @@ class ImageFactoryConnector < Sinatra::Base post "/build" do settings.logger.debug "build method called with
#{params.inspect}"
@b=settings.console.build_image("#{params[:template]}",
"#{params[:target]}")
- if @b.respond_to?(:image_id)
- if @b.respond_to?(:agent) builder :image else settings.logger.error "Error Received: #{@b.inspect}"
@@ -74,7 +74,7 @@ class ImageFactoryConnector < Sinatra::Base post "/push" do settings.logger.debug "push method called with
#{params.inspect}"
@b=settings.console.push_image("#{params[:image_id]}",
"#{params[:provider]}", "#{params[:credentials]}")
- if @b.respond_to?(:image_id)
- if @b.respond_to?(:agent) builder :image else settings.logger.error "Error Received: #{@b.inspect}"
diff --git a/services/image_factory/image_factory_connector/spec/connector_spec.rb b/services/image_factory/image_factory_connector/spec/connector_spec.rb index 207e896..6519ac1 100644
a/services/image_factory/image_factory_connector/spec/connector_spec.rb
+++
b/services/image_factory/image_factory_connector/spec/connector_spec.rb
@@ -23,7 +23,7 @@ require 'spec_helper'
describe 'image_factory_connector app' do class BuildAdaptor
- attr_accessor :image_id
attr_accessor :image_id, :agent end
def app
@@ -48,9 +48,8 @@ describe 'image_factory_connector app' do
# TODO: clean up these xml checks so they are in some fixture (or
similar) and not repeated
it 'calls the console build_image method and returns xml response
with uuid' do
- app.console.stub!(:build_image).and_return(@b) post 'build', {:template => '<template></template>', :target =>
'mock'}
- last_response.body.should == "<?xml version="1.0" encoding=
"UTF-8"?>\n<image>\n <uuid>#{@b.image_id}</uuid>\n</image>\n"
- last_response.body.should include("<?xml version="1.0"
encoding="UTF-8"?>\n<image>\n <uuid>")
end
it 'receives complex xml properly' do @@ -61,6 +60,7 @@ describe 'image_factory_connector app' do post 'push', {:image_id => uuid, :provider =>
provider, :credentials => creds}
last_response.body.should == "<?xml version=\"1.0\" encoding=
"UTF-8"?>\n<image>\n <uuid>#{@b.image_id}</uuid>\n</image>\n"
end
- it 'calls the console push_image method and returns xml response
with uuid' do
app.console.stub(:push_image).and_return(@b) post 'push', {:image_id => @b.image_id, :provider =>
'mock', :credentials => 'some creds'}
ACK. This fixes the 500 error and appears to fix the occasional 404s as well.
-- Matt
Pushed.
aeolus-devel@lists.fedorahosted.org