[PATCH] iwhd rest.c requires the users.js mode to be 700
by Chris Alfonso
---
recipes/aeolus/manifests/iwhd.pp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/recipes/aeolus/manifests/iwhd.pp b/recipes/aeolus/manifests/iwhd.pp
index 0c745a6..1e93b01 100644
--- a/recipes/aeolus/manifests/iwhd.pp
+++ b/recipes/aeolus/manifests/iwhd.pp
@@ -37,7 +37,7 @@ class aeolus::iwhd inherits aeolus {
file {"/etc/iwhd/users.js":
content => template("aeolus/iwhd-users.js"),
- mode => 755,
+ mode => 700,
require => Package['iwhd'] }
service { 'mongod':
--
1.7.6.4
12 years, 4 months
[PATCH conductor] RM 2879 - Secondary method for creating provider accounts using a provider name instead of an id
by Richard Su
---
.../controllers/provider_accounts_controller.rb | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/provider_accounts_controller.rb b/src/app/controllers/provider_accounts_controller.rb
index 6abafa3..37a360c 100644
--- a/src/app/controllers/provider_accounts_controller.rb
+++ b/src/app/controllers/provider_accounts_controller.rb
@@ -66,7 +66,13 @@ class ProviderAccountsController < ApplicationController
end
def create
- @provider = Provider.find(params[:provider_id])
+ if !params[:provider_account][:provider].nil?
+ @provider = Provider.find_by_name(params[:provider_account][:provider])
+ params[:provider_account][:provider] = @provider
+ params[:provider_id] = @provider.id
+ else
+ @provider = Provider.find(params[:provider_id])
+ end
require_privilege(Privilege::CREATE, ProviderAccount, @provider)
params[:provider_account][:provider_id] = @provider.id
@providers = Provider.all
--
1.7.6.4
12 years, 4 months
[PATCH configure] RM 2879 - Fix adding provider accounts through aeolus-configure
by Richard Su
Updated provider accounts create url.
Syntax fixes for rhevm and vsphere credential values.
This patch is dependent on a conductor patch that will allow creating
provider accounts using a provider name instead of an id.
---
recipes/aeolus/manifests/conductor.pp | 2 +-
recipes/aeolus/manifests/profiles/rhevm.pp | 4 ++--
recipes/aeolus/manifests/profiles/vsphere.pp | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/recipes/aeolus/manifests/conductor.pp b/recipes/aeolus/manifests/conductor.pp
index 3eba07f..11acb0d 100644
--- a/recipes/aeolus/manifests/conductor.pp
+++ b/recipes/aeolus/manifests/conductor.pp
@@ -234,7 +234,7 @@ define aeolus::conductor::provider($deltacloud_driver="",$url="", $deltacloud_pr
define aeolus::conductor::provider::account($provider="", $type="", $username="",$password="", $account_id="",$x509private="", $x509public=""){
if $type != "ec2" {
web_request{ "provider-account-$name":
- post => "https://localhost/conductor/provider_accounts",
+ post => "https://localhost/conductor/providers/0/provider_accounts",
parameters => { 'provider_account[label]' => $name,
'provider_account[provider]' => $provider,
'provider_account[credentials_hash[username]]' => $username,
diff --git a/recipes/aeolus/manifests/profiles/rhevm.pp b/recipes/aeolus/manifests/profiles/rhevm.pp
index 39680f2..149542e 100644
--- a/recipes/aeolus/manifests/profiles/rhevm.pp
+++ b/recipes/aeolus/manifests/profiles/rhevm.pp
@@ -48,8 +48,8 @@ class aeolus::profiles::rhevm {
aeolus::conductor::provider::account{"rhevm":
provider => 'rhevm',
type => 'rhevm',
- username => '$rhevm_deltacloud_username',
- password => '$rhevm_deltacloud_password',
+ username => "$rhevm_deltacloud_username",
+ password => "$rhevm_deltacloud_password",
require => Aeolus::Conductor::Provider["rhevm"] }
aeolus::conductor::hwp{"hwp1":
diff --git a/recipes/aeolus/manifests/profiles/vsphere.pp b/recipes/aeolus/manifests/profiles/vsphere.pp
index 1715181..0d511bf 100644
--- a/recipes/aeolus/manifests/profiles/vsphere.pp
+++ b/recipes/aeolus/manifests/profiles/vsphere.pp
@@ -38,8 +38,8 @@ class aeolus::profiles::vsphere {
aeolus::conductor::provider::account{"vsphere":
provider => 'vsphere',
type => 'vsphere',
- username => '$vsphere_username',
- password => '$vsphere_password',
+ username => "$vsphere_username",
+ password => "$vsphere_password",
require => Aeolus::Conductor::Provider["vsphere"] }
aeolus::conductor::hwp{"hwp1":
--
1.7.6.4
12 years, 4 months
[PATCH configure] BZ 758473 - aeolus-configure should check RHEVM export directory has correct type
by Richard Su
Before mounting the export directory, check its type via the RHEVM REST API.
The type needs to be "export" and not "data" or "iso". Otherwise pushes will fail.
---
.../aeolus/lib/puppet/provider/web_request/curl.rb | 12 +++++++++++-
recipes/aeolus/lib/puppet/type/web_request.rb | 8 ++++++++
recipes/aeolus/manifests/profiles/rhevm.pp | 10 +++++++++-
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/recipes/aeolus/lib/puppet/provider/web_request/curl.rb b/recipes/aeolus/lib/puppet/provider/web_request/curl.rb
index e046121..a857b36 100644
--- a/recipes/aeolus/lib/puppet/provider/web_request/curl.rb
+++ b/recipes/aeolus/lib/puppet/provider/web_request/curl.rb
@@ -58,6 +58,14 @@ class Curl::Easy
curl.cookiejar = params[:cookie]
end
+ if params.has_key?(:username) && !params[:username].nil?
+ curl.username = params[:username]
+ end
+
+ if params.has_key?(:password) && !params[:password].nil?
+ curl.password = params[:password]
+ end
+
curl.follow_location = (params.has_key?(:follow) && params[:follow])
request_params = params[:parameters]
file_params = params[:file_parameters]
@@ -158,7 +166,9 @@ Puppet::Type.type(:web_request).provide :curl do
:parameters => params[:parameters],
:file_parameters => params[:file_parameters],
:cookie => cookies,
- :follow => params[:follow])
+ :follow => params[:follow],
+ :username => params[:username],
+ :password => params[:password])
verify_result(result,
:returns => params[:returns],
:does_not_return => params[:does_not_return],
diff --git a/recipes/aeolus/lib/puppet/type/web_request.rb b/recipes/aeolus/lib/puppet/type/web_request.rb
index f893ca3..d20229e 100644
--- a/recipes/aeolus/lib/puppet/type/web_request.rb
+++ b/recipes/aeolus/lib/puppet/type/web_request.rb
@@ -134,4 +134,12 @@ Puppet::Type.newtype(:web_request) do
desc "Invoke request unless the specified request returns true"
end
+ newparam(:username) do
+ desc "HTTP authentication username"
+ end
+
+ newparam(:password) do
+ desc "HTTP authentication password"
+ end
+
end
diff --git a/recipes/aeolus/manifests/profiles/rhevm.pp b/recipes/aeolus/manifests/profiles/rhevm.pp
index 39680f2..f863ba2 100644
--- a/recipes/aeolus/manifests/profiles/rhevm.pp
+++ b/recipes/aeolus/manifests/profiles/rhevm.pp
@@ -18,6 +18,14 @@ class aeolus::profiles::rhevm {
mode => 755,
require => Package['aeolus-conductor-daemons'] }
+ web_request{ "rhevm-check-export-path-is-export-type":
+ get => "$rhevm_deltacloud_provider/storagedomains?search=export",
+ username => "$rhevm_deltacloud_username",
+ password => "$rhevm_deltacloud_password",
+ returns => '200',
+ contains => "//storage_domains/storage_domain/storage/path[text() = '$rhevm_nfs_export']"
+ }
+
file {"$rhevm_nfs_mount_point":
ensure => 'directory'}
@@ -26,7 +34,7 @@ class aeolus::profiles::rhevm {
device => "$rhevm_nfs_server:$rhevm_nfs_export",
fstype => "nfs",
options => "rw",
- require => File["$rhevm_nfs_mount_point"]}
+ require => [File["$rhevm_nfs_mount_point"], Web_Request["rhevm-check-export-path-is-export-type"]]}
aeolus::create_bucket{"aeolus":}
--
1.7.6.4
12 years, 4 months
[PATCH aeolus-conductor] BZ#754956 Return appropriate error code when parent not found
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/api/builds_controller.rb | 8 ++++++--
.../controllers/api/provider_images_controller.rb | 8 ++++++--
.../controllers/api/target_images_controller.rb | 8 ++++++--
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/api/builds_controller.rb b/src/app/controllers/api/builds_controller.rb
index bc7670f..b9170aa 100644
--- a/src/app/controllers/api/builds_controller.rb
+++ b/src/app/controllers/api/builds_controller.rb
@@ -25,8 +25,12 @@ module Api
layout :false
def index
- if params[:image_id]
- @builds = Aeolus::Image::Warehouse::Image.find(params[:image_id]).image_builds
+ if id = params[:image_id]
+ if image = Aeolus::Image::Warehouse::Image.find(id)
+ @builds = image.image_builds
+ else
+ raise(Aeolus::Conductor::API::ImageNotFound.new(500, t("api.error_messages.image_not_found", :image => params[:image_id])))
+ end
else
@builds = Aeolus::Image::Warehouse::ImageBuild.all
end
diff --git a/src/app/controllers/api/provider_images_controller.rb b/src/app/controllers/api/provider_images_controller.rb
index 9cbc191..65383c2 100644
--- a/src/app/controllers/api/provider_images_controller.rb
+++ b/src/app/controllers/api/provider_images_controller.rb
@@ -25,8 +25,12 @@ module Api
layout :false
def index
- if params[:target_image_id]
- @images = Aeolus::Image::Warehouse::TargetImage.find(params[:target_image_id]).provider_images
+ if id = params[:target_image_id]
+ if target_image = Aeolus::Image::Warehouse::TargetImage.find(params[:target_image_id])
+ @images = target_image.provider_images
+ else
+ raise(Aeolus::Conductor::API::TargetImageNotFound.new(500, t("api.error_messages.target_image_not_found", :targetimage => id)))
+ end
else
@images = Aeolus::Image::Warehouse::ProviderImage.all
end
diff --git a/src/app/controllers/api/target_images_controller.rb b/src/app/controllers/api/target_images_controller.rb
index 5b2acb5..0430a6e 100644
--- a/src/app/controllers/api/target_images_controller.rb
+++ b/src/app/controllers/api/target_images_controller.rb
@@ -25,8 +25,12 @@ module Api
layout :false
def index
- if params[:build_id]
- @images = Aeolus::Image::Warehouse::ImageBuild.find(params[:build_id]).target_images
+ if id = params[:build_id]
+ if build = Aeolus::Image::Warehouse::ImageBuild.find(params[:build_id])
+ @images = build.target_images
+ else
+ raise(Aeolus::Conductor::API::BuildNotFound.new(500, t("api.error_messages.build_not_found", :build => id)))
+ end
else
@images = Aeolus::Image::Warehouse::TargetImage.all
end
--
1.7.6.4
12 years, 4 months
[PATCH aeolus-conductor] BZ#754956 Return appropriate error code when parent not found
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/api/builds_controller.rb | 8 ++++++--
.../controllers/api/provider_images_controller.rb | 8 ++++----
.../controllers/api/target_images_controller.rb | 8 ++++++--
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/app/controllers/api/builds_controller.rb b/src/app/controllers/api/builds_controller.rb
index 90360dd..fdccf27 100644
--- a/src/app/controllers/api/builds_controller.rb
+++ b/src/app/controllers/api/builds_controller.rb
@@ -27,8 +27,12 @@ module Api
layout :false
def index
- if params[:image_id]
- @builds = Aeolus::Image::Warehouse::Image.find(params[:image_id]).image_builds
+ if id = params[:image_id]
+ if image = Aeolus::Image::Warehouse::Image.find(id)
+ @builds = image.image_builds
+ else
+ raise(Aeolus::Conductor::API::ImageNotFound.new(500, t("api.error_messages.image_not_found", :image => params[:image_id])))
+ end
else
@builds = Aeolus::Image::Warehouse::ImageBuild.all
end
diff --git a/src/app/controllers/api/provider_images_controller.rb b/src/app/controllers/api/provider_images_controller.rb
index 4c6e288..a448123 100644
--- a/src/app/controllers/api/provider_images_controller.rb
+++ b/src/app/controllers/api/provider_images_controller.rb
@@ -27,11 +27,11 @@ module Api
layout :false
def index
- if params[:target_image_id]
- if @target_image = Aeolus::Image::Warehouse::TargetImage.find(params[:target_image_id])
- @images = @target_image.provider_images
+ if id = params[:target_image_id]
+ if target_image = Aeolus::Image::Warehouse::TargetImage.find(params[:target_image_id])
+ @images = target_image.provider_images
else
- raise(Aeolus::Conductor::API::TargetImageNotFound.new(404, t("api.target_image_not_found")))
+ raise(Aeolus::Conductor::API::TargetImageNotFound.new(500, t("api.error_messages.target_image_not_found", :targetimage => id)))
end
else
@images = Aeolus::Image::Warehouse::ProviderImage.all
diff --git a/src/app/controllers/api/target_images_controller.rb b/src/app/controllers/api/target_images_controller.rb
index 5fa8ac6..5a365a9 100644
--- a/src/app/controllers/api/target_images_controller.rb
+++ b/src/app/controllers/api/target_images_controller.rb
@@ -27,8 +27,12 @@ module Api
layout :false
def index
- if params[:build_id]
- @images = Aeolus::Image::Warehouse::ImageBuild.find(params[:build_id]).target_images
+ if id = params[:build_id]
+ if build = Aeolus::Image::Warehouse::ImageBuild.find(params[:build_id])
+ @images = build.target_images
+ else
+ raise(Aeolus::Conductor::API::BuildNotFound.new(500, t("api.error_messages.build_not_found", :build => id)))
+ end
else
@images = Aeolus::Image::Warehouse::TargetImage.all
end
--
1.7.6.4
12 years, 4 months
[PATCH conductor] List of users added to permissions page
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=754400
---
src/app/views/pool_families/_permissions.html.haml | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/app/views/pool_families/_permissions.html.haml b/src/app/views/pool_families/_permissions.html.haml
index e69de29..e73ced3 100644
--- a/src/app/views/pool_families/_permissions.html.haml
+++ b/src/app/views/pool_families/_permissions.html.haml
@@ -0,0 +1 @@
+= render :partial => 'permissions/permissions'
--
1.7.6.4
12 years, 4 months
[PATCH conductor] Cleanup rename CatalogEntrie to Deployables locale files & strings
by Tomas Hrcka
---
src/app/controllers/catalogs_controller.rb | 4 +-
src/app/controllers/deployables_controller.rb | 16 ++++++------
src/app/views/deployables/_form.html.haml | 6 ++--
src/app/views/deployables/_from_url.html.haml | 10 ++++----
src/app/views/deployables/_list.html.haml | 4 +-
src/app/views/deployables/_new.html.haml | 6 ++--
.../views/deployables/_new_from_image.html.haml | 6 ++--
.../views/deployables/_section_header.html.haml | 4 +-
src/app/views/deployables/_upload.html.haml | 10 ++++----
src/app/views/deployables/edit.html.haml | 2 +-
src/app/views/deployables/show.html.haml | 4 +-
src/config/locales/en.yml | 26 ++++++++++----------
12 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/src/app/controllers/catalogs_controller.rb b/src/app/controllers/catalogs_controller.rb
index 6957d1c..189a1bf 100644
--- a/src/app/controllers/catalogs_controller.rb
+++ b/src/app/controllers/catalogs_controller.rb
@@ -44,8 +44,8 @@ class CatalogsController < ApplicationController
save_breadcrumb(catalogs_path(@catalog), @catalog.name)
@header = [
{ :name => '', :sortable => false },
- { :name => t("catalog_entries.index.name"), :sort_attr => :name },
- { :name => t('catalog_entries.index.deployable_xml'), :sortable => false }
+ { :name => t("deployables.index.name"), :sort_attr => :name },
+ { :name => t('deployables.index.deployable_xml'), :sortable => false }
]
end
diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb
index 46d48cf..3abc380 100644
--- a/src/app/controllers/deployables_controller.rb
+++ b/src/app/controllers/deployables_controller.rb
@@ -92,14 +92,14 @@ class DeployablesController < ApplicationController
begin
@deployable.transaction do
- raise t("catalog_entries.flash.error.no_catalog") if @selected_catalogs.empty?
+ raise t("deployables.flash.error.no_catalog") if @selected_catalogs.empty?
@deployable.save!
@selected_catalogs.each do |cid|
catalog = Catalog.find(cid)
require_privilege(Privilege::MODIFY, catalog)
CatalogEntry.create!(:catalog_id => cid, :deploayble_id => @deployable.id)
end
- flash[:notice] = t "catalog_entries.flash.notice.added"
+ flash[:notice] = t "deployables.flash.notice.added"
if params[:edit_xml]
redirect_to edit_catalog_deployable_path @selected_catalogs.first.id, @deployable.id, :edit_xml =>true
else
@@ -107,8 +107,8 @@ class DeployablesController < ApplicationController
end
end
rescue => e
- flash[:warning]= t('catalog_entries.flash.warning.create_failed', :message => e.message)
- flash[:warning]= t('catalog_entries.flash.warning.not_valid') if @deployable.errors.has_key?(:xml)
+ flash[:warning]= t('deployables.flash.warning.create_failed', :message => e.message)
+ flash[:warning]= t('deployables.flash.warning.not_valid') if @deployable.errors.has_key?(:xml)
if params[:create_from_image].present?
load_catalogs
@image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image])
@@ -135,7 +135,7 @@ class DeployablesController < ApplicationController
params[:deployable].delete(:owner_id) if params[:deployable]
if @deployable.update_attributes(params[:deployable])
- flash[:notice] = t"catalog_entries.flash.notice.updated"
+ flash[:notice] = t"deployables.flash.notice.updated"
redirect_to catalog_deployable_path(params[:catalog_id], @deployable)
else
render :action => 'edit'
@@ -177,9 +177,9 @@ class DeployablesController < ApplicationController
def set_header
@header = [
{ :name => 'checkbox', :class => 'checkbox', :sortable => false },
- { :name => t("catalog_entries.index.name"), :sort_attr => :name },
+ { :name => t("deployables.index.name"), :sort_attr => :name },
{ :name => t("catalogs.index.catalog_name"), :sortable => false },
- { :name => t("catalog_entries.index.deployable_xml"), :sortable => :url }
+ { :name => t("deployables.index.deployable_xml"), :sortable => :url }
]
end
@@ -194,7 +194,7 @@ class DeployablesController < ApplicationController
response
end
rescue RestClient::Exception, SocketError, URI::InvalidURIError
- flash[:error] = t('catalog_entries.flash.warning.not_valid_or_reachable', :url => url)
+ flash[:error] = t('deployables.flash.warning.not_valid_or_reachable', :url => url)
nil
end
end
diff --git a/src/app/views/deployables/_form.html.haml b/src/app/views/deployables/_form.html.haml
index c53eb61..911080a 100644
--- a/src/app/views/deployables/_form.html.haml
+++ b/src/app/views/deployables/_form.html.haml
@@ -8,18 +8,18 @@
= form.text_area :xml, :class => 'long'
- else
%p
- = label_tag :catalog_id, t('catalog_entries.form.catalog')
+ = label_tag :catalog_id, t('deployables.form.catalog')
= @catalog.name
.clear
%p
- = form.label :name, t('catalog_entries.index.name')
+ = form.label :name, t('deployables.index.name')
= form.text_field :name, :class => 'em long'
%p
= form.label :description, t('.description')
= form.text_area :description, :class => 'long'
%p
= form.label :xml, t('.deployable_xml')
- = link_to t("catalog_entries.properties.edit_deployable_xml"), edit_catalog_deployable_path((a)catalog.id, @deployable.id, :edit_xml=>true)
+ = link_to t("deployables.properties.edit_deployable_xml"), edit_catalog_deployable_path((a)catalog.id, @deployable.id, :edit_xml=>true)
%fieldset.options
= link_to t('cancel'), catalog_path(@catalog), :class => 'button danger'
diff --git a/src/app/views/deployables/_from_url.html.haml b/src/app/views/deployables/_from_url.html.haml
index d351ecb..9a80239 100644
--- a/src/app/views/deployables/_from_url.html.haml
+++ b/src/app/views/deployables/_from_url.html.haml
@@ -3,23 +3,23 @@
= render 'layouts/error_messages', :object => @deployable
%fieldset
%p
- = form.label :catalog_id, t('catalog_entries.form.catalog')
+ = form.label :catalog_id, t('deployables.form.catalog')
%span.text_instead_input= @catalog.name
.clear
%fieldset
%p
- = form.label :name, t('catalog_entries.index.name')
+ = form.label :name, t('deployables.index.name')
= form.text_field :name, :class => 'em long'
%p
- = form.label :description, t('catalog_entries.form.description')
+ = form.label :description, t('deployables.form.description')
= form.text_area :description, :class => 'long'
%fieldset
%p
- = label_tag :url, t('catalog_entries.form.deployable_xml_url')
+ = label_tag :url, t('deployables.form.deployable_xml_url')
= text_field_tag :url
%p
= check_box_tag(:edit_xml, true, false)
- = label_tag :edit_xml, t('catalog_entries.form.edit_xml_after_save')
+ = label_tag :edit_xml, t('deployables.form.edit_xml_after_save')
%fieldset.align-center
= link_to t('cancel'), catalog_path(@catalog), :class => 'button danger'
diff --git a/src/app/views/deployables/_list.html.haml b/src/app/views/deployables/_list.html.haml
index 350ad4f..7679141 100644
--- a/src/app/views/deployables/_list.html.haml
+++ b/src/app/views/deployables/_list.html.haml
@@ -4,13 +4,13 @@
.content
- content_for :form_header do
- %li= restful_submit_tag t("catalog_entries.show.delete"), "destroy", multi_destroy_catalog_deployables_path(@catalog), 'DELETE', :id => 'delete_button', :class => 'button danger'
+ %li= restful_submit_tag t("deployables.show.delete"), "destroy", multi_destroy_catalog_deployables_path(@catalog), 'DELETE', :id => 'delete_button', :class => 'button danger'
- content_for :filter_controls do
%li
= label_tag :catalog_entries_preset_filter, t('filter_table.viewing')
= hidden_field_tag :current_path, request.fullpath
- = select_tag(:catalog_entries_preset_filter, preset_filters_options_for_select(CatalogEntry::PRESET_FILTERS_OPTIONS, params[:catalog_entries_preset_filter]), :include_blank => t("catalog_entries.preset_filters.all_catalog_entries"), :disabled => true)
+ = select_tag(:catalog_entries_preset_filter, preset_filters_options_for_select(CatalogEntry::PRESET_FILTERS_OPTIONS, params[:catalog_entries_preset_filter]), :include_blank => t("deployables.preset_filters.all_catalog_entries"), :disabled => true)
= restful_submit_tag t("filter_table.apply_filters"), "filter", filter_catalog_deployables_path(@catalog), 'POST', :class => 'button', :id => 'apply_catalog_entries_preset_filter'
%span.label.badge.dark= @catalog_entries.count
%li.table-search-filter
diff --git a/src/app/views/deployables/_new.html.haml b/src/app/views/deployables/_new.html.haml
index a1d1589..46d9d3f 100644
--- a/src/app/views/deployables/_new.html.haml
+++ b/src/app/views/deployables/_new.html.haml
@@ -2,7 +2,7 @@
%section.admin-content-section
%header
- %h2=t'catalog_entries.new.add_catalog_entry'
+ %h2=t'deployables.new.add_catalog_entry'
%section.admin-content-section.image-upload
%p.description=t'.choose_option_to_upload'
@@ -10,9 +10,9 @@
%nav#image-upload-tabs.faceted
%ul.tabs
%li
- = link_to t('catalog_entries.new.upload'), new_catalog_deployable_path(@catalog), :id => "upload", :class => "#{'selected' if @form_option == 'upload'}"
+ = link_to t('deployables.new.upload'), new_catalog_deployable_path(@catalog), :id => "upload", :class => "#{'selected' if @form_option == 'upload'}"
%li
- = link_to t('catalog_entries.new.from_url'), new_catalog_deployable_path(@catalog, :from_url => true), :id => "from_url", :class => "#{'selected' if @form_option == 'from_url'}"
+ = link_to t('deployables.new.from_url'), new_catalog_deployable_path(@catalog, :from_url => true), :id => "from_url", :class => "#{'selected' if @form_option == 'from_url'}"
.form_option
= render :partial => @form_option
diff --git a/src/app/views/deployables/_new_from_image.html.haml b/src/app/views/deployables/_new_from_image.html.haml
index 95ffc7d..4616eda 100644
--- a/src/app/views/deployables/_new_from_image.html.haml
+++ b/src/app/views/deployables/_new_from_image.html.haml
@@ -12,7 +12,7 @@
%p= t('.description', :name => @image.name)
%fieldset
%div
- = form.label :name, t('catalog_entries.new.hw_profile')
+ = form.label :name, t('deployables.new.hw_profile')
= select_tag :hardware_profile, options_from_collection_for_select(@hw_profiles, :id, :name, params[:hardware_profile])
.clear
%div
@@ -32,8 +32,8 @@
.clear
.centered
%fieldset.align-center
- = link_to "#{t'catalog_entries.form.cancel'}", catalogs_path, :class => 'button danger'
- = submit_tag "#{t'catalog_entries.form.save'}", :name => 'save', :class => 'button primary', :id => 'save_button'
+ = link_to "#{t'deployables.form.cancel'}", catalogs_path, :class => 'button danger'
+ = submit_tag "#{t'deployables.form.save'}", :name => 'save', :class => 'button primary', :id => 'save_button'
:javascript
$(document).ready(function(){
diff --git a/src/app/views/deployables/_section_header.html.haml b/src/app/views/deployables/_section_header.html.haml
index ed41a09..eb942c3 100644
--- a/src/app/views/deployables/_section_header.html.haml
+++ b/src/app/views/deployables/_section_header.html.haml
@@ -1,4 +1,4 @@
%header.admin-page-header
- %h1{:class => controller.controller_name}=t'catalog_entries.index.catalog_entries'
+ %h1{:class => controller.controller_name}=t'deployables.index.catalog_entries'
#obj_actions.button-group
- = link_to "#{t'catalog_entries.new_catalog_entry'}", new_catalog_deployable_url(@catalog), :class => 'button primary', :id => 'new_catalog_entry_button'
+ = link_to "#{t'deployables.new_catalog_entry'}", new_catalog_deployable_url(@catalog), :class => 'button primary', :id => 'new_catalog_entry_button'
diff --git a/src/app/views/deployables/_upload.html.haml b/src/app/views/deployables/_upload.html.haml
index 6afaa8f..c933d54 100644
--- a/src/app/views/deployables/_upload.html.haml
+++ b/src/app/views/deployables/_upload.html.haml
@@ -3,23 +3,23 @@
= render 'layouts/error_messages', :object => @deployable
%fieldset
%p
- = label_tag :catalog_id, t('catalog_entries.form.catalog')
+ = label_tag :catalog_id, t('deployables.form.catalog')
%span.text_instead_input= @catalog.name
.clear
%fieldset
%p
- = form.label :name, t('catalog_entries.index.name')
+ = form.label :name, t('deployables.index.name')
= form.text_field :name, :class => 'em long'
%p
- = form.label :description, t('catalog_entries.form.description')
+ = form.label :description, t('deployables.form.description')
= form.text_area :description, :class => 'long'
%p
- = form.label :xml, t('catalog_entries.form.choose_xml')
+ = form.label :xml, t('deployables.form.choose_xml')
= form.file_field :xml
%fieldset
%p
= check_box_tag(:edit_xml, true, false)
- = label_tag :edit_xml, t('catalog_entries.form.edit_xml_after_save')
+ = label_tag :edit_xml, t('deployables.form.edit_xml_after_save')
%fieldset.align-center
= link_to t('cancel'), catalog_path(@catalog), :class => 'button danger'
diff --git a/src/app/views/deployables/edit.html.haml b/src/app/views/deployables/edit.html.haml
index e76b3e2..08802ce 100644
--- a/src/app/views/deployables/edit.html.haml
+++ b/src/app/views/deployables/edit.html.haml
@@ -8,7 +8,7 @@
%section.admin-content-section.user
%header
- %h2=t'catalog_entries.edit.editing_catalog_entry'
+ %h2=t'deployables.edit.editing_catalog_entry'
.content
= form_for @catalog_entry, :url => catalog_deployable_path((a)catalog_entry.catalog, @catalog_entry), :html => { :method => :put, :class => 'generic' } do |f|
diff --git a/src/app/views/deployables/show.html.haml b/src/app/views/deployables/show.html.haml
index fa5ec42..72e6b69 100644
--- a/src/app/views/deployables/show.html.haml
+++ b/src/app/views/deployables/show.html.haml
@@ -3,8 +3,8 @@
%h1{:class => controller.controller_name}= @deployable.name
#obj_actions.button-container
.button-group
- = button_to t('catalog_entries.show.delete'), catalog_deployable_path(@catalog, @deployable), :method => 'delete', :confirm => "#{t'catalog_entries.show.confirm_delete'}", :class => 'button danger', :id => 'delete'
- = link_to t('catalog_entries.show.edit'), edit_catalog_deployable_path(@catalog, @deployable), :class => 'button', :id => 'edit_button'
+ = button_to t('.delete'), catalog_deployable_path(@catalog, @deployable), :method => 'delete', :confirm => "#{t'.confirm_delete'}", :class => 'button danger', :id => 'delete'
+ = link_to t('.edit'), edit_catalog_deployable_path(@catalog, @deployable), :class => 'button', :id => 'edit_button'
= link_to t('deployments.overview.launch'), launch_new_deployments_path(:deployable_id => @deployable.id, :pool_id => @catalog.pool), :id => :launch_deployment
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 64512ec..713e7eb 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -588,15 +588,15 @@ en:
provider_accounts_not_removed: "Could not remove these Provider Accounts"
select_to_add_accounts: "You must select at least one Provider Account to add."
select_to_remove_accounts: "You must select at least one Provider Account to remove."
- catalog_entries:
- new_catalog_entry: New Catalog Entry
+ deployables:
+ new_catalog_entry: New Deployable
index:
- catalog_entry: Catalog Entry
- catalog_entries: Catalog Entries
+ catalog_entry: Deployable
+ deployables: Deployables
name: Name
deployable_xml: Deployable XML
new:
- add_catalog_entry: Add New Catalog Entry
+ add_catalog_entry: Add New Deployable
choose_option_to_upload: Choose one of the following options to upload deployable XML file
upload: Upload
from_url: From URL
@@ -638,20 +638,20 @@ en:
ram: RAM
arch: ARCH
edit:
- editing_catalog_entry: Editing Catalog Entry
+ editing_catalog_entry: Editing Deployable
list:
- catalog_entries_list: Catalog Entries List
+ deployables_list: Deployables List
flash:
warning:
- not_valid_or_reachable: "Catalog entry XML file is either invalid or no longer reachable at %{url}"
+ not_valid_or_reachable: "Deployable XML file is either invalid or no longer reachable at %{url}"
not_valid: "Deployable XML file doesn't resolve valid XML"
- failed: Catalog entry was not created.
+ failed: Deployable was not created.
notice:
- added: Catalog entry added.
- updated: Catalog entry updated successfully!
- deleted: Catalog entry deleted.
+ added: Deployable added.
+ updated: Deployable updated successfully!
+ deleted: Deployable deleted.
preset_filters:
- all_catalog_entries: All Catalog Entries
+ all_deployables: All Deployables
catalogs:
catalogs: Catalogs
new_catalog: New Catalog
--
1.7.6.4
12 years, 4 months
[PATCH conductor 0/1] Clean up Permission flash messages
by Matt Wagner
In reviewing Scott's patch, I included a nit talking about how the flash messages (for both success and errors) were oddly-worded. Scott's patch didn't actually introduce them, so I just fixed them.
It'd be great if someone who was an I18n master would look this over to make sure I'm not doing anything too unorthodox. I think this patch should have two benefits:
1.) The messages sound more human, at least to me.
2.) We no longer concatenate strings outside of the data dictionary, so they should be more I18n-friendly.
This patch was fixing a nit of mine and isn't an essential part of the sprint, so don't go too out of your way.
-- Matt
12 years, 4 months
Exceptions Use/Handling in Conductor
by Martyn Taylor
Gents,
Our current exception use/handling in conductor is less than ideal.
I've tried to highlight some of the issues here, and proposed an
approach that I feel we should take when it comes to exceptions
handling. Anyone with thoughts on this topic please chime in.
Cheers
Martyn
--
So, we use the below syntax in many places in conductor code. Using
this syntax to raise an exception is problematic:
raise "Some error occurred while trying to do something"
Why?
There is no way for conductor to interpret the cause of this exception,
and react accordingly.
Example1: Recovery of errors
(of course this could be rewritten in a way to not use custom exception
but is just a simple example to demonstrate the need)
def perform_task
case @task.name
when "Start Instance": start_instance((a)task.realms[0])
...
end
end
def start_instance(realm)
...
# Instance failed realms full
raise "Could not start instance realms are full"
end
end
In the above code, perform_task calls start_instance which raises an
exception with the user message "the realm is full". This then gets
filtered up the chain and caught in the ApplicationController which logs
the error and filters the message back to the user.
-- Using Custom Exceptions
def perform_task(task)
begin
case task.name
when "Start Instance": start_instance(task.realms[0])
...
end
rescue RealmFull => rfe
if task.realms.size > 1
task.realms.delete(0)
perform_task|(task)
else
raise rfe
end
end
end
def start_instance(realm)
...
# Instance failed realms full
raise RealmFull.new(:message => "Could not start instance
realms are full")
end
end
In the 2nd example, we can recover from realm full problem by catching
the RealmFull exception, and retrying the start_instance with the next
realm in our list until our list is exhausted. Once the realm list is
exhausted there nothing more we can do at this point so we raise the
RealmFull exception up to the next level, where it is then handled
accordingly.
Of course you could say why not just catch all exceptions in the first
example and react accordingly. Well yes in this example you could do
that, but imagine start_instance can fail in many places: realm full,
hwp does not exist, ami not found etc...
Example2: Catching/Handle generic exceptions at the top of the chain
Once we have defined custom exceptions we can then manage them at the
top level, categorised into particular genres. An example where this
already happens in conductor is in the API, where we have defined an
APIException, all exceptions throw from within the API controllers
extend this exception and all other exceptions should* be wrapped in an
appropriate APIException. This allows us to handle all APIExceptions at
the top level. ApplicationController has a filter than catches all
APIExceptions that are raised this far up the stack. It then creates a
proper XMLResponse, with HTTP status code, Error Code and Error Message.
You can imagine we have lots of exceptions genres, e.g. UIException.
When application controller catches a UIException it knows it must
display a message to the user.
ConductorException, might simply just log the exception trace and carry
on as normal.
And so on.
--- Exception Handling
In order to add in the power of exceptions we need to all agree on a
particular approach.
Here are 3 rules that if we stick to will let us handle exceptions more
wisely.
1) Never Swallow Exceptions (Unless they are an expectation)
2) Try to handle the exception locally.
3) If 2 is not possible, pass the exception up the stack, (wrapping it
into something understandable to the upstream method, if neccessary).
If everyone sticks to these 3 rules. Exceptions will be handled and
recovered from in all cases possible, those that are not will eventually
work their way up to the application controller where they will be
handled appropriately, according to their genre.
12 years, 4 months