[PATCH conductor] RM 3481 - delete provider account via api
by Richard Su
https://www.aeolusproject.org/redmine/issues/3461
Raises ProviderAccountNotFound exception and 404 when provider account
is not found.
---
.../controllers/provider_accounts_controller.rb | 26 ++++++++++++++----
src/app/views/provider_accounts/destroy.xml.haml | 3 ++
src/config/locales/en.yml | 1 +
src/config/routes.rb | 2 +-
.../provider_accounts_controller_spec.rb | 28 ++++++++++++++++++++
5 files changed, 53 insertions(+), 7 deletions(-)
create mode 100644 src/app/views/provider_accounts/destroy.xml.haml
diff --git a/src/app/controllers/provider_accounts_controller.rb b/src/app/controllers/provider_accounts_controller.rb
index ce0d2ab..9db4e39 100644
--- a/src/app/controllers/provider_accounts_controller.rb
+++ b/src/app/controllers/provider_accounts_controller.rb
@@ -144,13 +144,27 @@ class ProviderAccountsController < ApplicationController
def destroy
@provider_account = ProviderAccount.find(params[:id])
require_privilege(Privilege::MODIFY, @provider_account)
- @provider = Provider.find(params[:provider_id])
- if @provider_account.destroy
- flash[:notice] = t"provider_accounts.flash.notice.deleted"
- else
- flash[:error] = t"provider_accounts.flash.error.not_deleted"
+ is_deleted = @provider_account && @provider_account.destroy
+
+ respond_to do |format|
+ format.html {
+ if is_deleted
+ flash[:notice] = t"provider_accounts.flash.notice.deleted"
+ else
+ flash[:error] = t"provider_accounts.flash.error.not_deleted"
+ end
+
+ @provider = Provider.find(params[:provider_id])
+ redirect_to edit_provider_path(@provider, :details_tab => 'accounts')
+ }
+ format.xml {
+ if is_deleted
+ render 'destroy', :locals => { :provider_account_id => @provider_account.id }
+ else
+ raise(Aeolus::Conductor::API::ProviderAccountNotFound.new(404, t("api.error_messages.provider_account_not_found_for_id", :id => params[:id])))
+ end
+ }
end
- redirect_to edit_provider_path(@provider, :details_tab => 'accounts')
end
def multi_destroy
diff --git a/src/app/views/provider_accounts/destroy.xml.haml b/src/app/views/provider_accounts/destroy.xml.haml
new file mode 100644
index 0000000..1f62636
--- /dev/null
+++ b/src/app/views/provider_accounts/destroy.xml.haml
@@ -0,0 +1,3 @@
+!!! XML
+%provider_account{:id => provider_account_id}
+ %status="DELETED"
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 9295373..ed03450 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -1437,6 +1437,7 @@ en:
no_matching_target_image: Could not find any matching Target Images
no_provider_account_given: No provider account given
provider_account_not_found: Could not find provider account for name %{name}
+ provider_account_not_found_for_id: Could not find provider account for id %{id}
provider_image_not_found: Could not find ProviderImage %{providerimage}
provider_image_status_not_found: Could not find status for ProviderImage %{providerimage}
push_error: "Could not push TargetImage %{targetimage} to %{account} and error %{error}"
diff --git a/src/config/routes.rb b/src/config/routes.rb
index e7f26c5..d03009f 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -283,7 +283,7 @@ Conductor::Application.routes.draw do
resources :providers, :only => [:index, :show, :create, :update, :destroy] do
resources :provider_accounts, :only => [:index]
end
- resources :provider_accounts, :only => [:index, :show]
+ resources :provider_accounts, :only => [:index, :show, :destroy]
resources :provider_types, :only => [:index, :show]
end
diff --git a/src/spec/controllers/provider_accounts_controller_spec.rb b/src/spec/controllers/provider_accounts_controller_spec.rb
index a88bd25..3ed4250 100644
--- a/src/spec/controllers/provider_accounts_controller_spec.rb
+++ b/src/spec/controllers/provider_accounts_controller_spec.rb
@@ -242,6 +242,34 @@ describe ProviderAccountsController do
end
end # #index
+
+ describe "#destroy" do
+ before(:each) do
+ @provider_account = FactoryGirl.create(:mock_provider_account)
+ end
+
+ it "when requested provider account exists" do
+ ProviderAccount.stub(:find).and_return(@provider_account)
+ get :destroy, :id => @provider_account.id
+ response.status.should be_eql(200)
+ response.should have_content_type("application/xml")
+ response.body.should be_xml
+ subject = Nokogiri::XML(response.body)
+ xml_provider_account = subject.xpath("//provider_account[@id=\"#{(a)provider_account.id}\"]")
+ xml_provider_account.xpath('@id').text.strip.should == "#{(a)provider_account.id}"
+ xml_provider_account.xpath('status').text.strip.should == "DELETED"
+ end
+
+ it "when requested provider account doesn't exists" do
+ ProviderAccount.stub(:find).and_return(nil)
+ get :destroy, :id => "id_that_does_not_exist"
+ response.status.should be_eql(404)
+ response.should have_content_type("application/xml")
+ response.body.should be_xml
+ subject = Nokogiri::XML(response.body)
+ subject.xpath('//error/code').text.strip.should == "ProviderAccountNotFound"
+ end
+ end #destroy
end
end
--
1.7.7.6
11 years, 10 months
Line break issue - was Justin's setup
by Justin Clift
Hi Jozef,
Good news, the line break UI problem I was stressing about was just
a problem in my build of Chromium. Things look fine in Chome/Firefox
(different desktop), Firefox on the same desktop, etc.
So, looks like we have a working version of upstream Aeolus after
all. :)
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
11 years, 11 months
VOTE Needed: New "users/contributors" IRC Channels ? y/n
by Nitesh Narayan
Hi all,
I had a thought , since we are expanding the community so at this stage if we divide the channels for supporting users with general issues(#aeolus-support) and other for those who are willing to contribute but not very sure how they can start contributing(#aeolus-contribtute or #aeolus-join) and the last one for development discussions which we already have (#aeolus) .
As far as #aeolus-contribute / #aeolus-join I got this idea as I am myself part of the team of #fedora-join and there we deal with the same issues as I had explained .
The other thing due to which I got the thought of this kind of channel was while I was delivering the session on Aeolus in JMI Delhi , then I got many basic questions from folks who were certainly capable of contributing but due to one or the other reason unable to do so .
About #aeolus-contribute
using this channel we would be able to separate the issues of users and dev talks on channel as we all know that some time it gets bit messed up when two or three different communication starts on the same channel and in that case a nomal user may gets confused .
That is a separate thing that we can manage all these things on the same channel (#aeolus) , But for now for the testing purpose we may try atleast one channel . As we all know we all are hoping to get lots of new users as well as new contributors in the upcoming future so it would be easier and better if we can separate the things right now to keep everything organized at the later stage .
So, let's put it to a vote. +1 / -1 style (on list).
Anyone subscribed to our mailing list is welcome to vote,
you don't have to be a committer.
Who's for or against it?
Regards
Nitesh Narayan Lal
11 years, 11 months
Current UI structure
by Jaromir Coufal
Hi all,
Going through *current state* of Conductor UI, I created *diagram of
dependencies* how I see object connections from user's view. Sometimes
connections are very obvious, sometimes they are so hidden that I needed
help from other members of our team (thanks Jozef, Jirka and Jan for
reviewing). Resulting diagram is attached and I would like you to ask
for review and *discussion* if I caught dependencies correctly.
Please keep on mind that I am not referring to database structure but
dependencies in user interface (so how user can see elements which he
manipulates with).
Thank you for your contribution
Jarda
--
Jaromír Coufal
Interaction Designer
Red Hat Czech s.r.o.
Mobile: +420 724 595 508
E-mail:jcoufal@redhat.com
IRC: jcoufal at #cloudforms-ui, #aeolus, #brno
11 years, 11 months
[PATCH 0/1 conductor] simplified chart view logic
by Tzu-Mainn Chen
This patch attempts to address the javascript issue that jprovazn saw with the chart code. It does so by:
a) adding a to_a method to ChartDataset, which automatically places any "All" dataset in front. This allows us to. . .
b) reduce the duplicated javascript code in the chart view
The one thing I was unable to do was auto-compute the "All" key within ChartDataset. The issue I ran into was that the logs/ graphs defaults to *only* showing "All", but has the option of showing "All" + various data breakdowns. The auto-compute would work in the latter case, but not the former. The workarounds I could think of would result in tangled controller code, which I didn't necessarily think was a big improvement.
In any case, auto-computing "All" should be independent of the javascript issue.
Mainn
11 years, 11 months
[PATCH aeolus-cli] CLI extended with hwp functionality
by Samridh
This is the revised patch set for the cli extended with hwp functionality.
There is now a top level command, "aeolus hwp" or "aeolus-hwp", following which the various options of create, list or delete can be used.
This patch will work only when the corresponding conductor patchset is also applied. That patchset makes the necessary modifications to the routes and to the hwp controller.
11 years, 11 months
[PATCH configure] Do not set httpd_can_network_connect if already set
by John Eckersberg
On my F17 system, this reduces configure run time from 140 seconds to
45 seconds.
---
recipes/apache/manifests/init.pp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/recipes/apache/manifests/init.pp b/recipes/apache/manifests/init.pp
index 91f12a4..2ecec3e 100644
--- a/recipes/apache/manifests/init.pp
+++ b/recipes/apache/manifests/init.pp
@@ -28,7 +28,8 @@ class apache {
exec{'permit-http-networking':
command => '/usr/sbin/setsebool -P httpd_can_network_connect 1',
logoutput => true,
- unless => "/usr/bin/test 'Disabled' = `/usr/sbin/getenforce`"
+ unless => "/usr/bin/test 'Disabled' = `/usr/sbin/getenforce` ||
+ (/usr/sbin/getsebool httpd_can_network_connect | grep -q 'on$')"
}
service { "httpd":
--
1.7.10.4
11 years, 11 months
[PATCH conductor] BZ 831687 Fixed empty flash warning message on deployments#launch_time_params
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/controllers/deployments_controller.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index 99cee49..d9ec800 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -89,7 +89,8 @@ class DeploymentsController < ApplicationController
end
# check that type attrs on service params are used properly
- if warnings = @deployable.check_service_params_types
+ warnings = @deployable.check_service_params_types
+ unless warnings.empty?
flash[:warning] ||= []
flash[:warning] = [flash[:warning]] if flash[:warning].kind_of? String
flash[:warning]+=warnings
--
1.7.10.4
11 years, 11 months