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: #{(a)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: #{(a)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>#{(a)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>#{(a)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.