aeolus configure features
by Mo Morsi
The following patchset implements several new features
for aeolus-configure including
- configuration profiles or grouping of aeolus components
and seed data which can be configured seperately from each
other
- interactive installer allowing the user to select which
components are configured locally and the parameters
to seed the application with
- expanded seed data interface including support for provider
accounts and images
- expanded spec suite, verifying all the above
- a few bug fixes / improvements to smoothen operations
Everything has been tested, all existing functionality still
fully works as does the new additions
12 years, 8 months
[PATCH 0/1] Revamped cleanup
by Jason Guiditta
Turns out the last version of this was too agressive, so this one limits
it to cleaning up your _system_ gems, both installed by rpm and gem. If
you have non-system gems that get in the way, you are on your own to clean
those up (Or flip the USE_BUNDLER switch).
-j
12 years, 8 months
[PATCH 0/2] Rebased version of Bundler usage update
by Jason Guiditta
This may need a second patch to fully square away proper test runs,
but at the very least, should make the app run/install via rpm without
bunlder mucking anything up. I already have a feature in redmine to
cleanup the rake test tasks as needed, so this can be cleaned up as
this direction gets vetted.
12 years, 8 months
Aeolus 0.3.0 : VMware vSphere provider type
by michel.gauthier@bull.net
Hi,
We worked with Aeolus version 0.3.0.
Using Conductor gui, we want to create a new provider from VMware vSphere
provider type with the following parameters :
Provider name : vsphere
Provider url : http://localhost:3001/api
Provider type : VMware vSphere
The result is the error message : Failed to connect to Provider
Below the corresponding /var/log/aeolus-conductor/rails.log log file :
Processing ProvidersController#create (for 129.182.77.53 at 2011-09-05
14:02:44) [POST]
Parameters: {"commit"=>"Save", "action"=>"create",
"controller"=>"providers", "provider"=>{"name"=>"vsphere", "url"=>"
http://localhost:3001/api", "provider_type_id"=>"8"}}
Error connecting to framework: Connection refused - connect(2)
Backtrace: /usr/lib/ruby/1.8/net/http.rb:560:in `initialize'
/usr/lib/ruby/1.8/net/http.rb:560:in `open'
/usr/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/lib/ruby/1.8/timeout.rb:67:in `timeout'
/usr/lib/ruby/1.8/timeout.rb:101:in `timeout'
/usr/lib/ruby/1.8/net/http.rb:560:in `connect'
/usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
/usr/lib/ruby/1.8/net/http.rb:542:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in
`transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in
`execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in
`execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:54:in
`get'
/usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.3.1/lib/deltacloud.rb:364:in
`send'
/usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.3.1/lib/deltacloud.rb:364:in
`request'
/usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.3.1/lib/deltacloud.rb:256:in
`discover_entry_points'
/usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.3.1/lib/deltacloud.rb:80:in
`initialize'
/usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.3.1/lib/deltacloud.rb:43:in
`new'
/usr/lib/ruby/gems/1.8/gems/deltacloud-client-0.3.1/lib/deltacloud.rb:43:in
`new'
/usr/share/aeolus-conductor/app/models/provider.rb:79:in `connect'
/usr/share/aeolus-conductor/app/controllers/providers_controller.rb:66:in
`create'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in
`send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in
`perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:617:in
`call_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in
`perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in
`ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in
`ms'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in
`perform_action_without_flash'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/flash.rb:151:in
`perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in
`send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in
`process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:in
`process_without_compass'
/usr/lib/ruby/gems/1.8/gems/compass-0.10.4/lib/compass/app_integration/rails/actionpack2/action_controller.rb:7:in
`process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:391:in
`process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:in
`call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in
`call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:87:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in
`_call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130:in
`build_middleware_stack'
/usr/lib/ruby/gems/1.8/gems/haml-3.0.18/rails/../lib/sass/plugin/rack.rb:41:in
`call'
/usr/lib/ruby/gems/1.8/gems/haml-3.0.18/rails/../lib/sass/plugin/rack.rb:41:in
`call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-restful_submit-1.1.2/lib/rack/rack-restful_submit.rb:25:in
`call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in
`call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/abstract_store.rb:128:in
`call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in
`call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
`cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:in
`cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in
`call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:106:in
`call'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/rack/adapter/rails.rb:69:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:84:in
`pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in
`catch'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in
`pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:57:in
`process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:42:in
`receive_data'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
`run_machine'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
`run'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in
`start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:86:in
`start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in
`run_command'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/bin/thin:6
/usr/bin/thin:19:in `load'
/usr/bin/thin:19
Rendering template within layouts/application
Rendering providers/new
Completed in 56ms (View: 28, DB: 6) | 200 OK [
https://172.31.70.87/conductor/providers]
Processing ProvidersController#index (for 127.0.0.1 at 2011-09-05
17:43:55) [GET]
Parameters: {"action"=>"index", "controller"=>"providers"}
Completed in 146ms (View: 3, DB: 6) | 200 OK [
http://localhost/conductor/providers]
Questions : Can you tell us if VMware vSphere provider type is supported
by Aeolus 0.3.0 (official version)? If not,, in which future version is it
supported? And when?
Thank you for your answers.
Michel Gauthier
12 years, 8 months
[PATCH conductor] .gitignore the .sass-cache/ directory
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
---
.gitignore | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index ddf63d5..7725cab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,8 @@ src/.idea
src/db/schema.rb
-# compass compiled and temporary files
+# sass compiled and temporary files
+.sass-cache
src/tmp
src/public/stylesheets/compiled
--
1.7.6
12 years, 8 months
Re: [ANNOUNCE] Apache Deltacloud 0.4.0 (incubating)
by Michal Fojtik
On Sep 15, 2011, at 12:49 AM, David Lutterkort wrote:
Just FYI:
RPM's was successfully imported to Fedora 14 and 15:
https://admin.fedoraproject.org/updates/deltacloud-core-0.4.0-2.fc15
https://admin.fedoraproject.org/updates/deltacloud-core-0.4.0-2.fc14
(any karma appreciated ;-)
-- Michal
> I am pleased to announce the availability of Apache Deltacloud 0.4.0.
>
> Apache Deltacloud is a RESTful cloud abstraction API. The release
> consists both of the API server and a Ruby client.
>
> The release can be found at
> http://www.apache.org/dist/incubator/deltacloud/0.4.0/ Gems and RPM's
> for Fedora will become available shortly.
>
> Many thanks to all those who contributed patches, reported bugs, and
> asked for features. It's great to see that the list of committers and
> patch contributors is steadily increasing.
>
> Overview of the changes for this release:
>
> Server:
> * deltacloudd: new option --drivers to list all drivers; new option
> --daemon to daemonize the server
> * deltacloudd: new options --ssl, --ssl-key and --ssl-cert to
> enable HTTPS support
> * API entrypoint reports features in JSON
> * unify response behavior: any operation returning a 201 Created also
> sets the Location header to point to the new resource; ensure the
> status for an operation is the same regardless of output format
> * Add type to public addresses; type can be one of 'ipv4', 'mac', 'vnc',
> and 'hostname'
> * Complete overhaul of the HTML UI, now uses jquery-mobile
> * Response status for attach/detach storage is now 202 (instead of 302)
> * Response status for get/set blob metadata is 204 No Content
> * Response status for (un)register with load balancer is 204 No Content
> * The user_name feature now reports the permissible length of the name
> as the 'max_length' constraint
> * Add Date header to responses as per RFC 2616
> * New collection 'firewalls' for managing sets of firewalling rules
> * split server/config/drivers.yaml into individual files so each driver
> can be packaged separately; gives deployers better choice of what
> drivers they want enabled
> * Numerous bug fixes and improvements to the test suite
> * Drivers
> + Condor
> - new driver to run a simple cloud based on the Condor grid scheduler
> + EC2
> - Fix bug in reboot instance so that the details returned are those
> of the stopped instance, not some random instance
> - Support getting and updating blob metadata
> - support destroying images
> - support firewalls (security groups)
> - do not support user_name anymore; instance tagging is too fragile
> in EC2 to be used reliably for this
> - do not support registering an instance with a load balancer upon
> creation anymore
> - stream blob PUT to backend (requires thin)
> - support attaching EBS snapshot to instance upon creation (feature
> 'attach_snapshot')
> - support elastic IP's
> + Eucalyptus
> - support firewalls (security groups)
> - support elastic IP's
> + Gogrid
> - when retrieving single realm, make sure we return the right one
> - correctly capture load_balancer params
> - report a listener if load_balancer has no instances
> + Mock
> - support destroying images
> - refactored driver to fix various bugs, and to make it an easier
> to understand example of how a driver works
> + Rackspace
> - support destroying images
> - stream blob PUT to backend (requires thin)
> + RHEV-M
> - support creating and destroying images
> - report VNC address of instances
> - can use Audrey's confserver to fetch IP of an instance
> + vSphere
> - turns a VMWare vSphere installation into a cloud
> - driver stateless, state is stored in vSphere's data store in
> 'deltacloud' folder
> - images are template VM's
> - single HWP, whose max_cpu and max_memory are based on available
> cpus and memory across all vSphere hosts
> - support data injection via user_data and user_iso (upload entire
> ISO image) For both, instance gets virtual CD-ROM with injected
> data
>
> Client:
> * make authentication info for instances available
> * retrieve type and address for public addresses of an instance
> * deltacloudc: allow specifying bucket location when creating a bucket
>
> Site:
> * Major rewrite of REST API docs, covers the entire API now
> * Add libdeltacloud API docs
> * Add ASF incubator logo and disclaimer to project site
>
> David
>
>
>
------------------------------------------------------
Michal Fojtik, mfojtik(a)redhat.com
Deltacloud API: http://deltacloud.org
12 years, 8 months
[PATCH configure] Add requires on deltacloud-core service in aeolus::conductor::provider
by Richard Su
Wait 1 second after deltacloud-core startup before adding providers.
Wait is needed because deltacloud-core may not have finished initializing
when configure attempts to add providers.
---
contrib/aeolus-configure.spec | 7 ++++++-
recipes/aeolus/manifests/conductor.pp | 2 +-
recipes/aeolus/manifests/deltacloud.pp | 7 +++++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/contrib/aeolus-configure.spec b/contrib/aeolus-configure.spec
index 9ea5831..fdcad62 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.2
-Release: 3%{?extra_release}%{?dist}
+Release: 4%{?extra_release}%{?dist}
Group: Applications/Internet
License: GPLv2+
@@ -62,6 +62,11 @@ Aeolus Configure Puppet Recipe
%{_sbindir}/aeolus-configure-image
%changelog
+* Wed Sep 14 2011 Richard Su <rwsu(a)redhat.com> 2.0.2-4
+- single deltacloud-core
+- rhevm and vsphere configurations moved to their own profiles
+- wait 1 sec after deltacloud-core service startup before providers are added
+
* Tue Aug 30 2011 Maros Zatko <mzatko(a)redhat.com> 2.0.2-3
- Added script for restarting running services
diff --git a/recipes/aeolus/manifests/conductor.pp b/recipes/aeolus/manifests/conductor.pp
index 1cba5cf..4442cc5 100644
--- a/recipes/aeolus/manifests/conductor.pp
+++ b/recipes/aeolus/manifests/conductor.pp
@@ -202,7 +202,7 @@ define aeolus::conductor::provider($deltacloud_driver="",$url="", $deltacloud_pr
use_cookies_at => '/tmp/aeolus-admin',
unless => { 'get' => 'https://localhost/conductor/providers',
'contains' => "//html/body//a[text() = '$name']" },
- require => [Service['aeolus-conductor'], Exec['grant_site_admin_privs']]
+ require => [Service['aeolus-conductor'], Exec['grant_site_admin_privs'], Exec['deltacloud-core-startup-wait']]
}
}
diff --git a/recipes/aeolus/manifests/deltacloud.pp b/recipes/aeolus/manifests/deltacloud.pp
index fe1de2b..187888e 100644
--- a/recipes/aeolus/manifests/deltacloud.pp
+++ b/recipes/aeolus/manifests/deltacloud.pp
@@ -19,6 +19,13 @@ class aeolus::deltacloud::core {
enable => true,
hasstatus => true,
require => [Package['deltacloud-core'], File["/var/log/deltacloud-core"]]}
+
+ # Need to pause for a second for deltacloud-core to complete startup
+ # otherwise one may see connect issues when adding providers
+ exec{"deltacloud-core-startup-wait":
+ cwd => '/bin',
+ command => "/bin/sleep 1",
+ require => Service["deltacloud-core"]}
}
class aeolus::deltacloud::ec2 {
--
1.7.6
12 years, 8 months
[PATCH 1/2] Added json response to catalog entries
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/2221
Used respond_with helper method, except multi_destroy action which
I think should be used only by web UI.
---
src/app/controllers/catalog_entries_controller.rb | 25 ++++++++++++--------
src/app/views/catalog_entries/show.haml | 2 +-
src/config/locales/en.yml | 1 +
src/features/catalog_entries.feature | 2 +-
4 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/app/controllers/catalog_entries_controller.rb b/src/app/controllers/catalog_entries_controller.rb
index 4432691..f48ed8e 100644
--- a/src/app/controllers/catalog_entries_controller.rb
+++ b/src/app/controllers/catalog_entries_controller.rb
@@ -1,5 +1,9 @@
class CatalogEntriesController < ApplicationController
before_filter :require_user
+ respond_to :html
+ # I think multi_destroy action is required only by
+ # web UI, so don't bother about json response in this case
+ respond_to :json, :except => :multi_destroy
def top_section
:administer
@@ -10,18 +14,21 @@ class CatalogEntriesController < ApplicationController
save_breadcrumb(catalog_entries_path(:viewstate => @viewstate ? @viewstate.id : nil))
@catalog_entries = CatalogEntry.list_for_user(current_user, Privilege::VIEW)
set_header
+ respond_with @catalog_entries
end
def new
@catalog_entry = CatalogEntry.new(params[:catalog_entry])
require_privilege(Privilege::CREATE, CatalogEntry)
load_catalogs
+ respond_with @catalog_entry
end
def show
@catalog_entry = CatalogEntry.find(params[:id])
require_privilege(Privilege::VIEW, @catalog_entry)
save_breadcrumb(catalog_entry_path(@catalog_entry), @catalog_entry.name)
+ respond_with @catalog_entry
end
def create
@@ -36,17 +43,17 @@ class CatalogEntriesController < ApplicationController
if @catalog_entry.save
flash[:notice] = 'Catalog entry added'
flash[:warning] = "Deployable url doesn't resolve valid XML file" unless @catalog_entry.accessible_and_valid_deployable_xml?((a)catalog_entry.url)
- redirect_to catalog_entries_path
else
load_catalogs
- render :new
end
+ respond_with @catalog_entry
end
def edit
@catalog_entry = CatalogEntry.find(params[:id])
require_privilege(Privilege::MODIFY, @catalog_entry)
load_catalogs
+ respond_with @catalog_entry
end
def update
@@ -56,11 +63,10 @@ class CatalogEntriesController < ApplicationController
if @catalog_entry.update_attributes(params[:catalog_entry])
flash[:notice] = 'Catalog entry updated successfully!'
- redirect_to catalog_entries_url
else
load_catalogs
- render :action => 'edit'
end
+ respond_with @catalog_entry
end
def multi_destroy
@@ -72,13 +78,12 @@ class CatalogEntriesController < ApplicationController
end
def destroy
- catalog_entry = CatalogEntry.find(params[:id])
- require_privilege(Privilege::MODIFY, catalog_entry)
- catalog_entry.destroy
-
- respond_to do |format|
- format.html { redirect_to catalog_entries_path }
+ @catalog_entry = CatalogEntry.find(params[:id])
+ require_privilege(Privilege::MODIFY, @catalog_entry)
+ unless @catalog_entry.destroy
+ flash[:notice] = t('catalog_entries.destroy_failed', :count => 1)
end
+ respond_with @catalog_entry
end
private
diff --git a/src/app/views/catalog_entries/show.haml b/src/app/views/catalog_entries/show.haml
index 2281236..5ce160b 100644
--- a/src/app/views/catalog_entries/show.haml
+++ b/src/app/views/catalog_entries/show.haml
@@ -5,7 +5,7 @@
= link_to 'New Catalog Entry', new_catalog_entry_url, :class => 'button primary', :id => 'new_catalog_entry_button'
.button-group
= link_to 'Edit', edit_catalog_entry_path(@catalog_entry), :class => 'button pill', :id => 'edit_button'
- = button_to "Delete", catalog_entry_path(@catalog_entry), :method => 'delete', :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'delete_button'
+ = button_to "Delete", catalog_entry_path(@catalog_entry), :method => 'delete', :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'entry_delete_button'
.corner
%section.content-section.user
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 560ae0b..876564b 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -170,6 +170,7 @@ en:
catalog_entries: Catalog Entries
name: Name
url: URL
+ destroy_failed: Failed to destroy catalog entry
catalogs:
index:
name: Name
diff --git a/src/features/catalog_entries.feature b/src/features/catalog_entries.feature
index 3d4ee38..fa1916c 100644
--- a/src/features/catalog_entries.feature
+++ b/src/features/catalog_entries.feature
@@ -55,7 +55,7 @@ Feature: Manage Catalog Entries
Given a catalog entry "testdepl1" exists
And I am on the catalog entries page
When I follow "testdepl1"
- And I press "delete_button"
+ And I press "entry_delete_button"
Then there should be only 0 catalog entries
And I should be on the catalog entries page
And I should not see "testdepl1"
--
1.7.6.2
12 years, 8 months
[PATCH 1/2] Added json response to catalogs
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/2220
Used respond_with helper method, except multi_destroy action which
I think should be used only be web UI.
---
src/app/controllers/catalogs_controller.rb | 39 ++++++++++++++++++----------
src/app/views/catalogs/show.haml | 2 +-
src/config/locales/en.yml | 1 +
src/features/catalogs.feature | 9 +++---
src/features/support/paths.rb | 3 ++
5 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/src/app/controllers/catalogs_controller.rb b/src/app/controllers/catalogs_controller.rb
index e6c2e44..1cda1e8 100644
--- a/src/app/controllers/catalogs_controller.rb
+++ b/src/app/controllers/catalogs_controller.rb
@@ -1,5 +1,9 @@
class CatalogsController < ApplicationController
before_filter :require_user
+ respond_to :html
+ # I think multi_destroy action is required only by
+ # web UI, so don't bother about json response in this case
+ respond_to :json, :except => :multi_destroy
def top_section
:administer
@@ -10,12 +14,14 @@ class CatalogsController < ApplicationController
@catalogs = Catalog.list_for_user(current_user, Privilege::VIEW)
save_breadcrumb(catalogs_path(:viewstate => @viewstate ? @viewstate.id : nil))
set_header
+ respond_with @catalogs
end
def new
require_privilege(Privilege::CREATE, Catalog)
@catalog = Catalog.new(params[:catalog]) # ...when should there be params on new?
load_pools
+ respond_with @catalog
end
def show
@@ -27,6 +33,7 @@ class CatalogsController < ApplicationController
{ :name => t("catalog_entries.index.name"), :sort_attr => :name },
{ :name => t('catalog_entries.index.url'), :sortable => false }
]
+ respond_with @catalog
end
def create
@@ -35,48 +42,52 @@ class CatalogsController < ApplicationController
require_privilege(Privilege::MODIFY, @catalog.pool)
if @catalog.save
flash[:notice] = t('catalogs.created', :count => 1)
- redirect_to catalogs_path and return
else
load_pools
- render :new and return
end
+ respond_with @catalog
end
def edit
@catalog = Catalog.find(params[:id])
load_pools
require_privilege(Privilege::MODIFY, @catalog)
+ respond_with @catalog
end
def update
@catalog = Catalog.find(params[:id])
require_privilege(Privilege::MODIFY, @catalog)
require_privilege(Privilege::MODIFY, @catalog.pool)
-
if @catalog.update_attributes(params[:catalog])
flash[:notice] = t('catalogs.updated', :count => 1)
- redirect_to catalogs_url
- else
- render :action => 'edit'
end
+ respond_with @catalog
end
def multi_destroy
+ failed = []
Catalog.find(params[:catalogs_selected]).to_a.each do |catalog|
require_privilege(Privilege::MODIFY, catalog)
- catalog.destroy
+ unless catalog.destroy
+ failed << catalog.name
+ end
+ end
+ unless failed.empty?
+ flash[:error] = "#{t('catalogs.destroy_failed')}: #{failed.join(', ')}"
+ end
+ respond_to do |format|
+ format.html { redirect_to catalogs_path }
end
- redirect_to catalogs_path
end
def destroy
- catalog = Catalog.find(params[:id])
- require_privilege(Privilege::MODIFY, catalog)
- catalog.destroy
-
- respond_to do |format|
- format.html { redirect_to catalogs_path }
+ @catalog = Catalog.find(params[:id])
+ require_privilege(Privilege::MODIFY, @catalog)
+ unless @catalog.destroy
+ flash[:notice] = t('catalogs.destroy_failed', :count => 1)
end
+ respond_with @catalog
end
private
diff --git a/src/app/views/catalogs/show.haml b/src/app/views/catalogs/show.haml
index fafd962..29825b9 100644
--- a/src/app/views/catalogs/show.haml
+++ b/src/app/views/catalogs/show.haml
@@ -5,7 +5,7 @@
= link_to 'New Catalog', new_catalog_url, :class => 'button primary', :id => 'new_catalog_entry_button'
.button-group
= link_to 'Edit', edit_catalog_path(@catalog), :class => 'button pill', :id => 'edit_button'
- = button_to "Delete", catalog_path(@catalog), :method => 'delete', :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'delete_button'
+ = button_to "Delete", catalog_path(@catalog), :method => 'delete', :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'catalog_delete_button'
.corner
%section.content-section.user
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 8d62ee3..560ae0b 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -181,6 +181,7 @@ en:
created:
one: Catalog created!
many: Catalogs created!
+ destroy_failed: Failed to destroy catalog
deployables:
index:
deployables: Deployables
diff --git a/src/features/catalogs.feature b/src/features/catalogs.feature
index caf11f1..15a92cc 100644
--- a/src/features/catalogs.feature
+++ b/src/features/catalogs.feature
@@ -15,7 +15,7 @@ Feature: Manage Catalogs
And I fill in "catalog_name" with "Finance"
And I select "default" from "catalog_pool_id"
And I press "Save"
- Then I should be on the catalogs page
+ Then I should be on Finance's catalog page
And I should see "Finance"
Scenario: Show catalog details
@@ -31,7 +31,7 @@ Feature: Manage Catalogs
And I follow "edit_button"
And I fill in "Engineering" for "catalog[name]"
And I press "Save"
- Then I should be on the catalogs page
+ Then I should be on Engineering's catalog page
And I should see "Engineering"
And I should not see "Development"
@@ -39,6 +39,7 @@ Feature: Manage Catalogs
Given there is a "Bad" catalog
And I am on the catalogs page
When I follow "Bad"
- And I press "Delete"
+ And show me the page
+ And I press "catalog_delete_button"
Then I should be on the catalogs page
- And I should not see "Bad"
\ No newline at end of file
+ And I should not see "Bad"
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index f3db6ff..cd366df 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -26,6 +26,9 @@ module NavigationHelpers
when /^(.*)'s realm page$/i
realm_path(FrontendRealm.find_by_name($1))
+ when /^(.*)'s catalog page$/i
+ catalog_path(Catalog.find_by_name($1))
+
when /the account page/
account_path
--
1.7.6
12 years, 8 months