[PATCH conductor] XML format for list of provider types
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
task #1621 (https://www.aeolusproject.org/redmine/issues/1621)
---
src/app/controllers/provider_types_controller.rb | 10 +++++++++
src/app/views/provider_types/_list.xml.haml | 7 ++++++
src/config/routes.rb | 1 +
src/db/seeds.rb | 1 +
src/features/provider_type.feature | 22 ++++++++++++++++++++
.../step_definitions/provider_type_steps.rb | 13 +++++++++++
6 files changed, 54 insertions(+), 0 deletions(-)
create mode 100644 src/app/controllers/provider_types_controller.rb
create mode 100644 src/app/views/provider_types/_list.xml.haml
create mode 100644 src/features/provider_type.feature
create mode 100644 src/features/step_definitions/provider_type_steps.rb
diff --git a/src/app/controllers/provider_types_controller.rb b/src/app/controllers/provider_types_controller.rb
new file mode 100644
index 0000000..8b65f89
--- /dev/null
+++ b/src/app/controllers/provider_types_controller.rb
@@ -0,0 +1,10 @@
+class ProviderTypesController < ApplicationController
+ before_filter :require_user
+
+ def index
+ @provider_types = ProviderType.all
+ respond_to do |format|
+ format.xml { render :partial => 'list.xml' }
+ end
+ end
+end
diff --git a/src/app/views/provider_types/_list.xml.haml b/src/app/views/provider_types/_list.xml.haml
new file mode 100644
index 0000000..6363806
--- /dev/null
+++ b/src/app/views/provider_types/_list.xml.haml
@@ -0,0 +1,7 @@
+!!! XML
+%provider_types
+ - @provider_types.each do |p|
+ %provider_type
+ %name= p.name
+ %codename= p.codename
+ %build_supported= p.build_supported
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 5d48373..5aa6414 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -48,6 +48,7 @@ ActionController::Routing::Routes.draw do |map|
map.resources :hardware_profiles, :collection => { :multi_destroy => :delete }
map.resources :providers, :collection => { :multi_destroy => :delete }
+ map.resources :provider_types
map.resources :users, :collection => { :multi_destroy => :delete }
map.resources :provider_accounts, :collection => { :multi_destroy => :delete, :set_selected_provider => :get}
map.resources :roles, :collection => { :multi_destroy => :delete }
diff --git a/src/db/seeds.rb b/src/db/seeds.rb
index 3ab3131..ad2c770 100644
--- a/src/db/seeds.rb
+++ b/src/db/seeds.rb
@@ -120,6 +120,7 @@ if ProviderType.all.empty?
ProviderType.create!(:name => "Rackspace", :codename =>"rackspace")
ProviderType.create!(:name => "RHEV-M", :codename =>"rhev-m")
ProviderType.create!(:name => "OpenNebula", :codename =>"opennebula")
+ ProviderType.create!(:name => "CondorCloud", :codename =>"condorcloud", :build_supported => 'true')
end
# fill table CredentialDefinitions by default values
diff --git a/src/features/provider_type.feature b/src/features/provider_type.feature
new file mode 100644
index 0000000..5948533
--- /dev/null
+++ b/src/features/provider_type.feature
@@ -0,0 +1,22 @@
+Feature: Manage Providers
+ In order to manage my cloud infrastructure
+ As a user
+ I want to manage cloud providers
+
+ Background:
+ Given I am an authorised user
+ And I am logged in
+
+ Scenario: List providers in XML format
+ Given I accept XML
+ When I go to the provider types page
+ Then I should get a XML document
+ And there should be these provider types:
+ | name | codename | build_supported |
+ | Mock | mock | true |
+ | GoGrid | gogrid | false |
+ | Rackspace | rackspace | false |
+ | OpenNebula | opennebula | false |
+ | Amazon EC2 | ec2 | true |
+ | CondorCloud | condorcloud | true |
+ | RHEV-M | rhev-m | false |
diff --git a/src/features/step_definitions/provider_type_steps.rb b/src/features/step_definitions/provider_type_steps.rb
new file mode 100644
index 0000000..0b0760a
--- /dev/null
+++ b/src/features/step_definitions/provider_type_steps.rb
@@ -0,0 +1,13 @@
+Then /^there should be these provider types:$/ do |table|
+ types = @xml_response.root.xpath('/provider_types/provider_type').map do |n|
+ {:name => n.xpath('name').text,
+ :codename => n.xpath('codename').text,
+ :build_supported => n.xpath('build_supported').text}
+ end
+ table.hashes.each do |hash|
+ p = types.find {|n| n[:name] == hash[:name]}
+ p.should_not be_nil
+ p[:codename].should == hash[:codename]
+ p[:build_supported].should == hash[:build_supported]
+ end
+end
--
1.7.4
12 years, 11 months
Add the backbone.js libraries to Conductor
by Tomas Sedovic
All,
This patchset prepares us for using Backbone[1]. It adds the necessary
JavaScript libraries, makes sure they're hooked up in the app and all.
Git-email had some complaints about the lines being too long (what did
it expect? It's minified JavaScript) so I'm adding the patches as an
attachment.
The first patch removes a piece of code that would otherwise prevented
the Backbone calls to work and fixes (hopefully) the underlying issue.
Note that this doesn't actually contain any backbone client code such as
models, views or controllers.
I'll get to that tomorrow.
Thomas
[1]: http://documentcloud.github.com/backbone/
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.
12 years, 11 months
[PATCH] Pools, Instances, and Deployments render partials for XHR.
by Matt Wagner
Implements https://www.aeolusproject.org/redmine/issues/1449
---
src/app/controllers/application_controller.rb | 9 +++++++
src/app/controllers/deployments_controller.rb | 20 ++++++++++++++++
src/app/controllers/instances_controller.rb | 23 ++++++++++++++++++
src/app/controllers/pools_controller.rb | 14 +++++++++++
src/app/views/deployments/_edit.haml | 11 +++++++++
src/app/views/deployments/_launch_new.haml | 8 ++++++
src/app/views/deployments/_list.haml | 3 ++
src/app/views/deployments/_new.haml | 25 ++++++++++++++++++++
src/app/views/deployments/_properties.haml | 11 +++++++-
src/app/views/deployments/edit.haml | 12 +---------
src/app/views/deployments/launch_new.haml | 7 +-----
src/app/views/deployments/new.haml | 26 +--------------------
src/app/views/instances/_edit.haml | 10 ++++++++
src/app/views/instances/_new.haml | 27 +++++++++++++++++++++
src/app/views/instances/edit.haml | 11 +--------
src/app/views/instances/new.haml | 28 +---------------------
src/app/views/pools/_edit.haml | 30 ++++++++++++++++++++++++
src/app/views/pools/_new.haml | 27 +++++++++++++++++++++
src/app/views/pools/_show.haml | 10 ++++++++
src/app/views/pools/edit.haml | 31 +------------------------
src/app/views/pools/new.haml | 28 +---------------------
21 files changed, 233 insertions(+), 138 deletions(-)
create mode 100644 src/app/views/deployments/_edit.haml
create mode 100644 src/app/views/deployments/_launch_new.haml
create mode 100644 src/app/views/deployments/_new.haml
create mode 100644 src/app/views/instances/_edit.haml
create mode 100644 src/app/views/instances/_new.haml
create mode 100644 src/app/views/pools/_edit.haml
create mode 100644 src/app/views/pools/_new.haml
create mode 100644 src/app/views/pools/_show.haml
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index 746811b..e4536a7 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -39,6 +39,8 @@ class ApplicationController < ActionController::Base
helper_method :check_privilege
+ before_filter :js_for_xhr
+
protected
# permissions checking
@@ -224,4 +226,11 @@ class ApplicationController < ActionController::Base
redirect_to(default || session[:return_to])
session[:return_to] = nil
end
+
+ # XMLHTTPRequest in many browsers sends "Accept: */*", so the first respond_to will match.
+ # See http://codetunes.com/2009/01/31/rails-222-ajax-and-respond_to/ and
+ # http://www.grauw.nl/blog/entry/470 for more.
+ def js_for_xhr
+ request.format = :js if request.xhr?
+ end
end
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index bdf40de..2afab1c 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -5,6 +5,7 @@ class DeploymentsController < ApplicationController
def index
respond_to do |format|
+ format.js { render :partial => 'list' }
format.html
format.json { render :json => @deployments }
end
@@ -16,6 +17,7 @@ class DeploymentsController < ApplicationController
@launchable_deployables << deployable if deployable.launchable?
end
respond_to do |format|
+ format.js { render :partial => 'launch_new' }
format.html
format.json { render :json => @launchable_deployables }
end
@@ -27,10 +29,15 @@ class DeploymentsController < ApplicationController
respond_to do |format|
if @deployment.deployable.assemblies.empty?
flash[:warning] = "Deployable must have at least one assembly"
+ format.js do
+ load_deployments
+ render :partial => 'list'
+ end
format.html { redirect_to deployments_path }
format.json { render :json => {:error => flash[:warning]}, :status => :unprocessable_entity }
else
init_new_deployment_attrs
+ format.js { render :partial => 'new' }
format.html
format.json { render :json => @deployment }
end
@@ -51,11 +58,13 @@ class DeploymentsController < ApplicationController
:failures => errors
}
end
+ format.js { render :partial => 'properties' }
format.html { redirect_to deployment_path(@deployment) }
format.json { render :json => @deployment, :status => :created }
else
flash.now[:warning] = "Deployment launch failed"
init_new_deployment_attrs
+ format.js { launch_new }
format.html { render :action => 'new' }
format.json { render :json => @deployment.errors, :status => :unprocessable_entity }
end
@@ -83,6 +92,7 @@ class DeploymentsController < ApplicationController
def edit
require_privilege(Privilege::MODIFY, @deployment)
respond_to do |format|
+ format.js { render :partial => 'edit' }
format.html
format.json { render :json => @deployment }
end
@@ -95,10 +105,12 @@ class DeploymentsController < ApplicationController
respond_to do |format|
if check_privilege(Privilege::MODIFY, @deployment) and @deployment.update_attributes(attrs)
flash[:success] = t('deployments.updated', :count => 1, :list => @deployment.name)
+ format.js { render :partial => 'properties' }
format.html { redirect_to @deployment }
format.json { render :json => @deployment }
else
flash[:error] = t('deployments.not_updated', :count => 1, :list => @deployment.name)
+ format.js { render :partial => 'edit' }
format.html { render :action => :edit }
format.json { render :json => @deployment.errors, :status => :unprocessable_entity }
end
@@ -119,6 +131,10 @@ class DeploymentsController < ApplicationController
flash[:success] = t('deployments.deleted', :list => destroyed, :count => destroyed.size) if destroyed.present?
flash[:error] = t('deployments.not_deleted', :list => failed, :count => failed.size) if failed.present?
respond_to do |format|
+ format.js do
+ load_deployments
+ render :partial => 'list'
+ end
format.html { redirect_to deployments_url }
format.json { render :json => {:success => destroyed, :errors => failed} }
end
@@ -151,6 +167,10 @@ class DeploymentsController < ApplicationController
flash[:notice] = notices unless notices.blank?
flash[:error] = errors unless errors.blank?
respond_to do |format|
+ format.js do
+ load_deployments
+ render :partial => 'list'
+ end
format.html { redirect_to deployments_path }
format.json { render :json => {:success => notices, :errors => errors} }
end
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index f04db3c..c01a5ea 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -13,6 +13,7 @@ class InstancesController < ApplicationController
end
respond_to do |format|
+ format.js { render :partial => 'list' }
format.html
format.json { render :json => @instances }
end
@@ -29,6 +30,7 @@ class InstancesController < ApplicationController
init_new_instance_attrs
respond_to do |format|
+ format.js { render :partial => 'new' }
format.html
format.json { render :json => @instance }
end
@@ -75,6 +77,7 @@ class InstancesController < ApplicationController
rescue
init_new_instance_attrs
flash[:warning] = "Failed to launch instance: #{$!}"
+ format.js { render :partial => 'new' }
format.html { render :new }
format.json { render :json => @instance, :status => :unprocessable_entity}
else
@@ -83,6 +86,7 @@ class InstancesController < ApplicationController
else
flash[:warning] = "Quota Exceeded: Instance will not start until you have free quota"
end
+ format.js { render :partial => 'properties', :id => @instance.id }
format.html { redirect_to instances_path }
format.json { render :json => @instance, :status => :created }
end
@@ -108,6 +112,11 @@ class InstancesController < ApplicationController
def edit
require_privilege(Privilege::MODIFY, @instance)
+ respond_to do |format|
+ format.js { render :partial => 'edit', :id => @instance.id }
+ format.html
+ format.json { render :json => @instance }
+ end
end
def update
@@ -119,10 +128,12 @@ class InstancesController < ApplicationController
respond_to do |format|
if check_privilege(Privilege::MODIFY, @instance) and @instance.update_attributes(attrs)
flash[:success] = t('instances.updated', :count => 1, :list => @instance.name)
+ format.js { render :partial => 'properties' }
format.html { redirect_to @instance }
format.json { render :json => @instance }
else
flash[:error] = t('instances.not_updated', :count =>1, :list => @instance.name)
+ format.js { render :partial => 'edit' }
format.html { render :action => :edit }
format.json { render :json => @instance.errors, :status => :unprocessable_entity }
end
@@ -143,6 +154,12 @@ class InstancesController < ApplicationController
flash[:success] = t('instances.deleted', :list => destroyed.to_sentence, :count => destroyed.size) if destroyed.present?
flash[:error] = t('instances.not_deleted', :list => failed.to_sentence, :count => failed.size) if failed.present?
respond_to do |format|
+ # FIXME: _list does not show flash messages, but I'm not sure that showing _list is proper anyway
+ format.js do
+ set_view_vars
+ load_instances
+ render :partial => 'list'
+ end
format.html { render :action => :show }
format.json { render :json => {:success => destroyed, :errors => failed} }
end
@@ -152,9 +169,15 @@ class InstancesController < ApplicationController
respond_to do |format|
if @instance.instance_key.nil?
flash[:warning] = "SSH Key not found for this Instance."
+ format.js { render :partial => 'properties' }
format.html { redirect_to instance_path(@instance) }
format.json { render :json => flash[:warning], :status => :not_found }
else
+ format.js do
+ send_data @instance.instance_key.pem,
+ :filename => "#{(a)instance.instance_key.name}.pem",
+ :type => "text/plain"
+ end
format.html { send_data @instance.instance_key.pem,
:filename => "#{(a)instance.instance_key.name}.pem",
:type => "text/plain" }
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index ea09745..4101e2c 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -11,6 +11,7 @@ class PoolsController < ApplicationController
@pools = Pool.search() { keywords(params[:q]) }.results
end
respond_to do |format|
+ format.js { render :partial => 'list' }
format.html
format.json { render :json => @pools }
end
@@ -24,6 +25,7 @@ class PoolsController < ApplicationController
@tab_captions = ['Properties', 'Deployments', 'Instances', 'History', 'Permissions']
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
respond_to do |format|
+ # TODO - With the new UI, the logic here will probably need to be updated
format.js do
if @url_params.delete :details_pane
render :partial => 'layouts/details_pane' and return
@@ -42,6 +44,7 @@ class PoolsController < ApplicationController
respond_to do |format|
format.html
format.json { render :json => @pool }
+ format.js { render :partial => 'new' }
end
end
@@ -59,9 +62,12 @@ class PoolsController < ApplicationController
@pool.assign_owner_roles(current_user)
flash[:notice] = "Pool added."
format.html { redirect_to :action => 'show', :id => @pool.id }
+ # TODO - The new UI is almost certainly going to want a new partial for .js
+ format.js { render :partial => 'show', :id => @pool.id }
format.json { render :json => @pool, :status => :created }
else
flash.now[:warning] = "Pool creation failed."
+ format.js { render :partial => 'new' }
format.html { render :new }
format.json { render :json => @pool.errors, :status => :unprocessable_entity }
end
@@ -73,6 +79,7 @@ class PoolsController < ApplicationController
require_privilege(Privilege::MODIFY, @pool)
@quota = @pool.quota
respond_to do |format|
+ format.js { render :partial => 'edit' }
format.html
format.json { render :json => @pool }
end
@@ -88,10 +95,12 @@ class PoolsController < ApplicationController
respond_to do |format|
if @pool.update_attributes(params[:pool])
flash[:notice] = "Pool updated."
+ format.js { render :partial => 'show', :id => @pool.id }
format.html { redirect_to :action => 'show', :id => @pool.id }
format.json { render :json => @pool }
else
flash[:error] = "Pool wasn't updated!"
+ format.js { render :partial => 'edit', :id => @pool.id }
format.html { render :action => :edit }
format.json { render :json => @pool.errors, :status => :unprocessable_entity }
end
@@ -115,6 +124,11 @@ class PoolsController < ApplicationController
flash[:success] = t('pools.index.pool_deleted', :list => destroyed.to_sentence, :count => destroyed.size) if destroyed.present?
flash[:error] = t('pools.index.pool_not_deleted', :list => failed.to_sentence, :count => failed.size) if failed.present?
respond_to do |format|
+ # TODO - What is expected to be returned on an AJAX delete?
+ format.js do
+ load_pools
+ render :partial => 'list'
+ end
format.html { redirect_to pools_url }
format.json { render :json => {:success => destroyed, :errors => failed} }
end
diff --git a/src/app/views/deployments/_edit.haml b/src/app/views/deployments/_edit.haml
new file mode 100644
index 0000000..72c8e60
--- /dev/null
+++ b/src/app/views/deployments/_edit.haml
@@ -0,0 +1,11 @@
+= error_messages_for 'deployment'
+%h2 Edit deployment
+- form_for @deployment do
+ = hidden_field :deployment, :deployable_id
+ %ul
+ %li
+ = label :deployment, :name
+ = text_field :deployment, :name
+
+ = submit_tag 'Cancel', :name => 'cancel'
+ = submit_tag 'Save', :name => 'save'
diff --git a/src/app/views/deployments/_launch_new.haml b/src/app/views/deployments/_launch_new.haml
new file mode 100644
index 0000000..34126dd
--- /dev/null
+++ b/src/app/views/deployments/_launch_new.haml
@@ -0,0 +1,8 @@
+= if request.xhr?
+ = render :partial => '/layouts/notification'
+%h2 Launch new deployment via
+- form_tag new_deployment_path, :method => :get do
+ = label_tag "Deployable:"
+ = select_tag :deployable_id, options_from_collection_for_select(@launchable_deployables, "id", "name")
+ = submit_tag "Launch"
+ = link_to "Cancel", deployments_path, :class => "button"
diff --git a/src/app/views/deployments/_list.haml b/src/app/views/deployments/_list.haml
index 2d89766..3f8064e 100644
--- a/src/app/views/deployments/_list.haml
+++ b/src/app/views/deployments/_list.haml
@@ -1,3 +1,6 @@
+= if request.xhr?
+ = render :partial => '/layouts/notification'
+
- form_tag do
#object-actions
= restful_submit_tag "Start", "start", deployments_path, "PUT"
diff --git a/src/app/views/deployments/_new.haml b/src/app/views/deployments/_new.haml
new file mode 100644
index 0000000..390840d
--- /dev/null
+++ b/src/app/views/deployments/_new.haml
@@ -0,0 +1,25 @@
+= error_messages_for 'deployment'
+%h2 Launch deployable
+- form_for @deployment, :url => deployments_path do
+ = hidden_field :deployment, :deployable_id
+ %ul
+ %li
+ = label :deployment, :name
+ = text_field :deployment, :name
+ %li
+ = label :deployment, :pool
+ = select :deployment, :pool_id, @pools.map {|p| [ p.name, p.id ]}, { :include_blank => true }
+ %li
+ = label :deployment, :frontend_realm
+ = select :deployment, :frontend_realm_id, @realms.map {|r| [ r.name, r.id ]}, { :include_blank => true }
+ %p
+ %h3 Assemblies hardware profiles
+ %ul
+ - @deployment.deployable.assemblies.each do |assembly|
+ %li
+ - hwprofiles = @hardware_profiles.select {|hwp| hwp.architecture.value == assembly.templates.first.architecture}
+ = label_tag "hw_profiles[#{assembly.id}]", assembly.name
+ = select_tag "hw_profiles[#{assembly.id}]", options_from_collection_for_select(hwprofiles, 'id', 'name')
+
+ = submit_tag 'Cancel', :name => 'cancel'
+ = submit_tag 'Launch', :name => 'launch'
diff --git a/src/app/views/deployments/_properties.haml b/src/app/views/deployments/_properties.haml
index 5d2c584..b5e27af 100644
--- a/src/app/views/deployments/_properties.haml
+++ b/src/app/views/deployments/_properties.haml
@@ -1,2 +1,9 @@
-%h3 Owner Details
-%h3 CDL
+%h3
+ = @deployment.name
+%ul
+ %li
+ Pool:
+ = @deployment.pool.name
+ %li
+ Created:
+ = @deployment.created_at
\ No newline at end of file
diff --git a/src/app/views/deployments/edit.haml b/src/app/views/deployments/edit.haml
index 72c8e60..ea8dd88 100644
--- a/src/app/views/deployments/edit.haml
+++ b/src/app/views/deployments/edit.haml
@@ -1,11 +1 @@
-= error_messages_for 'deployment'
-%h2 Edit deployment
-- form_for @deployment do
- = hidden_field :deployment, :deployable_id
- %ul
- %li
- = label :deployment, :name
- = text_field :deployment, :name
-
- = submit_tag 'Cancel', :name => 'cancel'
- = submit_tag 'Save', :name => 'save'
+= render :partial => 'edit'
\ No newline at end of file
diff --git a/src/app/views/deployments/launch_new.haml b/src/app/views/deployments/launch_new.haml
index 6edf475..916a842 100644
--- a/src/app/views/deployments/launch_new.haml
+++ b/src/app/views/deployments/launch_new.haml
@@ -1,6 +1 @@
-%h2 Launch new deployment via
-- form_tag new_deployment_path, :method => :get do
- = label_tag "Deployable:"
- = select_tag :deployable_id, options_from_collection_for_select(@launchable_deployables, "id", "name")
- = submit_tag "Launch"
- = link_to "Cancel", deployments_path, :class => "button"
+= render :partial => 'launch_new'
\ No newline at end of file
diff --git a/src/app/views/deployments/new.haml b/src/app/views/deployments/new.haml
index 390840d..949343a 100644
--- a/src/app/views/deployments/new.haml
+++ b/src/app/views/deployments/new.haml
@@ -1,25 +1 @@
-= error_messages_for 'deployment'
-%h2 Launch deployable
-- form_for @deployment, :url => deployments_path do
- = hidden_field :deployment, :deployable_id
- %ul
- %li
- = label :deployment, :name
- = text_field :deployment, :name
- %li
- = label :deployment, :pool
- = select :deployment, :pool_id, @pools.map {|p| [ p.name, p.id ]}, { :include_blank => true }
- %li
- = label :deployment, :frontend_realm
- = select :deployment, :frontend_realm_id, @realms.map {|r| [ r.name, r.id ]}, { :include_blank => true }
- %p
- %h3 Assemblies hardware profiles
- %ul
- - @deployment.deployable.assemblies.each do |assembly|
- %li
- - hwprofiles = @hardware_profiles.select {|hwp| hwp.architecture.value == assembly.templates.first.architecture}
- = label_tag "hw_profiles[#{assembly.id}]", assembly.name
- = select_tag "hw_profiles[#{assembly.id}]", options_from_collection_for_select(hwprofiles, 'id', 'name')
-
- = submit_tag 'Cancel', :name => 'cancel'
- = submit_tag 'Launch', :name => 'launch'
+= render :partial => 'new'
\ No newline at end of file
diff --git a/src/app/views/instances/_edit.haml b/src/app/views/instances/_edit.haml
new file mode 100644
index 0000000..dfce76f
--- /dev/null
+++ b/src/app/views/instances/_edit.haml
@@ -0,0 +1,10 @@
+= error_messages_for 'instance'
+%h2 Edit instance
+- form_for @instance do
+ %ul
+ %li
+ = label :instance, :name
+ = text_field :instance, :name
+
+ = submit_tag 'Cancel', :name => 'cancel'
+ = submit_tag 'Save', :name => 'save'
diff --git a/src/app/views/instances/_new.haml b/src/app/views/instances/_new.haml
new file mode 100644
index 0000000..139d08d
--- /dev/null
+++ b/src/app/views/instances/_new.haml
@@ -0,0 +1,27 @@
+= error_messages_for 'instance'
+%h2 Launch instance
+- form_for @instance, :url => instances_path do
+ = hidden_field :instance, :template_id
+ %ul
+ %li
+ = label :instance, :name
+ = text_field :instance, :name
+ %li
+ = label :instance, :template
+ = text_field_tag :template_name, @instance.template ? @instance.template.name : '', :disabled => true
+ %li
+ = label :instance, :pool
+ - if @instance.pool
+ = text_field_tag :pool_name, @instance.pool.name, :disabled => true
+ = hidden_field :instance, :pool_id
+ - else
+ = select :instance, :pool_id, @pools.map {|p| [ p.name, p.id ]}, { :include_blank => true }
+ %li
+ = label :instance, :hardware_profile
+ = select :instance, :hardware_profile_id, @hardware_profiles.map {|p| [ p.name, p.id ]}, { :include_blank => false }
+ %li
+ = label :instance, :frontend_realm
+ = select :instance, :frontend_realm_id, @realms.map {|r| [ r.name, r.id ]}, { :include_blank => true }
+
+ = submit_tag 'Cancel', :name => 'cancel'
+ = submit_tag 'Launch', :name => 'launch'
diff --git a/src/app/views/instances/edit.haml b/src/app/views/instances/edit.haml
index dfce76f..8e2be85 100644
--- a/src/app/views/instances/edit.haml
+++ b/src/app/views/instances/edit.haml
@@ -1,10 +1 @@
-= error_messages_for 'instance'
-%h2 Edit instance
-- form_for @instance do
- %ul
- %li
- = label :instance, :name
- = text_field :instance, :name
-
- = submit_tag 'Cancel', :name => 'cancel'
- = submit_tag 'Save', :name => 'save'
+= render :partial => 'edit'
diff --git a/src/app/views/instances/new.haml b/src/app/views/instances/new.haml
index 139d08d..949343a 100644
--- a/src/app/views/instances/new.haml
+++ b/src/app/views/instances/new.haml
@@ -1,27 +1 @@
-= error_messages_for 'instance'
-%h2 Launch instance
-- form_for @instance, :url => instances_path do
- = hidden_field :instance, :template_id
- %ul
- %li
- = label :instance, :name
- = text_field :instance, :name
- %li
- = label :instance, :template
- = text_field_tag :template_name, @instance.template ? @instance.template.name : '', :disabled => true
- %li
- = label :instance, :pool
- - if @instance.pool
- = text_field_tag :pool_name, @instance.pool.name, :disabled => true
- = hidden_field :instance, :pool_id
- - else
- = select :instance, :pool_id, @pools.map {|p| [ p.name, p.id ]}, { :include_blank => true }
- %li
- = label :instance, :hardware_profile
- = select :instance, :hardware_profile_id, @hardware_profiles.map {|p| [ p.name, p.id ]}, { :include_blank => false }
- %li
- = label :instance, :frontend_realm
- = select :instance, :frontend_realm_id, @realms.map {|r| [ r.name, r.id ]}, { :include_blank => true }
-
- = submit_tag 'Cancel', :name => 'cancel'
- = submit_tag 'Launch', :name => 'launch'
+= render :partial => 'new'
\ No newline at end of file
diff --git a/src/app/views/pools/_edit.haml b/src/app/views/pools/_edit.haml
new file mode 100644
index 0000000..94e486f
--- /dev/null
+++ b/src/app/views/pools/_edit.haml
@@ -0,0 +1,30 @@
+= error_messages_for :pool
+%h1
+ Edit pool
+ = @pool.name
+
+- form_for @pool do |form|
+ %fieldset
+ = form.label :name, "Name:", :class => "grid_2 alpha"
+ = form.text_field :name
+ %fieldset
+ = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
+ = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
+ %fieldset
+ = label_tag "Quota"
+ = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
+ (
+ %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
+ = t('provider_accounts.form.unlimited_quota')
+ )
+ %fieldset
+ = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
+ = form.check_box :enabled
+ %fieldset.clear
+
+ = form.submit "Save"
+
+:javascript
+ function set_unlimited_quota(elem_id) {
+ $("#" + elem_id)[0].value = "unlimited";
+ }
diff --git a/src/app/views/pools/_new.haml b/src/app/views/pools/_new.haml
new file mode 100644
index 0000000..09df69e
--- /dev/null
+++ b/src/app/views/pools/_new.haml
@@ -0,0 +1,27 @@
+= error_messages_for :pool
+%h1 Create a new Pool
+- form_for @pool, :url => pools_path do |form|
+ %fieldset
+ = form.label :name, "Name:", :class => "grid_2 alpha"
+ = form.text_field :name
+ %fieldset
+ = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
+ = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
+ %fieldset
+ = label_tag "Quota:"
+ = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
+ (
+ %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
+ = t('provider_accounts.form.unlimited_quota')
+ )
+ %fieldset
+ = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
+ = form.check_box :enabled
+ %fieldset.clear
+
+ = form.submit "Save"
+
+:javascript
+ function set_unlimited_quota(elem_id) {
+ $("#" + elem_id)[0].value = "unlimited";
+ }
diff --git a/src/app/views/pools/_show.haml b/src/app/views/pools/_show.haml
new file mode 100644
index 0000000..7bb4f81
--- /dev/null
+++ b/src/app/views/pools/_show.haml
@@ -0,0 +1,10 @@
+= @pool.name
+%dl
+ %dt
+ ID:
+ %dd
+ = @pool.id
+ %dt
+ Pool family:
+ %dd
+ = @pool.pool_family.name
\ No newline at end of file
diff --git a/src/app/views/pools/edit.haml b/src/app/views/pools/edit.haml
index d4c511f..ea8dd88 100644
--- a/src/app/views/pools/edit.haml
+++ b/src/app/views/pools/edit.haml
@@ -1,30 +1 @@
-= error_messages_for :pool
-%h1
- Edit pool
- = @pool.name
-
-- form_for [:resources, @pool] do |form|
- %fieldset
- = form.label :name, "Name:", :class => "grid_2 alpha"
- = form.text_field :name
- %fieldset
- = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
- = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
- %fieldset
- = label_tag "Quota"
- = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
- (
- %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
- = t('provider_accounts.form.unlimited_quota')
- )
- %fieldset
- = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
- = form.check_box :enabled
- %fieldset.clear
-
- = form.submit "Save"
-
-:javascript
- function set_unlimited_quota(elem_id) {
- $("#" + elem_id)[0].value = "unlimited";
- }
+= render :partial => 'edit'
\ No newline at end of file
diff --git a/src/app/views/pools/new.haml b/src/app/views/pools/new.haml
index 09df69e..949343a 100644
--- a/src/app/views/pools/new.haml
+++ b/src/app/views/pools/new.haml
@@ -1,27 +1 @@
-= error_messages_for :pool
-%h1 Create a new Pool
-- form_for @pool, :url => pools_path do |form|
- %fieldset
- = form.label :name, "Name:", :class => "grid_2 alpha"
- = form.text_field :name
- %fieldset
- = form.label :pool_family_id, "Pool Family:", :class => "grid_2 alpha"
- = form.collection_select :pool_family_id, PoolFamily.all, :id, :name
- %fieldset
- = label_tag "Quota:"
- = text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || "unlimited", :id => "quota_instances", :class => "grid_3 omega"
- (
- %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
- = t('provider_accounts.form.unlimited_quota')
- )
- %fieldset
- = form.label :enabled, "Enabled:",{ :class => "grid_2 alpha" }
- = form.check_box :enabled
- %fieldset.clear
-
- = form.submit "Save"
-
-:javascript
- function set_unlimited_quota(elem_id) {
- $("#" + elem_id)[0].value = "unlimited";
- }
+= render :partial => 'new'
\ No newline at end of file
--
1.7.4.4
12 years, 11 months
[PATCH conductor] Don't require Image Warehouse for tests
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
Previously, both the RSpec and Cucumber tests for image import failed when the
Image Warehouse service was not started.
This stubs the `upload` method when the tests are running.
---
src/features/image_import.feature | 1 +
.../step_definitions/image_import_steps.rb | 5 +++++
src/spec/models/image_spec.rb | 4 ++++
3 files changed, 10 insertions(+), 0 deletions(-)
create mode 100644 src/features/step_definitions/image_import_steps.rb
diff --git a/src/features/image_import.feature b/src/features/image_import.feature
index a5e9d58..1f85309 100644
--- a/src/features/image_import.feature
+++ b/src/features/image_import.feature
@@ -10,6 +10,7 @@ Feature: Import Images
And there is a provider named "testprovider"
And there is a provider account named "provider1"
And There is a mock pulp repository
+ And Image Warehouse is running
When I go to the new image import page
Then I should be on the new image import page
diff --git a/src/features/step_definitions/image_import_steps.rb b/src/features/step_definitions/image_import_steps.rb
new file mode 100644
index 0000000..baf0cb1
--- /dev/null
+++ b/src/features/step_definitions/image_import_steps.rb
@@ -0,0 +1,5 @@
+Given /^Image Warehouse is running$/ do
+ # Stub the `upload` class method. This saves us from requining
+ # Image Warehouse daemon to be running for the tests.
+ ImageWarehouseObject.send(:define_method, :upload) { nil }
+end
diff --git a/src/spec/models/image_spec.rb b/src/spec/models/image_spec.rb
index b902fe1..001b197 100644
--- a/src/spec/models/image_spec.rb
+++ b/src/spec/models/image_spec.rb
@@ -58,6 +58,10 @@ describe Image do
account.stub!(:valid_credentials?).and_return(true)
account.save!
+ # Stub the `upload` class method. This saves us from requining
+ # Image Warehouse daemon to be running for the tests.
+ ImageWarehouseObject.send(:define_method, :upload) { nil }
+
lambda do
lambda do
lambda do
--
1.7.4.4
12 years, 11 months
Markdown & webby for F14
by Justin Clift
Hi Chris,
Finally getting around to making sure the Aeolus
website builds with Webby on F14. Using the gems
from your personal redhat site:
http://people.redhat.com/clalance/
The only thing of note showing up, is the lack of
an "rdiscount" rubygem in rpm format. It stops
Markdown pages being processed.
ie:
[20:17:02] ERROR: while rendering page 'content/conductor-install.mdown'
[20:17:02] ERROR: markdown filter error: "'rdiscount' must be installed to use the markdown filter"
[20:17:03] ERROR: while rendering page 'content/getting_started.haml'
[20:17:03] ERROR: haml filter error: "Can't run Markdown filter; required 'rdiscount' or 'peg_markdown' or 'maruku' or 'bluecloth', but none were found"
There are only 4 pages with Markdown bits in them,
so easiest fix is converting them to standard haml.
(doing now)
Personally, I don't use Markdown anyway, so it's
a non-issue for me. Ok with you to?
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 11 months
Prepare to remove old/unnecessary components
by jzigmund@redhat.com
Patchset contains renaming(refactoring) of models and views for Deployable, Image, Template, Assembly and ProviderImage.
For reviewing apply whole patchset and do e2e test.
12 years, 11 months
Redmine more stable now?
by Justin Clift
Hi guys,
It's been a few days since we added rate limiting to the
Aeolus site, via a robots.txt file.
Has anyone noticed if it's more stable now or not? (ie
did it make a difference?)
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 11 months
[PATCH configure 1/2] added options for verbose/debug logging
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
bin/aeolus-configure | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/bin/aeolus-configure b/bin/aeolus-configure
index 877b62b..10515e1 100644
--- a/bin/aeolus-configure
+++ b/bin/aeolus-configure
@@ -1,4 +1,28 @@
#!/bin/sh
+usage()
+{
+cat << EOF
+
+USAGE:
+aeolus-configure [-d|--debug] [-h|--help] [-v|--verbose]
+
+OPTIONS:
+ -h | --help Show this message.
+ -d | --debug Debug loggin mode
+ -v | --verbose Verbose logging mode
+EOF
+}
+
+eval set -- `getopt -o hdv --long help,debug,verbose -- "$@"`
+while true ; do
+ case "$1" in
+ -h|--help) usage ; exit 1 ; shift ;;
+ -d|--debug) LOGLEVEL="--debug" ; shift ;;
+ -v|--verbose) LOGLEVEL="--verbose" ; shift ;;
+ --) shift ; break ;;
+ *) usage ; exit 1 ;;
+ esac
+done
export FACTER_AEOLUS_ENABLE_HTTPS=true
export FACTER_AEOLUS_ENABLE_SECURITY=false
@@ -6,5 +30,6 @@ puppet /usr/share/aeolus-configure/modules/aeolus/manifests/defaults.pp \
--modulepath=/usr/share/aeolus-configure/modules/ \
--external_nodes '/usr/sbin/aeolus-node configure' --node_terminus exec \
--logdest=/var/log/aeolus-configure/aeolus-configure.log \
- --logdest=console
+ --logdest=console \
+ $LOGLEVEL
--
1.7.4
12 years, 11 months