[PATCH conductor] Fixed sw selection bug
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
When package group without packages exists (this occurred first time now),
sw selection threw nil exception.
You need to run rake dc:prepare_repos after applying this patch.
---
.../util/repository_manager/comps_repository.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/util/repository_manager/comps_repository.rb b/src/app/util/repository_manager/comps_repository.rb
index 2d8ab37..3e57589 100644
--- a/src/app/util/repository_manager/comps_repository.rb
+++ b/src/app/util/repository_manager/comps_repository.rb
@@ -59,7 +59,7 @@ class CompsRepository < AbstractRepository
:repository_id => @id,
:packages => pkgs
}
- end
+ end.compact
end
def get_categories
--
1.7.4
12 years, 8 months
[PATCH] BZ #689863 iwhd init script and config file are now packaged
by Angus Thomas
From: Angus Thomas <athomas(a)redhat.com>
aeolus-configure shouldn't deploy these files
---
contrib/aeolus-configure.spec | 9 +--
recipes/aeolus_recipe/files/iwhd-conf.js | 7 ---
recipes/aeolus_recipe/files/iwhd.init | 76 ------------------------------
recipes/aeolus_recipe/manifests/iwhd.pp | 12 +----
4 files changed, 4 insertions(+), 100 deletions(-)
delete mode 100644 recipes/aeolus_recipe/files/iwhd-conf.js
delete mode 100644 recipes/aeolus_recipe/files/iwhd.init
diff --git a/contrib/aeolus-configure.spec b/contrib/aeolus-configure.spec
index c949c94..c973f57 100644
--- a/contrib/aeolus-configure.spec
+++ b/contrib/aeolus-configure.spec
@@ -4,7 +4,7 @@
Summary: Aeolus Configure Puppet Recipe
Name: aeolus-configure
Version: 2.0.0
-Release: 4%{?dist}%{?extra_release}
+Release: 5%{?dist}%{?extra_release}
Group: Applications/Internet
License: GPLv2+
@@ -52,10 +52,8 @@ rm -rf %{buildroot}
%changelog
-* Wed Mar 02 2011 Mike Orazi <morazi(a)redhat.com 2.0.0-4
-- additions required for rename
-- httpd enabled via chkconfig
-- update create_buckets
+* Tue Mar 22 2011 Angus Thomas <athomas(a)redhat.com 2.0.0-5
+- Removed iwhd init script and config file
* Wed Feb 17 2011 Mohammed Morsi <mmorsi(a)redhat.com> 2.0.0-3
- renamed deltacloud-configure to aeolus-configure
@@ -92,4 +90,3 @@ rm -rf %{buildroot}
* Thu Sep 02 2010 Mohammed Morsi <mmorsi(a)redhat.com> 0.0.1-1
- Initial package
-
diff --git a/recipes/aeolus_recipe/files/iwhd-conf.js b/recipes/aeolus_recipe/files/iwhd-conf.js
deleted file mode 100644
index 44516e0..0000000
--- a/recipes/aeolus_recipe/files/iwhd-conf.js
+++ /dev/null
@@ -1,7 +0,0 @@
-[
- {
- "name": "primary",
- "type": "fs",
- "path": "."
- }
-]
diff --git a/recipes/aeolus_recipe/files/iwhd.init b/recipes/aeolus_recipe/files/iwhd.init
deleted file mode 100644
index 4695d73..0000000
--- a/recipes/aeolus_recipe/files/iwhd.init
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/bash
-#
-#
-# iwhd startup script for iwhd server
-#
-# chkconfig: - 40 60
-# description: iwhd is primary server process for the \
-# IWHD component.
-#
-
-[ -r /etc/sysconfig/iwhd ] && . /etc/sysconfig/iwhd
-
-LOCKFILE="${LOCKFILE:-/var/lock/subsys/iwhd}"
-
-PROG=/usr/bin/iwhd
-CONF=/etc/iwhd/conf.js
-
-. /etc/init.d/functions
-
-start() {
- echo -n "Starting iwhd: "
- # FIXME: we sleep 2 here to make sure that mongod has really come up.
- # Yes, it's a hack
- sleep 2
-
- $PROG -c $CONF >& /var/log/iwhd.log &
- RETVAL=$?
- if [ $RETVAL -eq 0 ] && touch $LOCKFILE ; then
- echo_success
- echo
- else
- echo_failure
- echo
- fi
-}
-
-stop() {
- echo -n "Shutting down iwhd: "
- RETVAL=$?
- killall $PROG
- if [ $RETVAL -eq 0 ] && rm -f $LOCKFILE ; then
- echo_success
- echo
- else
- echo_failure
- echo
- fi
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- stop
- start
- ;;
- reload)
- ;;
- force-reload)
- restart
- ;;
- status)
- status $PROG
- RETVAL=$?
- ;;
- *)
- echo "Usage: iwhd {start|stop|restart|status}"
- exit 1
- ;;
-esac
-
-exit $RETVAL
diff --git a/recipes/aeolus_recipe/manifests/iwhd.pp b/recipes/aeolus_recipe/manifests/iwhd.pp
index 2db8e14..8a953b0 100644
--- a/recipes/aeolus_recipe/manifests/iwhd.pp
+++ b/recipes/aeolus_recipe/manifests/iwhd.pp
@@ -15,14 +15,6 @@ class aeolus::iwhd inherits aeolus {
file { "/data": ensure => 'directory' }
file { "/data/db": ensure => 'directory' }
file { "/etc/iwhd": ensure => 'directory'}
- file { "/etc/iwhd/conf.js":
- source => "puppet:///modules/aeolus_recipe/iwhd-conf.js",
- mode => 755, require => File['/etc/iwhd'] }
-
- #TODO The service wrapper should probably be in the rpm itself
- file { "/etc/rc.d/init.d/iwhd":
- source => "puppet:///modules/aeolus_recipe/iwhd.init",
- mode => 755 }
service { 'mongod':
ensure => 'running',
@@ -33,8 +25,7 @@ class aeolus::iwhd inherits aeolus {
ensure => 'running',
enable => true,
hasstatus => true,
- require => [File['/etc/rc.d/init.d/iwhd', '/etc/iwhd/conf.js'],
- return_if($enable_packages, Package['iwhd']),
+ require => [return_if($enable_packages, Package['iwhd']),
Service[mongod]]}
# XXX ugly hack but iwhd might take some time to come up
@@ -73,4 +64,3 @@ define aeolus::create_bucket(){
logoutput => true,
require => [Exec['iwhd_startup_pause'], Package[curl]] }
}
-
--
1.7.4
12 years, 8 months
warehouse sync (rev. 3)
by Jan Provazník
Sending updated version of warehouse synchronization script.
First patch should be applied on configure repo. This revision
sets provider_image_key for synced provider images.
12 years, 8 months
[PATCH] task #747 - fix aeolus-connector status so that it is properly started in configure
by Mo Morsi
---
.../image_factory_connector/aeolus-connector.init | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/services/image_factory/image_factory_connector/aeolus-connector.init b/services/image_factory/image_factory_connector/aeolus-connector.init
index 6e389bf..081303e 100755
--- a/services/image_factory/image_factory_connector/aeolus-connector.init
+++ b/services/image_factory/image_factory_connector/aeolus-connector.init
@@ -59,7 +59,7 @@ restart() {
}
rh_status() {
- status image_factory_connector
+ status -l $lockfile image_factory_connector
}
case "$1" in
--
1.7.2.3
12 years, 8 months
[PATCH] Bug #715 / BZ 689442 - Field check for pool families ( it accepts special chars)
by steve linabery
Also added a length validation on pool_family name field since I couldn't find any BZ for it.
---
src/app/models/pool_family.rb | 3 +++
src/spec/models/pool_family_spec.rb | 16 ++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/app/models/pool_family.rb b/src/app/models/pool_family.rb
index 8d5c951..6b1165b 100644
--- a/src/app/models/pool_family.rb
+++ b/src/app/models/pool_family.rb
@@ -39,6 +39,9 @@ class PoolFamily < ActiveRecord::Base
has_many :pools, :dependent => :destroy
has_and_belongs_to_many :provider_accounts
+ validates_length_of :name, :maximum => 255
+ validates_format_of :name, :with => /^[\w -]*$/n, :message => "must only contain: numbers, letters, spaces, '_' and '-'"
+
validates_presence_of :name
validates_uniqueness_of :name
def self.default
diff --git a/src/spec/models/pool_family_spec.rb b/src/spec/models/pool_family_spec.rb
index 68dfb42..b6669ad 100644
--- a/src/spec/models/pool_family_spec.rb
+++ b/src/spec/models/pool_family_spec.rb
@@ -31,4 +31,20 @@ describe PoolFamily do
@pool_family.provider_accounts[0].id.should == @provider_account.id
end
+ it "should not be valid if name is too long" do
+ u = Factory(:pool)
+ u.name = ('a' * 256)
+ u.valid?.should be_false
+ u.errors[:name].should_not be_nil
+ u.errors[:name].should =~ /^is too long.*/
+ end
+
+ it "should not be valid if name contains special characters" do
+ u = Factory(:pool)
+ u.name = '.'
+ u.valid?.should be_false
+ u.errors[:name].should_not be_nil
+ u.errors[:name].should =~ /^must only contain.*/
+ end
+
end
--
1.7.4
12 years, 8 months
[PATCH 1/2] Bug #717 / BZ 674661 - PGError value too long on role name field
by steve linabery
Add 'new' method to controller to create instance variable.
Use instance variable @role in view.
Add length validation to model.
---
src/app/controllers/admin/roles_controller.rb | 4 ++++
src/app/models/role.rb | 1 +
src/app/views/admin/roles/new.haml | 2 +-
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/admin/roles_controller.rb b/src/app/controllers/admin/roles_controller.rb
index 70f0be3..e5e5ed3 100644
--- a/src/app/controllers/admin/roles_controller.rb
+++ b/src/app/controllers/admin/roles_controller.rb
@@ -16,6 +16,10 @@ class Admin::RolesController < ApplicationController
@roles = search.results
end
+ def new
+ @role = Role.new
+ end
+
def create
require_privilege(Privilege::PERM_SET)
@role = Role.new(params[:role])
diff --git a/src/app/models/role.rb b/src/app/models/role.rb
index 03e3ad2..4d03504 100644
--- a/src/app/models/role.rb
+++ b/src/app/models/role.rb
@@ -45,4 +45,5 @@ class Role < ActiveRecord::Base
validates_associated :privileges
+ validates_length_of :name, :maximum => 255
end
diff --git a/src/app/views/admin/roles/new.haml b/src/app/views/admin/roles/new.haml
index 7fe46ba..064e67d 100644
--- a/src/app/views/admin/roles/new.haml
+++ b/src/app/views/admin/roles/new.haml
@@ -1,3 +1,3 @@
%h2 New Role
-- form_for Role.new, :url => admin_roles_path do |f|
+- form_for @role, :url => admin_roles_path do |f|
= render :partial => "form", :locals => { :form => f }
--
1.7.4
12 years, 8 months
[PATCH conductor] Fix BZ 684088 - Prevent default pool from being deleted by renaming
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=684088
---
src/app/controllers/resources/pools_controller.rb | 2 +-
src/features/pool.feature | 8 ++++++++
src/features/step_definitions/pool_steps.rb | 7 +++++++
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/resources/pools_controller.rb b/src/app/controllers/resources/pools_controller.rb
index 3a927f1..40d5edb 100644
--- a/src/app/controllers/resources/pools_controller.rb
+++ b/src/app/controllers/resources/pools_controller.rb
@@ -77,7 +77,7 @@ class Resources::PoolsController < ApplicationController
# FIXME: remove this check when pools can be assigned to new users
# default_pool cannot be deleted because metadata object has it tied
# to id of 1 and deleting it prevents new users from being created
- if pool.name == "default_pool"
+ if pool.name == "default_pool" || pool.id == 1
flash[:notice] = "The default pool cannot be deleted"
else
pool.destroy if check_privilege(Privilege::MODIFY, pool)
diff --git a/src/features/pool.feature b/src/features/pool.feature
index 864357b..9f46a4e 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -86,3 +86,11 @@ Feature: Manage Pools
And I press "Destroy"
Then I should see "The default pool cannot be deleted"
And I should see "default_pool"
+
+ Scenario: Cannot delete default_pool by renaming it
+ Given I renamed default_pool to pool_default
+ Given I am on the pools page
+ When I check "pool_default" pool
+ And I press "Destroy"
+ Then I should see "The default pool cannot be deleted"
+ And I should see "pool_default"
diff --git a/src/features/step_definitions/pool_steps.rb b/src/features/step_definitions/pool_steps.rb
index 689bd47..a495490 100644
--- a/src/features/step_definitions/pool_steps.rb
+++ b/src/features/step_definitions/pool_steps.rb
@@ -59,3 +59,10 @@ Given /^the "([^\"]*)" Pool has a quota with following capacities:$/ do |name,ta
@pool.quota_id = @quota.id
@pool.save
end
+
+Given /^I renamed default_pool to pool_default$/ do
+ p = Pool.find_by_name("default_pool")
+ p.name = "pool_default"
+ p.save
+end
+
--
1.7.4
12 years, 8 months
warehouse sync (rev. 2)
by Jan Provazník
First patch should be applied on aeolus-configure, second on conductor. Patch
adds new service which periodically compares data in warehouse to data in
conductor and updates conductor data if there is difference. Data = templates,
images, provider images, icicles. It makes sense to run this service together
with new imagefactory - old imagefactory doesn't use warehouse to store objects
so there is nothing to sync.
12 years, 8 months
aeolus-conductor seed data
by Mo Morsi
Adds bits providing further post-installation
configuration data for the various aeolus components.
Right now adds code creating providers and hardware
profiles after a successful aeolus install. Additional
bits will be added to create provider accounts, templates,
images, and even instances post-install.
Sysadmins using the aeolus puppet recipe directly can
also now define custom providers and hardware profiles
to be automatically created post-installation.
12 years, 8 months
[PATCH conductor] BZ 688924 - Get ec2 image pushes working.
by Jason Guiditta
https://bugzilla.redhat.com/show_bug.cgi?id=688924
To try this out, you will need a successful build of a base image sitting in your
conductor setup. In the UI, this will likely be a bullet under builds with a 'completed'
and the a second line beneathe it with nothing. Spin up the rails console for your
env, likely prod (src/script/console) and find the ec2 Image. Assuming an id of 5:
i=Image.find(5)
i.provider_images.each{|k| k.destroy}
i=Image.find(5)
i.status="anything"
i.save
i.status="complete"
i.save
This should kick off another attempt at a push.
---
aeolus-conductor.spec.in | 1 +
.../image_factory_connector.rb | 2 +
.../image_factory_connector/spec/connector_spec.rb | 9 +++-
src/app/models/provider_account.rb | 2 +-
src/app/models/push_job.rb | 58 +++++++-------------
src/config/environment.rb | 1 +
src/spec/factories/push_job.rb | 4 --
src/spec/models/provider_account_spec.rb | 2 +-
src/spec/models/push_job_spec.rb | 6 ++-
9 files changed, 40 insertions(+), 45 deletions(-)
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 73c46d0..96744e0 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -27,6 +27,7 @@ Requires: rubygem(compass)
Requires: rubygem(compass-960-plugin)
Requires: rubygem(simple-navigation)
Requires: rubygem(typhoeus)
+Requires: rubygem(rest-client)
Requires: rubygem(rb-inotify)
Requires: rubygem(builder)
Requires: rubygem(json)
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 ce7446e..98a7a32 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
@@ -60,11 +60,13 @@ class ImageFactoryConnector < Sinatra::Base
end
post "/build" do
+ puts "build method called with #{params.inspect}"
@b=settings.console.build_image("#{params[:template]}", "#{params[:target]}")
builder :image
end
post "/push" do
+ puts "push method called with #{params.inspect}"
@b=settings.console.push_image("#{params[:image_id]}", "#{params[:provider]}", "#{params[:credentials]}")
builder :image
end
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 bbf10c9..44badef 100644
--- a/services/image_factory/image_factory_connector/spec/connector_spec.rb
+++ b/services/image_factory/image_factory_connector/spec/connector_spec.rb
@@ -53,6 +53,14 @@ describe 'image_factory_connector app' do
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 'receives complex xml properly' do
+ creds="<?xml version=\"1.0\"?>\n<provider_credentials>\n <ec2_credentials>\n <account_number>1234-5678-9150</account_number>\n <access_key>BLAHBLAHBLAH</access_key>\n <secret_access_key>FROBNOSTICATOR</secret_access_key>\n <certificate>-----BEGIN CERTIFICATE-----\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\n-----END CERTIFICATE-----\n</certificate>\n <key>-----BEGIN PRIVATE KEY-----
\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\n5F4VAX2kWheWeepocDVyrHak+CMQ7vnWPgdio8d9Q+va5v+rU2NhPluXtXVOGqSqXmE7HvVhR4i0
\nKJHKEL5748CBSIODF4T789JGLS47DFGHS\n-----END PRIVATE KEY-----</key>\n </ec2_credentials>\n</provider_credentials>\n"
+ provider="ec2-us-east-1"
+ uuid="6669978e-97a3-4381-92cb-2fbc160b49c7"
+ app.console.stub!(:push_image).and_return(@b)
+ 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'}
@@ -76,5 +84,4 @@ describe 'image_factory_connector app' do
last_response.should be_ok
last_response.body.should == "Console connection closed"
end
-
end
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 6ed677b..ce67a51 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -198,7 +198,7 @@ EOT
node.at_xpath('./secret_access_key').content = password
node.at_xpath('./certificate').content = x509_cert_pub
node.at_xpath('./key').content = x509_cert_priv
- return xml.to_s
+ xml
end
def generate_auth_key
diff --git a/src/app/models/push_job.rb b/src/app/models/push_job.rb
index 50f0d53..9983953 100644
--- a/src/app/models/push_job.rb
+++ b/src/app/models/push_job.rb
@@ -16,7 +16,7 @@
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-require 'typhoeus'
+require 'rest_client'
require 'nokogiri'
class PushJob < Struct.new(:provider_image_id, :hydra)
@@ -24,43 +24,27 @@ class PushJob < Struct.new(:provider_image_id, :hydra)
@logger = Delayed::Worker.logger
@logger.info "--- start ---"
@logger.info "PushJob for provider_image_id: #{provider_image_id}"
- begin
- @hydra = hydra
- if (@hydra == nil)
- @hydra = Typhoeus::Hydra.new
- end
- provider_image = ProviderImage.find(provider_image_id)
- # TODO: what if a provider has multiple accounts
- # for now pick first account
- provider_account = provider_image.provider.provider_accounts.first
- request = Typhoeus::Request.new(YAML.load_file("#{RAILS_ROOT}/config/image_factory_console.yml")['pushurl'],
- :method => :post,
- :timeout => 60*1000, # in milliseconds
- :params => {
- :image_id => provider_image.image.uuid,
- :provider => provider_image.provider.name,
- :credentials => provider_account.build_credentials
- })
- request.on_complete do |response|
- if response.success?
- @logger.info "success "
- xml = Nokogiri::XML(response.body)
- @return_uuid = xml.xpath('//image/uuid').first.text
- provider_image.uuid = @return_uuid
- provider_image.save
- @logger.info "uuid: #{@return_uuid}"
- else
- @logger.error "failure"
- @logger.error response.body
- end
- end
- @hydra.queue(request)
- @hydra.run
- rescue Exception => e
- @logger.error "Exception: "
- @logger.error e
+ provider_image = ProviderImage.find(provider_image_id)
+ # TODO: what if a provider has multiple accounts
+ # for now pick first account
+ provider_account = provider_image.provider.provider_accounts.first
+ cred_block = provider_account.build_credentials.to_xml.html_safe
+ response = RestClient.post(YAML.load_file("#{RAILS_ROOT}/config/image_factory_console.yml")['pushurl'], :image_id => provider_image.image.uuid,
+ :provider => provider_image.provider.name,
+ :credentials => cred_block
+ )
+ if response.code==200
+ @logger.info "success "
+ xml = Nokogiri::XML(response.body)
+ @return_uuid = xml.xpath('//image/uuid').first.text
+ provider_image.uuid = @return_uuid
+ provider_image.save
+ @logger.info "uuid: #{@return_uuid}"
+ else
+ @logger.error "failure"
+ @logger.error response.body
+ # TODO: raise an error and capture it somewhere
end
- @logger.info "--- done ---"
@return_uuid
end
end
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 22300a2..0b08e04 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -51,6 +51,7 @@ Rails::Initializer.run do |config|
config.gem "compass-960-plugin", :lib => "ninesixty"
config.gem "simple-navigation"
config.gem "typhoeus"
+ config.gem 'rest-client', :version => '>= 1.6.1'
config.gem "rb-inotify"
config.gem 'rack-restful_submit', :version => '1.1.2'
config.gem 'sunspot_rails', :lib => 'sunspot/rails'
diff --git a/src/spec/factories/push_job.rb b/src/spec/factories/push_job.rb
index b3d82f0..7110339 100644
--- a/src/spec/factories/push_job.rb
+++ b/src/spec/factories/push_job.rb
@@ -1,7 +1,3 @@
Factory.define :push_job do |p|
- hydra = Typhoeus::Hydra.new
- response = Typhoeus::Response.new(:code => 200, :headers => "", :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"><image><uuid>push-job-stub-uuid</uuid></image>", :time => 0.1)
- hydra.stub(:post, YAML.load_file("#{RAILS_ROOT}/config/image_factory_console.yml")['pushurl']).and_return(response)
p.provider_image_id { Factory.create(:provider_image, :provider => Factory.create(:mock_provider_account).provider).id }
- p.hydra hydra
end
diff --git a/src/spec/models/provider_account_spec.rb b/src/spec/models/provider_account_spec.rb
index 09cf674..943bee9 100644
--- a/src/spec/models/provider_account_spec.rb
+++ b/src/spec/models/provider_account_spec.rb
@@ -76,6 +76,6 @@ EOT
:x509_cert_priv => 'priv_key',
:x509_cert_pub => 'cert'
)
- provider_account.build_credentials.should eql(expected_xml)
+ provider_account.build_credentials.to_s.should eql(expected_xml)
end
end
diff --git a/src/spec/models/push_job_spec.rb b/src/spec/models/push_job_spec.rb
index 48348e7..c4fb9e5 100644
--- a/src/spec/models/push_job_spec.rb
+++ b/src/spec/models/push_job_spec.rb
@@ -2,8 +2,12 @@ require 'spec_helper'
describe PushJob do
it "should match request and parse stubbed xml" do
+ image_id="6669978e-97a3-4381-92cb-2fbc160b49c7"
+ response = RestClient::Response.create("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<image>\n <uuid>#{image_id}</uuid>\n</image>\n", 200, {})
+ response.stub(:code).and_return(200)
+ RestClient.stub(:post).and_return(response)
job = Factory.build(:push_job)
uuid = job.perform
- uuid.should == "push-job-stub-uuid"
+ uuid.should == image_id
end
end
--
1.7.4
12 years, 8 months