[PATCH conductor] Fix BZ 678071
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=678071
Added appropriate messages when deleting a provider account.
---
.../admin/provider_accounts_controller.rb | 23 ++++++++++++++++---
src/config/locales/en.yml | 6 +++++
src/features/provider_account.feature | 8 +++++++
.../step_definitions/provider_account_steps.rb | 12 ++++++++++
4 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/src/app/controllers/admin/provider_accounts_controller.rb b/src/app/controllers/admin/provider_accounts_controller.rb
index 6affc73..ceffe17 100644
--- a/src/app/controllers/admin/provider_accounts_controller.rb
+++ b/src/app/controllers/admin/provider_accounts_controller.rb
@@ -119,13 +119,28 @@ class Admin::ProviderAccountsController < ApplicationController
end
def multi_destroy
- if (not params[:accounts_selected]) or (params[:accounts_selected].length == 0)
+ if params[:accounts_selected].blank?
flash[:notice] = "You must select some accounts first."
- else
- ProviderAccount.find(params[:accounts_selected]).each do |account|
- account.destroy if check_privilege(Privilege::MODIFY, account)
+ redirect_to admin_provider_accounts_url and return
+ end
+
+ succeeded = []
+ failed = []
+ ProviderAccount.find(params[:accounts_selected]).each do |account|
+ if check_privilege(Privilege::MODIFY, account) && account.destroyable?
+ account.destroy
+ succeeded << account.label
+ else
+ failed << account.label
end
end
+
+ unless succeeded.empty?
+ flash[:notice] = t 'provider_accounts.index.account_deleted', :count => succeeded.length, :list => succeeded.join(', ')
+ end
+ unless failed.empty?
+ flash[:error] = t 'provider_accounts.index.account_not_deleted', :count => failed.length, :list => failed.join(', ')
+ end
redirect_to admin_provider_accounts_url
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 233cd14..51555a4 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -119,6 +119,12 @@ en:
provider_accounts:
index:
provider_accounts: Provider Accounts
+ account_deleted:
+ one: "Account %{list} was deleted."
+ other: "Accounts %{list} were deleted."
+ account_not_deleted:
+ one: "Account %{list} was not deleted. There are instances associated with it."
+ other: "Accounts %{list} were not deleted. They have instances associated with them."
new:
new_provider_account: New Account
required_field: Required field.
diff --git a/src/features/provider_account.feature b/src/features/provider_account.feature
index af866e7..e59dab9 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -58,10 +58,18 @@ Feature: Manage Provider Accounts
Scenario: Delete a provider account
Given there is a provider named "testprovider"
And there is a provider account named "testaccount"
+ And the account has an instance associated with it
And I am on the admin provider accounts page
When I check the "testaccount" account
And I press "Delete"
Then I should be on the admin provider accounts page
+ And I should see "was not deleted"
+ And there should be 1 provider account
+ When I delete all instances from the account
+ And I check the "testaccount" account
+ And I press "Delete"
+ Then I should be on the admin provider accounts page
+ And I should see "was deleted"
And there should be no provider accounts
Scenario: Search for Provider Accounts
diff --git a/src/features/step_definitions/provider_account_steps.rb b/src/features/step_definitions/provider_account_steps.rb
index 86a6d31..561314a 100644
--- a/src/features/step_definitions/provider_account_steps.rb
+++ b/src/features/step_definitions/provider_account_steps.rb
@@ -1,7 +1,19 @@
+Given /^the account has an instance associated with it$/ do
+ Factory :instance, :provider_account => @provider_account
+end
+
+When /^I delete all instances from the account$/ do
+ @provider_account.instances.each { |i| i.destroy }
+end
+
Then /^there should be no provider accounts$/ do
ProviderAccount.all.should be_empty
end
+Then /^there should be (\d+) provider accounts?$/ do |count|
+ ProviderAccount.all.length.should == count.to_i
+end
+
Given /^there are no provider accounts$/ do
ProviderAccount.all.should be_empty
end
--
1.7.4
13 years, 3 months
[PATCH aeolus] Added colon after password label in login form
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/views/user_sessions/new.haml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/views/user_sessions/new.haml b/src/app/views/user_sessions/new.haml
index 28c75fc..ec19de3 100644
--- a/src/app/views/user_sessions/new.haml
+++ b/src/app/views/user_sessions/new.haml
@@ -6,7 +6,7 @@
= f.label :login, "Username:"
= f.text_field :login
%fieldset
- = f.label :password
+ = f.label :password, "Password:"
= f.password_field :password
%div.indented
= f.check_box :remember_me
--
1.7.4
13 years, 3 months
Push image to newly added providers
by Jan Provazník
I've decided to send this patch even if I haven't done full e2e test (as it
depends on new imagefactory which is not in yet and I didn't achieve to setup
it today). This patch uses only existing 'push code', so I believe it works with
new imagefactory. I tested this with console and it worked.
requirements:
new imagefactory
richard su's patches:
"[PATCH conductor 1/2] delayed_jobs to build and push with new image factory console"
"[PATCH conductor 2/2] template xml change to conform to new format"
13 years, 3 months
#501 Credentials model for provider account
by jzigmund@redhat.com
This patchset contains subtasks:
#405 - Build credential model to support any provider,
#470 - Update the generate_credentials method,
#537 - Surface new creds model in 'add account form
13 years, 3 months
Re: Condor Cloud Provider Project
by David Lutterkort
On Wed, 2011-03-16 at 10:28 -0400, Greg Blomquist wrote:
> +++ John R. Dunning [16/03/11 09:01 -0400]:
> >
> >Oops, I probably misspoke. I thought when you and I talked on the
> >phone, we said that you were going to think about what the components
> >would need to be for the stateful chunk of code, interfacing between
> >DC API and the buzzard^H^H^H^H^H^H^Hcondor backend. If you've already
> >got enough on your plate that's fine.
> >
> >Perhaps it will make sense for Greg to look at that?
>
> I'll probably need a little more insight into what needs looking into here.
> I'm currently working on a "config server", but I'm not sure of the overlap
> with what's being discussed here. The config server I'm working on is specific
> to Audrey wrt cross-pollinating instance configs for post-boot configurations
> of deployables.
That is very much needed, but very different from what Falcon needs; it
should be possible to stand up a Falcon instance, without using
Conductor, Audrey or any of the other higher-level services we are
working on. That should give you a private cloud that lets you run your
own homegrown images and talk to it via Deltacloud.
There are really two 'config servers' in play here:
1. The server to which an instance posts its IP address; for all
intents and purposes this could be the Deltacloud server itself.
To make this scheme moderately secure, we should inject 3 pieces
of data into an instance: the IP of that server, some sort of
UUID for the instance, and a secret token that only the instance
and this config server know. The instance then posts its IP, its
UUID and hte secret token to update the instance/IP mapping.
2. The post-boot config server that is part of Audrey II - a
completely separate animal.
David
13 years, 3 months
[PATCH conductor] WIP - TEST. This is an attempt to get ec2 image pushes to work.
by Jason Guiditta
As noted in the subject, this is not the complete fix (no tests, updated
deps, etc), but in local testing, this general changed worked for me.
It seems that typhoeus was not handling the xml properly, even when I tried
to send it as html_safe, so I tried rest_client, which worked out of the box.
If anyone want to give this a go, you may need a little tweaking, but manually
runnning the RestClient command in this patch in a nearly identical
configuration (just not in the job or with the response block) successfully sent
the request to the connecotr, whereas the typhoeus version did nothing.
To try this out, you will need a successful build of a base image sitting in your
conductor setup. In the UI, this will like be a bullet under builds with a 'completed'
and the a second line beneather it with nothing. Spin up the rails console for your
env, likely prod (src/script/console) and fine 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.
I have included a puts in the push method of the connector, just to make it easier
to see that it was called. If this nominally work for someone early monday, I'll
clean it up when I get in, add deps, tests, etc.
-j
---
.../image_factory_connector.rb | 4 +-
src/app/models/provider_account.rb | 2 +-
src/app/models/push_job.rb | 56 +++++++------------
3 files changed, 25 insertions(+), 37 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 ce7446e..af83be5 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,12 +60,14 @@ 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
- @b=settings.console.push_image("#{params[:image_id]}", "#{params[:provider]}", "#{params[:credentials]}")
+ puts "push method called with #{params.inspect}"
+ #(a)b=settings.console.push_image("#{params[:image_id]}", "#{params[:provider]}", "#{params[:credentials]}")
builder :image
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..9b2d798 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,29 @@ 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 => {
+ 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
+ RestClient.post('http://localhost:2003/push', :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
+ :credentials => cred_block
+ }) {|response, request, result, block|
+ case response.code
+ when 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
end
- @hydra.queue(request)
- @hydra.run
- rescue Exception => e
- @logger.error "Exception: "
- @logger.error e
- end
- @logger.info "--- done ---"
+ }
@return_uuid
end
end
--
1.7.4
13 years, 3 months