[PATCH] BZ#747251 Fixes error messages and pushes the into I18n
by Chris Alfonso
---
src/app/models/instance.rb | 25 +++++++++++++------------
src/config/locales/en.yml | 14 ++++++++++++++
2 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 4b282e9..a83b2f5 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -216,7 +216,7 @@ class Instance < ActiveRecord::Base
def total_state_time(state)
if !STATES.include?(state)
- return "Error, could not calculate state time: invalid state"
+ return I18n.t('instances.errors.invalid_state')
end
case state
@@ -249,7 +249,7 @@ class Instance < ActiveRecord::Base
end
else
- return "Error, could not calculate state time: state is not monitored"
+ return I18n.t('state_not_monitored')
end
end
@@ -326,11 +326,12 @@ class Instance < ActiveRecord::Base
def matches
errors = []
if pool.pool_family.provider_accounts.empty?
- errors << 'There are no provider accounts associated with pool family of selected pool.'
+ errors << I18n.t('instances.errors.no_provider_accounts')
end
- errors << 'Pool quota reached' if pool.quota.reached?
- errors << 'Pool family quota reached' if pool.pool_family.quota.reached?
- errors << 'User quota reached' if owner.quota.reached?
+ errors << I18n.t('instances.errors.pool_quota_reached') if pool.quota.reached?
+ errors << I18n.t('instances.errors.pool_family_quota_reached') if pool.pool_family.quota.reached?
+ errors << I18n.t('instances.errors.user_quota_reached') if owner.quota.reached?
+ errors << I18n.t('instances.errors.image_not_found', :b_uuid=> image_build_uuid, :i_uuid => image_uuid) if image_build.nil? and image.nil?
return [[], errors] unless errors.empty?
build = image_build || image.latest_build
@@ -342,27 +343,27 @@ class Instance < ActiveRecord::Base
hwp = HardwareProfile.match_provider_hardware_profile(account.provider,
hardware_profile)
unless hwp
- errors << "#{account.name}: hardware profile match not found"
+ errors << I18n.t('instances.errors.hw_profile_match_not_found', :account_name => account.name)
next
end
account_images = provider_images.select {|pi| pi.provider == account.provider}
if account_images.empty?
- errors << "#{account.name}: image is not pushed to this provider account"
+ errors << I18n.t('instances.errors.image_not_pushed_to_provider', :account_name => account.name)
next
end
if account.quota.reached?
- errors << "#{account.name}: provider account quota reached"
+ errors << I18n.t('instances.errors.provider_account_quota_reached', :account_name => account.name)
next
end
if requires_config_server? and account.config_server.nil?
- errors << "#{account.name}: no config server available for provider account"
+ errors << I18n.t('instances.errors.no_config_server_available', :account_name => account.name)
next
end
account_images.each do |pi|
if not frontend_realm.nil?
brealms = frontend_realm.realm_backend_targets.select {|brealm_target| brealm_target.target_provider == account.provider}
if brealms.empty?
- errors << "Realm #{frontend_realm.name} is not mapped to any provider or provider realm"
+ errors << I18n.t('instances.errors.realm_not_mapped', :frontend_realm_name => frontend_realm.name)
next
end
brealms.each do |brealm_target|
@@ -428,7 +429,7 @@ class Instance < ActiveRecord::Base
matches.reject! do |match|
rejected = false
if !match.provider_account.quota.can_start? instances
- errors << "#{match.provider_account} quota limit too low to launch deployable"
+ errors << I18n.t('instances.errors.provider_account_quota_too_low', :match_provider_account => match.provider_account)
rejected = true
end
rejected
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index a50ca7c..9483738 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -264,6 +264,20 @@ en:
other: "The instances %{list} were successfully deleted."
notice:
stop: "stop action was successfully queued."
+ errors:
+ image_not_found: "No image build was found with uuid %{b_uuid} and no image was found with uuid %{i_uuid}"
+ user_quota_reached: "User quota reached"
+ pool_family_quota_reached: "Pool family quota reached"
+ pool_quota_reached: "Pool quota reached"
+ no_provider_accounts: "There are no provider accounts associated with pool family of selected pool."
+ invalid_state: "Error, could not calculate state time: invalid state"
+ state_not_monitored: "Error, could not calculate state time: state is not monitored"
+ hw_profile_match_not_found: "%{account_name}: hardware profile match not found"
+ image_not_pushed_to_provider: "%{account_name}: image is not pushed to this provider account"
+ provider_account_quota_reached: "%{account_name}: provider account quota reached"
+ no_config_server_available: "%{account_name}: no config server available for provider account"
+ realm_not_mapped: "Realm %{frontend_realm_name} is not mapped to any provider or provider realm"
+ provider_account_quota_too_low: "%{match_provider_account} quota limit too low to launch deployable"
searches: Searches
image_factory: Image Factory
assemblies: Assemblies
--
1.7.6.4
12 years, 6 months
[PATCH conductor] Added button to launch from catalog to pools#show
by Tomas Hrcka
---
src/app/stylesheets/layout.scss | 10 +++++++++-
src/app/views/layouts/_catalog_dropdown.html.haml | 12 +++++-------
src/app/views/pools/_header_show.html.haml | 2 ++
src/app/views/pools/_pretty_list.html.haml | 1 +
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index 575693a..aa64952 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -2289,14 +2289,22 @@ ul.deployment-array.small + ul.deployment-array.small{
background:#C4E0F0;
}
}
+
+div.catalog_link{
+ display:inline-block;
+}
+
.catalog_link{
background: url(../../images/deployment-button.png) no-repeat center;
padding: 7px 15px;
}
+
.catalog_link:hover{
background-color:#e0e0e0;
background: url(../../images/deployment-button-pressed.png) no-repeat center;
-
+ ul li {
+ list-style-type: none;
+ }
.more{
border: 1px solid #999999;
display:block;
diff --git a/src/app/views/layouts/_catalog_dropdown.html.haml b/src/app/views/layouts/_catalog_dropdown.html.haml
index d5a2d59..837b349 100644
--- a/src/app/views/layouts/_catalog_dropdown.html.haml
+++ b/src/app/views/layouts/_catalog_dropdown.html.haml
@@ -1,7 +1,5 @@
-%li.catalog_link
- =#image_tag 'deployment-button.png'
-  
- %div.catalog_list
- %ul.more
- - catalogs.each do |catalog|
- %li.catalog= link_to catalog.name, launch_from_catalog_deployments_path(:catalog_id => catalog.id)
\ No newline at end of file
+ 
+%div.catalog_list
+ %ul.more
+ - catalogs.each do |catalog|
+ %li.catalog= link_to catalog.name, launch_from_catalog_deployments_path(:catalog_id => catalog.id)
\ No newline at end of file
diff --git a/src/app/views/pools/_header_show.html.haml b/src/app/views/pools/_header_show.html.haml
index 04a1797..51d9258 100644
--- a/src/app/views/pools/_header_show.html.haml
+++ b/src/app/views/pools/_header_show.html.haml
@@ -3,6 +3,8 @@
= [@pool.name, "#{t'pools.pool'}"].join(' ')
#obj_actions.button-container
= link_to t('deployments.new_deployment'), launch_new_deployments_path(:pool_id => @pool.id), :class => 'button primary', :id => 'new_deployment_button'
+ %div.catalog_link
+ = render :partial => 'layouts/catalog_dropdown', :locals => {:catalogs => @pool.catalogs}
.button-group
= link_to t('edit'), edit_pool_path(@pool), :class => 'button pill', :id => 'edit_pool_button'
= button_to t('delete'), pool_path(@pool), :method => :delete, :confirm => t('pools.index.confirm_delete'), :class => "button pill danger", :id => 'delete_pool_button'
diff --git a/src/app/views/pools/_pretty_list.html.haml b/src/app/views/pools/_pretty_list.html.haml
index c540669..91093e5 100644
--- a/src/app/views/pools/_pretty_list.html.haml
+++ b/src/app/views/pools/_pretty_list.html.haml
@@ -31,6 +31,7 @@
= link_to ("#{html_escape(pool.name)} " + "#{t'pools.index.pool_details'}" + " »").html_safe, pool_path(pool), :class =>'pool_details'
%li
= link_to "#{t'deployments.new_deployment'}", launch_new_deployments_path(:pool_id => pool.id), :class => 'button primary', :id => 'new_deployment_button'
+ %li.catalog_link
= render :partial => 'layouts/catalog_dropdown', :locals => {:catalogs => pool.catalogs}
:javascript
--
1.7.6.4
12 years, 6 months
[PATCH 0/7] Filter table final header buttons placement
by Jirka Tomasek
This patchset implements redmine #2584. The buttons in filter table
top part have been set according to final agreement. Yet unused parts
(additional actions and column actions dropdowns) have been implemented
too and commented out for now. The selec all/none link has been replaced
with checkbox in table header.
12 years, 6 months
Updated Import to use conductor API
by Martyn Taylor
Depends on these conductor patches
0001-Added-Delete-functionality-via-API-for-Factory-objec.patch
0002-Fixed-subcollection-routes.patch
0003-Fixed-push-in-with-ProviderImages-controller.patch
0001-Updated-Views-include-providerimages.patch
12 years, 6 months
[PATCH aeolus-image] fix failing spec test
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
spec/command/config_parser_spec.rb | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/spec/command/config_parser_spec.rb b/spec/command/config_parser_spec.rb
index 8cb3c7c..359dd5d 100644
--- a/spec/command/config_parser_spec.rb
+++ b/spec/command/config_parser_spec.rb
@@ -18,9 +18,15 @@ module Aeolus
module CLI
describe ConfigParser do
it "should parse the specified command" do
- config_parser = ConfigParser.new(%w(list --images))
- config_parser.process
- config_parser.command.should == 'list'
+ VCR.use_cassette('command/list_command/list_all_images') do
+ begin
+ config_parser = ConfigParser.new(%w(list --images))
+ config_parser.process
+ rescue SystemExit => e
+ e.status.should == 0
+ end
+ config_parser.command.should == 'list'
+ end
end
it "should exit gracefully when a required subcommand is not provided" do
--
1.7.6.4
12 years, 6 months
Updated PushCommand to use conductor
by Martyn Taylor
Depends on the 3 Conductor patches on the list:
0001-Added-Delete-functionality-via-API-for-Factory-objec.patch
0002-Fixed-subcollection-routes.patch
0003-Fixed-push-in-with-ProviderImages-controller.patch
12 years, 6 months
[PATCH aeolus-conductor 1/3] Added Delete functionality via API for Factory objects
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/api/builds_controller.rb | 15 +++++++++++++++
src/app/controllers/api/images_controller.rb | 15 +++++++++++++++
.../controllers/api/provider_images_controller.rb | 18 +++++++++++++++++-
.../controllers/api/target_images_controller.rb | 15 +++++++++++++++
4 files changed, 62 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/api/builds_controller.rb b/src/app/controllers/api/builds_controller.rb
index e916450..9e28df8 100644
--- a/src/app/controllers/api/builds_controller.rb
+++ b/src/app/controllers/api/builds_controller.rb
@@ -40,5 +40,20 @@ module Api
render :nothing => true, :status => 404
end
end
+
+ def destroy
+ begin
+ if build = Aeolus::Image::Warehouse::ImageBuild.find(params[:id])
+ if build.delete!
+ render :text => "Build Deleted", :status => 200
+ end
+ else
+ render :text => "Unable to find Build", :status => 404
+ end
+ rescue => e
+ raise e
+ render :text => "Unable to Delete Build", :status => 500
+ end
+ end
end
end
diff --git a/src/app/controllers/api/images_controller.rb b/src/app/controllers/api/images_controller.rb
index 83fc59c..58467b6 100644
--- a/src/app/controllers/api/images_controller.rb
+++ b/src/app/controllers/api/images_controller.rb
@@ -64,6 +64,21 @@ module Api
end
end
+ def destroy
+ begin
+ if image = Aeolus::Image::Warehouse::Image.find(params[:id])
+ if image.delete!
+ render :text => "Image Deleted", :status => 200
+ end
+ else
+ render :text => "Unable to find Image", :status => 404
+ end
+ rescue => e
+ raise e
+ render :text => "Unable to Delete Image", :status => 500
+ end
+ end
+
private
def process_post(body)
doc = Nokogiri::XML CGI.unescapeHTML(body)
diff --git a/src/app/controllers/api/provider_images_controller.rb b/src/app/controllers/api/provider_images_controller.rb
index fef7cfa..ce3a1fb 100644
--- a/src/app/controllers/api/provider_images_controller.rb
+++ b/src/app/controllers/api/provider_images_controller.rb
@@ -61,11 +61,27 @@ module Api
end
rescue ActiveResource::BadRequest
render :text => "Parameter Data Incorrect", :status => 400
- rescue
+ rescue => e
+ raise e
render :text => "Internal Server Error", :status => 500
end
end
+ def destroy
+ begin
+ if image = Aeolus::Image::Warehouse::ProviderImage.find(params[:id])
+ if image.delete!
+ render :text => "Provider Image Deleted", :status => 200
+ end
+ else
+ render :text => "Unable to find Provider Image", :status => 404
+ end
+ rescue => e
+ raise e
+ render :text => "Unable to Delete Provider Image", :status => 500
+ end
+ end
+
private
def process_post(body)
doc = Nokogiri::XML CGI.unescapeHTML(body)
diff --git a/src/app/controllers/api/target_images_controller.rb b/src/app/controllers/api/target_images_controller.rb
index 510dedd..b6677e5 100644
--- a/src/app/controllers/api/target_images_controller.rb
+++ b/src/app/controllers/api/target_images_controller.rb
@@ -48,5 +48,20 @@ module Api
end
end
end
+
+ def destroy
+ begin
+ if image = Aeolus::Image::Warehouse::TargetImage.find(params[:id])
+ if image.delete!
+ render :text => "Target Image Deleted", :status => 200
+ end
+ else
+ render :text => "Unable to find Target Image", :status => 404
+ end
+ rescue => e
+ raise e
+ render :text => "Unable to Delete Target Image", :status => 500
+ end
+ end
end
end
--
1.7.6.4
12 years, 6 months
[PATCH aeolus-conductor] Updated Views include providerimages
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/views/api/images/_factory_image.xml.haml | 6 +++++-
src/app/views/api/target_images/_image.xml.haml | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/app/views/api/images/_factory_image.xml.haml b/src/app/views/api/images/_factory_image.xml.haml
index b930577..c96a5a0 100644
--- a/src/app/views/api/images/_factory_image.xml.haml
+++ b/src/app/views/api/images/_factory_image.xml.haml
@@ -4,4 +4,8 @@
%target_images
- image.build.target_images.each do |target_image|
%target_image{:id => target_image.id, :href => api_target_image_url(target_image.id)}
- %status=(Aeolus::Image::Factory::TargetImage.status(target_image.id) || "COMPLETE")
+ %provider_images
+ - if target_image.respond_to?(:provider_images)
+ - target_image.provider_images.each do |provider_image|
+ %provider_image{:id => provider_image.id, :href => api_provider_image_url(provider_image.id)}
+ %status=(Aeolus::Image::Factory::TargetImage.status(target_image.id) || "COMPLETE")
\ No newline at end of file
diff --git a/src/app/views/api/target_images/_image.xml.haml b/src/app/views/api/target_images/_image.xml.haml
index 4d6ad8a..b242f97 100644
--- a/src/app/views/api/target_images/_image.xml.haml
+++ b/src/app/views/api/target_images/_image.xml.haml
@@ -7,6 +7,6 @@
%template= image.template
%build{:href=>api_build_url(image.build.id), :id=>image.build.id}
%status="COMPLETE"
- %provider_image
+ %provider_images
- image.provider_images.each do |pimg|
%provider_image{:id => pimg.id, :href => api_provider_image_url(pimg.id)}
--
1.7.6.4
12 years, 6 months
[PATCH conductor] Initial patchset of i18n-rev3.rebased
by jzigmund@redhat.com
Changes in patchset:
- added method set_locale in app_controller(according to Matt's patch ([PATCH] Application controller detects locale from ACCEPT_LANGUAGE header).
- revise all strings in "Monitor section" to be ready to translate
- added cs.yml file for demonstration i18n in "Monitor section" (notice: Czech words in that file aren't real, I generated them via script w/ random strings)
- patch 2/10 revise all flash messages, in en.yml file w/ this structure:
flash:
error:
foo: Foo
notice:
bar: Bar
warning:
notice: not all, exclude app_controller
- added new revised views
12 years, 6 months