[PATCH] BZ 749376: aeolus-image should gracefully handle Conductor being down
by Maros Zatko
From: Maros Zatko <mzatko(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=749376
Added descriptive messages for exceptions when Conductor is unreachable
---
lib/aeolus_cli/command/base_command.rb | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/aeolus_cli/command/base_command.rb b/lib/aeolus_cli/command/base_command.rb
index 48e8eb5..56ebd6b 100644
--- a/lib/aeolus_cli/command/base_command.rb
+++ b/lib/aeolus_cli/command/base_command.rb
@@ -91,6 +91,18 @@ module Aeolus
code = "Unauthorized"
message = "Invalid Credentials, please check ~/.aeolus-cli"
+ elsif e.is_a?(ActiveResource::Redirection)
+ code = "Found"
+ message = "Server tried to redirect to #{e.response.header['location']}, please check ~/.aeolus-cli"
+
+ elsif e.is_a?(ActiveResource::ServerError)
+ code = "Service Temporarily Unavailable"
+ message = "Please check that Conductor is running."
+
+ elsif e.is_a?(SocketError)
+ code = "Name Or Service Not Found"
+ message = "Please chceck your ~/.aeolus-cli"
+
elsif e.is_a?(TypeError)
code = "Internal Error (TypeError)"
message = e.message
--
1.7.7.6
10 years, 6 months
[PATCH aeolus-cli] BZ#783886 Catch Connection Refused Exception
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
lib/aeolus_cli/command/base_command.rb | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/aeolus_cli/command/base_command.rb b/lib/aeolus_cli/command/base_command.rb
index 48e8eb5..83db176 100644
--- a/lib/aeolus_cli/command/base_command.rb
+++ b/lib/aeolus_cli/command/base_command.rb
@@ -87,6 +87,10 @@ module Aeolus
private
def handle_exception(e)
+ if e.is_a?(Errno::ECONNREFUSED)
+ code = "Connection Refused"
+ message = "Could not connect to aeolus-conductor please make sure it is running and that ~/.aeolus-cli points to the conductor API URL"
+
if e.is_a?(ActiveResource::UnauthorizedAccess)
code = "Unauthorized"
message = "Invalid Credentials, please check ~/.aeolus-cli"
--
1.7.6.4
10 years, 6 months
[PATCH aeolus-cli] BZ 773347 - update import help and man page to include RHEV notes
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=773347
It is not obvious how to find the provider image id for RHEV.
For RHEV it is the template id and it is only visible through the
RHEV REST API.
---
lib/aeolus_cli/command/config_parser.rb | 6 +++++-
man/aeolus-image-import.1 | 5 +++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/lib/aeolus_cli/command/config_parser.rb b/lib/aeolus_cli/command/config_parser.rb
index fdf9a09..500b23a 100644
--- a/lib/aeolus_cli/command/config_parser.rb
+++ b/lib/aeolus_cli/command/config_parser.rb
@@ -225,6 +225,10 @@ module Aeolus
opts.separator "aeolus-image import --account my-ec2 --id $ami_id --description '<image><name>My Image</name></image>' # import an AMI from the specified provider"
opts.separator "aeolus-image import --account my-ec2 --id $ami_id --description <path_to_xml_file> # import an AMI from the specified provider"
opts.separator ""
+ opts.separator "RHEV:"
+ opts.separator "Enter the template id for the provider image id. The template id can be found through the RHEV REST API."
+ opts.separator "For example: curl https://rhevm.redhat.com:8443/api/templates --user user@rhevm_domain:password"
+ opts.separator ""
opts.separator "N.B. Aeolus Credentials should be defined in the configuration file ~/.aeolus-cli"
end
end
@@ -313,4 +317,4 @@ module Aeolus
end
end
end
-end
\ No newline at end of file
+end
diff --git a/man/aeolus-image-import.1 b/man/aeolus-image-import.1
index c8d7742..32c9bf3 100644
--- a/man/aeolus-image-import.1
+++ b/man/aeolus-image-import.1
@@ -45,6 +45,11 @@ Import the AMI ami-1234567 from the provider account my-ec2 into aeolus providin
\--account my-ec2
\--id ami-1234567
\--description /foo/bar/description.xml
+.SH RHEV
+.TP
+Enter the template id for the provider image id. The template id can be found through the RHEV REST API.
+For example:
+ curl https://rhevm.redhat.com:8443/api/templates --user user@rhevm_domain:password
.SH AUTHOR
Martyn Taylor (mtaylor(a)redhat.com), Jason Guiditta (jguiditta(a)redhat.com)
.SH SEE ALSO
--
1.7.6.5
10 years, 6 months
[PATCH conductor] BZ72277 image ready button in deplyable detail fix
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
---
src/app/stylesheets/layout.scss | 1 +
src/app/views/deployables/show.html.haml | 43 ++++++++++++++---------------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index bf6d5de..8588e2b 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -2578,6 +2578,7 @@ table.light_table{
th.status{ border-bottom: none; text-align: right; }
td.status{ text-align: right; }
td.status a{
+ white-space: nowrap;
text-transform: uppercase;
text-decoration: none;
font-size: 10px;
diff --git a/src/app/views/deployables/show.html.haml b/src/app/views/deployables/show.html.haml
index 2c88513..40cc6d6 100644
--- a/src/app/views/deployables/show.html.haml
+++ b/src/app/views/deployables/show.html.haml
@@ -17,29 +17,28 @@
%header
%h2.images= t('.images')
.content
- .centered
- %table.light_table
- %thead
+ %table.light_table
+ %thead
+ %tr
+ %th.status
+ %th
+ %strong=t'.name'
+ %th.align-center=t'.images'
+ %th=t'.hw_profile'
+ %th.align-center=t'.hdd'
+ %th.align-center=t'.ram'
+ %th.align-center=t'.arch'
+ %tbody
+ - @images_details.each do |assembly|
%tr
- %th.status
- %th
- %strong=t'.name'
- %th.align-center=t'.images'
- %th=t'.hw_profile'
- %th.align-center=t'.hdd'
- %th.align-center=t'.ram'
- %th.align-center=t'.arch'
- %tbody
- - @images_details.each do |assembly|
- %tr
- %td.status= image_valid?(assembly)
- %td
- %strong=assembly[:name]
- %td.align-center=assembly[:images_count]
- %td=assembly[:hwp_name]
- %td.align-center=assembly[:hwp_hdd]
- %td.align-center=assembly[:hwp_ram]
- %td.align-center=assembly[:hwp_arch]
+ %td.status= image_valid?(assembly)
+ %td
+ %strong=assembly[:name]
+ %td.align-center=assembly[:images_count]
+ %td=assembly[:hwp_name]
+ %td.align-center=assembly[:hwp_hdd]
+ %td.align-center=assembly[:hwp_ram]
+ %td.align-center=assembly[:hwp_arch]
%section.admin-content-section
- if @missing_images.empty?
--
1.7.7.6
10 years, 6 months
[PATCH conductor] BZ 718968 - fixed provider name for deployments in mixed state
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/app/models/deployment.rb | 4 ++--
src/spec/models/deployment_spec.rb | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index d33e403..9c4b2e1 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -315,8 +315,8 @@ class Deployment < ActiveRecord::Base
end
def provider
- # I REALLY want to get this via a join, but no dice...
- instances.first.provider_account.provider rescue nil
+ inst = instances.joins(:provider_account => :provider).first
+ inst && inst.provider_account && inst.provider_account.provider
end
# we try to create an instance for each assembly and check
diff --git a/src/spec/models/deployment_spec.rb b/src/spec/models/deployment_spec.rb
index b477067..68e7952 100644
--- a/src/spec/models/deployment_spec.rb
+++ b/src/spec/models/deployment_spec.rb
@@ -111,6 +111,14 @@ describe Deployment do
end
end
+ describe ".provider" do
+ it "should return provider for a deployment where only some instances have set provider account" do
+ @deployment.instances << FactoryGirl.create(:mock_running_instance, :provider_account => nil, :deployment => @deployment)
+ @deployment.instances << FactoryGirl.create(:mock_running_instance, :deployment => @deployment)
+ @deployment.provider.should_not be_nil
+ end
+ end
+
describe ".start_time" do
it "should return start_time once an instance has started" do
@deployment.save!
--
1.7.7.5
10 years, 6 months
[PATCH conductor] BZ770087 fixes search functionality in provider's realm tab
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
---
src/app/controllers/providers_controller.rb | 3 ++-
src/app/models/frontend_realm.rb | 2 +-
src/app/models/provider.rb | 6 ------
src/spec/models/provider_spec.rb | 16 ----------------
4 files changed, 3 insertions(+), 24 deletions(-)
diff --git a/src/app/controllers/providers_controller.rb b/src/app/controllers/providers_controller.rb
index 1f6cc02..c7c1e0a 100644
--- a/src/app/controllers/providers_controller.rb
+++ b/src/app/controllers/providers_controller.rb
@@ -211,7 +211,8 @@ class ProvidersController < ApplicationController
end
def load_provider_tabs
- @realms = @provider.all_associated_frontend_realms
+ #frontend realms associated to provider or a realm of this provider, with applied filters
+ @realms = FrontendRealm.includes({:backend_realms => :provider}, :backend_providers).where("providers.id = :provider_id or (realm_backend_targets.realm_or_provider_id = :provider_id and realm_backend_targets.realm_or_provider_type = :provider_type)", :provider_id => @provider.id, :provider_type => 'Provider').apply_filters(:preset_filter_id => params[:realms_preset_filter], :search_filter => params[:realms_search])
#TODO add links to real data for history,properties,permissions
@tabs = [{:name => t('connectivity'), :view => 'edit', :id => 'connectivity'},
{:name => t('accounts'), :view => 'provider_accounts/list', :id => 'accounts', :count => @provider.provider_accounts.count},
diff --git a/src/app/models/frontend_realm.rb b/src/app/models/frontend_realm.rb
index 2762914..08ab579 100644
--- a/src/app/models/frontend_realm.rb
+++ b/src/app/models/frontend_realm.rb
@@ -53,7 +53,7 @@ class FrontendRealm < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- where("name ILIKE :search", :search => "%#{search}%")
+ where("frontend_realms.name ILIKE :search", :search => "%#{search}%")
else
scoped
end
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index 693d921..769962b 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -108,12 +108,6 @@ class Provider < ActiveRecord::Base
def supported_types
end
- # returns all frontend realms which are associated with this provider or a
- # realm of this provider
- def all_associated_frontend_realms
- (frontend_realms + realms.map {|r| r.frontend_realms}.flatten).uniq
- end
-
def stop_instances(user)
errs = []
provider_accounts.each do |pa|
diff --git a/src/spec/models/provider_spec.rb b/src/spec/models/provider_spec.rb
index 299ba00..fbb4729 100644
--- a/src/spec/models/provider_spec.rb
+++ b/src/spec/models/provider_spec.rb
@@ -99,22 +99,6 @@ describe Provider do
provider.destroyed?.should be_false
end
- it "should return all associated frontend realms" do
- provider1 = Factory.create(:mock_provider)
- frontend_realm = FactoryGirl.create :frontend_realm
- backend_realm = FactoryGirl.create :backend_realm, :provider => provider1
- t = RealmBackendTarget.create!(:frontend_realm => frontend_realm, :realm_or_provider => backend_realm)
- provider1.all_associated_frontend_realms.count.should == 1
- t.destroy
- provider1.realms.reload
- provider1.frontend_realms.reload
- provider1.all_associated_frontend_realms.count.should == 0
- RealmBackendTarget.create!(:frontend_realm => frontend_realm, :realm_or_provider => provider1)
- provider1.realms.reload
- provider1.frontend_realms.reload
- provider1.all_associated_frontend_realms.count.should == 1
- end
-
it "should stop all associated instances" do
provider1 = Factory.create(:mock_provider)
pa = FactoryGirl.create(:mock_provider_account, :provider => provider1)
--
1.7.7.6
10 years, 6 months
[PATCH conductor 1/2] Update role names for 1.0 terminology
by Tomas Sedovic
From: Scott Seago <sseago(a)redhat.com>
This updates role names to use the 1.0 product terminology (Application Blueprint, etc.)
---
src/db/seeds.rb | 42 +++++++++++++++++++-------------------
src/features/permission.feature | 6 ++--
src/spec/factories/permission.rb | 8 +++---
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/db/seeds.rb b/src/db/seeds.rb
index 0d04802..e3533cd 100644
--- a/src/db/seeds.rb
+++ b/src/db/seeds.rb
@@ -36,20 +36,20 @@ roles =
{"Instance Controller" => [false, {Instance => [VIEW,USE]}],
"Instance Owner" => [true, {Instance => [VIEW,USE,MOD, VPRM,GPRM]}]},
Deployment =>
- {"Deployment Controller" => [false, {Deployment => [VIEW,USE],
+ {"Application User" => [false, {Deployment => [VIEW,USE],
Instance => [VIEW]}],
- "Deployment Owner" => [true, {Deployment => [VIEW,USE,MOD, VPRM,GPRM],
+ "Application Owner" => [true, {Deployment => [VIEW,USE,MOD, VPRM,GPRM],
Instance => [VIEW,USE,MOD]}]},
PoolFamily =>
- {"Pool Family User" => [false, {Pool => [VIEW]}],
- "Pool Family Owner" => [true, {PoolFamily => [VIEW, MOD, VPRM,GPRM],
+ {"Cloud User" => [false, {Pool => [VIEW]}],
+ "Cloud Owner" => [true, {PoolFamily => [VIEW, MOD, VPRM,GPRM],
Pool => [VIEW, MOD,CRE,VPRM,GPRM]}]},
Pool =>
- {"Pool User" => [false, {Pool => [VIEW],
+ {"Zone User" => [false, {Pool => [VIEW],
Instance => [ CRE],
Deployment => [ CRE],
Quota => [VIEW]}],
- "Pool Owner" => [true, {Pool => [VIEW, MOD, VPRM,GPRM],
+ "Zone Owner" => [true, {Pool => [VIEW, MOD, VPRM,GPRM],
Instance => [VIEW,USE,MOD,CRE],
Deployment => [VIEW,USE,MOD,CRE],
Quota => [VIEW]}]},
@@ -63,25 +63,25 @@ roles =
{"Catalog User" => [false, {Catalog => [VIEW, USE]}],
"Catalog Administrator" => [true, {Catalog => [VIEW,USE,MOD,VPRM,GPRM]}]},
Deployable =>
- {"Deployable User" => [false, {Deployable => [VIEW,USE]}],
- "Deployable Owner" => [true, {Deployable => [VIEW,USE,MOD,VPRM,GPRM]}]},
+ {"Application Blueprint User" => [false, {Deployable => [VIEW,USE]}],
+ "Application Blueprint Owner" => [true, {Deployable => [VIEW,USE,MOD,VPRM,GPRM]}]},
BasePermissionObject =>
{"Provider Creator" => [false, {Provider => [ CRE]}],
"Provider Administrator" => [false, {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
- "HWP Administrator" => [false, {HardwareProfile => [VIEW, MOD,CRE,VPRM,GPRM]}],
- "Realm Administrator" => [false, {Realm => [ USE,MOD,CRE,VPRM,GPRM]}],
- "Pool Creator" => [false, {Pool => [ CRE]}],
- "Pool Administrator" => [false, {Pool => [VIEW, MOD,CRE,VPRM,GPRM],
+ "Profile Administrator" => [false, {HardwareProfile => [VIEW, MOD,CRE,VPRM,GPRM]}],
+ "Cluster Administrator" => [false, {Realm => [ USE,MOD,CRE,VPRM,GPRM]}],
+ "Zone Creator" => [false, {Pool => [ CRE]}],
+ "Zone Administrator" => [false, {Pool => [VIEW, MOD,CRE,VPRM,GPRM],
Instance => [VIEW,USE,MOD,CRE,VPRM,GPRM],
Deployment => [VIEW,USE,MOD,CRE,VPRM,GPRM],
Quota => [VIEW, MOD],
PoolFamily => [VIEW, MOD,CRE,VPRM,GPRM]}],
- "Deployable Administrator" => [false, {Deployable => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
- "Deployable Global User" => [false, {Deployable=> [VIEW,USE]}],
- "Catalog Global User" => [false, {Catalog => [VIEW,USE]}],
- "HWP Global User" => [false, {HardwareProfile => [VIEW,USE]}],
- "Pool Global User" => [false, {Pool => [VIEW],
+ "Application Blueprint Administrator" => [false, {Deployable => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
+ "Application Blueprint Global User" => [false, {Deployable=> [VIEW,USE]}],
+ "Catalog Global User" => [false, {Catalog => [VIEW,USE]}],
+ "Profile Global User" => [false, {HardwareProfile => [VIEW,USE]}],
+ "Zone Global User" => [false, {Pool => [VIEW],
Instance => [ CRE],
Deployment => [ CRE],
Quota => [VIEW]}],
@@ -122,11 +122,11 @@ MetadataObject.set("default_pool_family", PoolFamily.find_by_name('default'))
default_quota = Quota.create
default_pool = Pool.find_by_name("Default")
-default_role = Role.find_by_name("Pool User")
-default_deployable_role = Role.find_by_name("Deployable Global User")
-default_pool_global_user_role = Role.find_by_name("Pool Global User")
+default_role = Role.find_by_name("Zone User")
+default_deployable_role = Role.find_by_name("Application Blueprint Global User")
+default_pool_global_user_role = Role.find_by_name("Zone Global User")
default_catalog_global_user_role = Role.find_by_name("Catalog Global User")
-default_hwp_global_user_role = Role.find_by_name("HWP Global User")
+default_hwp_global_user_role = Role.find_by_name("Profile Global User")
settings = {"allow_self_service_logins" => "true",
"self_service_default_quota" => default_quota,
diff --git a/src/features/permission.feature b/src/features/permission.feature
index 33006d2..028bd11 100644
--- a/src/features/permission.feature
+++ b/src/features/permission.feature
@@ -16,7 +16,7 @@ Feature: Manage Permissions
When I follow "Grant Access"
Then I should be on the new permission page
And I should see "Choose roles for users"
- When I select "Pool User" role for the user "testuser"
+ When I select "Zone User" role for the user "testuser"
And I press "Grant Access"
Then I should be on the page for the pool "PermissionPool"
And I should see "Added the following User Roles"
@@ -29,7 +29,7 @@ Feature: Manage Permissions
When I follow "Grant Access"
Then I should be on the new permission page
And I should see "Choose roles for users"
- When I select "Pool Owner" role for the user "testuser"
+ When I select "Zone Owner" role for the user "testuser"
And I press "Grant Access"
Then I should be on the page for the pool "PermissionPool"
And I should see "Added the following User Roles"
@@ -42,7 +42,7 @@ Feature: Manage Permissions
When I follow "Grant Access"
Then I should be on the new permission page
And I should see "Choose roles for users"
- When I select "Pool User" role for the user "testuser"
+ When I select "Zone User" role for the user "testuser"
And I press "Grant Access"
Then I should be on the page for the pool "PermissionPool"
And I should see "Could not add these User Roles"
diff --git a/src/spec/factories/permission.rb b/src/spec/factories/permission.rb
index 1a1f025..7f9654a 100644
--- a/src/spec/factories/permission.rb
+++ b/src/spec/factories/permission.rb
@@ -33,25 +33,25 @@ FactoryGirl.define do
end
factory :pool_creator_permission, :parent => :permission do
- role { |r| Role.first(:conditions => ['name = ?', 'Pool Creator']) || FactoryGirl.create(:role, :name => 'Pool Creator') }
+ role { |r| Role.first(:conditions => ['name = ?', 'Zone Creator']) || FactoryGirl.create(:role, :name => 'Zone Creator') }
permission_object { |r| BasePermissionObject.general_permission_scope }
user { |r| r.association(:pool_creator_user) }
end
factory :pool_user_permission, :parent => :permission do
- role { |r| Role.first(:conditions => ['name = ?', 'Pool User']) || FactoryGirl.create(:role, :name => 'Pool User') }
+ role { |r| Role.first(:conditions => ['name = ?', 'Zone User']) || FactoryGirl.create(:role, :name => 'Zone User') }
permission_object { |r| r.association(:pool) }
user { |r| r.association(:pool_user) }
end
factory :pool_user2_permission, :parent => :permission do
- role { |r| Role.first(:conditions => ['name = ?', 'Pool User']) || FactoryGirl.create(:role, :name => 'Pool User') }
+ role { |r| Role.first(:conditions => ['name = ?', 'Zone User']) || FactoryGirl.create(:role, :name => 'Zone User') }
permission_object { |r| r.association(:pool) }
user { |r| r.association(:pool_user2) }
end
factory :pool_family_user_permission, :parent => :permission do
- role { |r| Role.first(:conditions => ['name = ?', 'Pool Family User']) || FactoryGirl.create(:role, :name => 'Pool Family User') }
+ role { |r| Role.first(:conditions => ['name = ?', 'Cloud User']) || FactoryGirl.create(:role, :name => 'Cloud User') }
permission_object { |r| r.association(:pool_family) }
user { |r| r.association(:pool_family_user) }
end
--
1.7.6.5
10 years, 6 months
[PATCH aeolus-conductor] BZ#772353 Delete Imported Image when deleting imported target/provider image
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
Imported Images can not be rebuilt or repushed since nothing but
the provider image actually exists when importing an existing image
(the rest of the family i.e. image, build, target image are just
place holders). It makes no sense to leave this stuff hanging around
after an imported image's target image or provider image has been
deleted by the user. Trying to rebuild or repush an imported image
will result in factory HTTP 5xx error.
Since this patch changes the imported image lifecycle, (it is now
different from the lifecycle of other images), a user should be able
to distinguish between normal and imported images. This patch also
adds "(Imported)" to show imported images on the list and show views.
---
src/app/controllers/provider_images_controller.rb | 11 ++++++++++-
src/app/controllers/target_images_controller.rb | 10 +++++++++-
src/app/views/images/_list.html.haml | 2 +-
src/app/views/images/show.html.haml | 2 +-
4 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/app/controllers/provider_images_controller.rb b/src/app/controllers/provider_images_controller.rb
index c1467ca..a08f1b8 100644
--- a/src/app/controllers/provider_images_controller.rb
+++ b/src/app/controllers/provider_images_controller.rb
@@ -43,7 +43,16 @@ class ProviderImagesController < ApplicationController
if image = Aeolus::Image::Warehouse::ProviderImage.find(params[:id])
target_id = image.target_identifier
provider = image.provider
- if image.delete!
+
+ if image.target_image.build.image.imported?
+ if image.target_image.build.image.delete!
+ flash[:notice] = t('images.flash.notice.deleted')
+ redirect_to images_path
+ return
+ else
+ flash[:warning] = t('images.flash.warning.delete_failed')
+ end
+ elsif image.delete!
flash[:notice] = t('provider_images.flash.notice.deleted',
:target_id => target_id, :provider => provider)
else
diff --git a/src/app/controllers/target_images_controller.rb b/src/app/controllers/target_images_controller.rb
index c9f3b4f..cf65d57 100644
--- a/src/app/controllers/target_images_controller.rb
+++ b/src/app/controllers/target_images_controller.rb
@@ -38,7 +38,15 @@ class TargetImagesController < ApplicationController
def destroy
if image = Aeolus::Image::Warehouse::TargetImage.find(params[:id])
- if image.delete!
+ if image.build.image.imported?
+ if image.build.image.delete!
+ flash[:notice] = t('images.flash.notice.deleted')
+ redirect_to images_path
+ return
+ else
+ flash[:warning] = t('images.flash.warning.delete_failed')
+ end
+ elsif image.delete!
flash[:notice] = t('target_images.flash.notice.deleted')
else
flash[:warning] = t('target_images.flash.warning.delete_failed')
diff --git a/src/app/views/images/_list.html.haml b/src/app/views/images/_list.html.haml
index 0013f1a..d75ea59 100644
--- a/src/app/views/images/_list.html.haml
+++ b/src/app/views/images/_list.html.haml
@@ -11,7 +11,7 @@
- selected = params[:select] == 'all'
= check_box_tag "images_selected[]", image.id, selected, :id => "image_checkbox_#{image.id}"
%td
- = link_to image.name, image_path(image.id)
+ = link_to (image.imported? ? image.name + " (Imported)" : image.name), image_path(image.id)
%td
= image.os.name.empty? ? "N/A" : image.os.name
%td
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index 4405deb..bff6284 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -1,6 +1,6 @@
= render :partial => 'layouts/admin_nav'
%header.admin-page-header
- %h1{:class => controller.controller_name}= @image.name
+ %h1{:class => controller.controller_name}= @image.imported? ? @image.name + " (Imported)" : @image.name
#obj_actions.button-container.images
=t'return_to'
= link_to t('images.index.images'), images_path, :class => 'rounded-link'
--
1.7.6.4
10 years, 6 months