[PATCH conductor 0/1] #796800 - Outlines without Zones
by Matt Wagner
Hi all,
This is a relatively simple fix for #796800. It was observed that attempting to implement an Image (Component Outline) into an Environment (Cloud) would fail if the Environment (Cloud) had no Pools (Zones).
This is more or less by design, since images are now scoped to... those things. However, status quo leads to a bad user experience.
This patch merely hides the links to the new image / import image pages (and do the environment details page) for environments with no pools (clouds with no zones). I started to try to protect the controller methods, but it's not terribly clear to me (a) how you'd get to them short of hacking the URL, and (b) what we should actually do in that case, so for now I have not done that. (It also didn't feel like it was worth having new strings translated for an edge case you can't reach unless you hack the URL.)
This broke a couple of tests, which I have fixed in this patch as well.
-- Matt
12 years, 1 month
[PATCH configure] BZ 788644 - remove confusing comments in cleanup config files
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=788644
---
conf/conductor_cleanup | 5 -----
conf/deltacloud_cleanup | 5 -----
conf/imagefactory_cleanup | 5 -----
conf/iwhd_cleanup | 5 -----
conf/rhevm_cleanup | 5 -----
5 files changed, 0 insertions(+), 25 deletions(-)
diff --git a/conf/conductor_cleanup b/conf/conductor_cleanup
index 708be5e..c14f765 100644
--- a/conf/conductor_cleanup
+++ b/conf/conductor_cleanup
@@ -1,9 +1,4 @@
#conductor-only cleanup specification
-
-#You can override the default behavior
-#by renaming this to <fqdn>_cleanup.
-#This will result in only conductor being
-#disabled
---
parameters:
enable_https: true
diff --git a/conf/deltacloud_cleanup b/conf/deltacloud_cleanup
index 42dd2bc..72165bc 100644
--- a/conf/deltacloud_cleanup
+++ b/conf/deltacloud_cleanup
@@ -1,9 +1,4 @@
#deltacloud-only cleanup specification
-
-#You can override the default behavior
-#by renaming this to <fqdn>_cleanup.
-#This will result in only deltacloud being
-#disabled
---
parameters:
enable_https: true
diff --git a/conf/imagefactory_cleanup b/conf/imagefactory_cleanup
index 1d30d0a..fa76105 100644
--- a/conf/imagefactory_cleanup
+++ b/conf/imagefactory_cleanup
@@ -1,9 +1,4 @@
#imagefactory-only cleanup specification
-
-#You can override the default behavior
-#by renaming this to <fqdn>_cleanup.
-#This will result in only imagefactory being
-#disabled
---
parameters:
enable_https: true
diff --git a/conf/iwhd_cleanup b/conf/iwhd_cleanup
index 5f7a595..08a54d0 100644
--- a/conf/iwhd_cleanup
+++ b/conf/iwhd_cleanup
@@ -1,9 +1,4 @@
#iwhd-only cleanup specification
-
-#You can override the default behavior
-#by renaming this to <fqdn>_cleanup.
-#This will result in only iwhd being
-#disabled
---
parameters:
enable_https: true
diff --git a/conf/rhevm_cleanup b/conf/rhevm_cleanup
index 65e1833..f9e5a42 100644
--- a/conf/rhevm_cleanup
+++ b/conf/rhevm_cleanup
@@ -1,9 +1,4 @@
#rhevm-only cleanup specification
-
-#You can override the default behavior
-#by renaming this to <fqdn>_cleanup.
-#This will result in only rhevm being
-#disabled
---
parameters:
enable_https: true
--
1.7.7.6
12 years, 1 month
[PATCH CE]
by Jason Guiditta
Same content, fixed c/p error on subject (BZ #)
12 years, 1 month
[PATCH conductor] BZ #790434: Move Role strings out of seeds.rb to allow overrides
by Jason Guiditta
https://bugzilla.redhat.com/show_bug.cgi?id=796797
This patch adds the overrides for product names to roles i18n file.
---
.../locales/overrides/role_definitions/en.yml | 31 ++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 src/config/locales/overrides/role_definitions/en.yml
diff --git a/src/config/locales/overrides/role_definitions/en.yml b/src/config/locales/overrides/role_definitions/en.yml
new file mode 100644
index 0000000..6b98ef0
--- /dev/null
+++ b/src/config/locales/overrides/role_definitions/en.yml
@@ -0,0 +1,31 @@
+en:
+ role_defs:
+ base:
+ deployable:
+ admin: Global Application Blueprint Administrator
+ user: Global Application Blueprint User
+ hwp:
+ admin: Global Profile Administrator
+ user: Global Profile User
+ pool:
+ admin: Global Zone Administrator
+ creator: Global Zone Creator
+ user: Global Zone User
+ realm:
+ admin: Global Cluster Administrator
+ deployable:
+ owner: Application Blueprint Owner
+ user: Application Blueprint User
+ deployment:
+ owner: Application Owner
+ user: Application User
+ pool:
+ admin: Zone Administrator
+ deployable:
+ admin: Zone Application Blueprint Admin
+ user: Zone User
+ pool_family:
+ admin: Cloud Administrator
+ image:
+ admin: Cloud Image Administrator
+ user: Cloud User
--
1.7.7.6
12 years, 1 month
[PATCH conductor] BZ 788558 - allow terminate inaccessible instances on 'stop' action
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Theis patch allows locally stopping of instances or deployments if
the instance's/deployment's provider is not accessible.
It fixes a bug in passing user param to queue_action method, also simplifies
used error messages - only (stop|reboot)_invalid_action can be raised.
This patch doesn't cover deletion of deployments which are not accessible - this is difficult
because there is a before_destroy hook on deployment which tries to destroy instances
on provider side.
---
src/app/controllers/deployments_controller.rb | 43 ++++++++----
src/app/controllers/instances_controller.rb | 52 +++++++-------
src/app/models/deployment.rb | 17 +++++
src/app/models/instance.rb | 35 ++++++++--
src/app/models/provider.rb | 15 +++-
src/app/stylesheets/custom.scss | 2 +-
.../views/deployments/confirm_terminate.html.haml | 16 +++++
.../views/instances/confirm_terminate.html.haml | 16 +++++
.../views/providers/confirm_terminate.html.haml | 5 +-
src/config/database.yml.0 | 72 ++++++++++++++++++++
src/config/locales/cs.yml | 1 -
src/config/locales/en.yml | 12 ++--
src/features/deployment.feature | 12 +++
src/features/instance.feature | 11 +++
src/features/step_definitions/deployment_steps.rb | 7 ++
src/features/step_definitions/instance_steps.rb | 8 ++
16 files changed, 265 insertions(+), 59 deletions(-)
create mode 100644 src/app/views/deployments/confirm_terminate.html.haml
create mode 100644 src/app/views/instances/confirm_terminate.html.haml
create mode 100644 src/config/database.yml.0
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index 588e88e..15050fc 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -18,6 +18,7 @@ class DeploymentsController < ApplicationController
before_filter :require_user
before_filter :load_deployments, :only => [:index, :show]
before_filter :load_deployment, :only => [:edit, :update]
+ before_filter :check_inaccessible_instances, :only => :multi_stop
viewstate :show do |default|
@@ -267,6 +268,7 @@ class DeploymentsController < ApplicationController
def multi_destroy
destroyed = []
failed = []
+
Deployment.find(params[:deployments_selected] || []).each do |deployment|
if check_privilege(Privilege::MODIFY, deployment)
begin
@@ -296,28 +298,28 @@ class DeploymentsController < ApplicationController
def multi_stop
notices = []
errors = []
- Deployment.find(params[:deployments_selected] || []).each do |deployment|
+
+ @deployments_to_stop.each do |deployment|
deployment.instances.each do |instance|
+ log_prefix = "#{t('deployments.deployment')}: #{instance.deployment.name}, #{t('instances.instance')}: #{instance.name}"
begin
- require_privilege(Privilege::USE,instance)
- unless instance.valid_action?('stop')
- raise ActionError.new(t('deployments.errors.stop_invalid_action'))
- end
-
- #permissons check here
- @task = instance.queue_action(current_user, 'stop')
- unless @task
- raise ActionError.new(t('deployments.errors.cannot_stop'))
+ require_privilege(Privilege::USE, instance)
+ if @inaccessible_instances.include?(instance)
+ instance.force_stop(current_user)
+ notices << "#{log_prefix}: #{t('instances.flash.notice.forced_stop')}"
+ else
+ instance.stop(current_user)
+ notices << "#{log_prefix}: #{t('instances.flash.notice.stop')}"
end
- Taskomatic.stop_instance(@task)
- notices << "#{t('deployments.deployment')}: #{instance.deployment.name}, #{t('instances.instance')}: #{instance.name}: #{t('deployments.flash.notice.stop')}"
rescue Exception => err
- errors << "#{t('deployments.deployment')}: #{instance.deployment.name}, #{t('instances.instance')}: #{instance.name}: " + err
+ errors << "#{log_prefix}: #{err}"
+ logger.error err.message
+ logger.error err.backtrace.join("\n ")
end
end
end
# If nothing is selected, display an error message:
- errors = t('deployments.flash.error.none_selected') if errors.blank? && notices.blank?
+ errors = t('deployments.flash.error.none_selected') if notices.blank? and errors.blank?
flash[:notice] = notices unless notices.blank?
flash[:error] = errors unless errors.blank?
respond_to do |format|
@@ -350,6 +352,19 @@ class DeploymentsController < ApplicationController
private
+ def check_inaccessible_instances
+ @deployments_to_stop = Deployment.find(params[:deployments_selected] || [])
+ @inaccessible_instances = Deployment.stoppable_inaccessible_instances(@deployments_to_stop)
+ if params[:terminate].blank? and @inaccessible_instances.any?
+ respond_to do |format|
+ format.html { render :action => :confirm_terminate }
+ format.json { render :json => {:inaccessbile_instances => @inaccessible_instances}, :status => :unprocessable_entity }
+ end
+ return false
+ end
+ return true
+ end
+
def load_deployments
@deployments_header = [
{ :name => 'checkbox', :class => 'checkbox', :sortable => false },
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index a44e7be..987ff9f 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -18,6 +18,7 @@ class InstancesController < ApplicationController
before_filter :require_user
before_filter :load_instance, :only => [:show, :key, :edit, :update]
before_filter :set_view_vars, :only => [:show, :index, :export_events]
+ before_filter :check_inaccessible_instances, :only => :multi_stop
def index
@params = params
@@ -139,27 +140,26 @@ class InstancesController < ApplicationController
end
def multi_stop
- notices = ""
- errors = ""
- Instance.find(params[:instance_selected] || []).each do |instance|
+ notices = []
+ errors = []
+
+ @instances_to_stop.each do |instance|
begin
require_privilege(Privilege::USE,instance)
- unless instance.valid_action?('stop')
- raise ActionError.new(t('instances.errors.stop_invalid'))
- end
- #permissons check here
- @task = instance.queue_action(current_user, 'stop')
- unless @task
- raise ActionError.new(t('instances.errors.stop_not_be_performed'))
+ if @inaccessible_instances.include?(instance)
+ instance.force_stop(current_user)
+ notices << "#{instance.name}: #{t('instances.flash.notice.forced_stop')}"
+ else
+ instance.stop(current_user)
+ notices << "#{instance.name}: #{t('instances.flash.notice.stop')}"
end
- Taskomatic.stop_instance(@task)
- notices << "#{instance.name}: #{t('instances.flash.notice.stop')}"
rescue Exception => err
errors << "#{instance.name}: " + err
+ logger.error err.message
+ logger.error err.backtrace.join("\n ")
end
end
- # If nothing is selected, display an error message:
errors = t('instances.none_selected') if errors.blank? && notices.blank?
flash[:notice] = notices unless notices.blank?
flash[:error] = errors unless errors.blank?
@@ -176,11 +176,11 @@ class InstancesController < ApplicationController
end
def stop
- do_operation(:stop)
+ do_operation(current_user, :stop)
end
def reboot
- do_operation(:reboot)
+ do_operation(current_user, :reboot)
end
def multi_reboot
@@ -189,7 +189,7 @@ class InstancesController < ApplicationController
Instance.find(params[:instance_selected] || []).each do |instance|
begin
require_privilege(Privilege::USE,instance)
- instance.reboot
+ instance.reboot(current_user)
notices << "#{instance.name}: #{t('instances.flash.notice.reboot', :name => instance.name)}"
rescue Exception => err
errors << "#{instance.name}: " + err
@@ -250,16 +250,16 @@ class InstancesController < ApplicationController
end
end
- def do_operation(operation)
- instance = Instance.find(params[:id])
- begin
- instance.send(operation)
- flash[:notice] = t("instances.flash.notice.#{operation}", :name => instance.name)
- rescue Exception => err
- flash[:error] = t('instance.error', :name => instance.name, :err => err)
- end
- respond_to do |format|
- format.html { redirect_to deployment_path(instance.deployment, :details_tab => 'instances')}
+ def check_inaccessible_instances
+ @instances_to_stop = Instance.find(params[:instance_selected] || [])
+ @inaccessible_instances = Instance.stoppable_inaccessible_instances(@instances_to_stop)
+ if params[:terminate].blank? and @inaccessible_instances.any?
+ respond_to do |format|
+ format.html { render :action => :confirm_terminate }
+ format.json { render :json => {:inaccessbile_instances => @inaccessible_instances}, :status => :unprocessable_entity }
+ end
+ return false
end
+ return true
end
end
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 9593645..880afdd 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -171,6 +171,18 @@ class Deployment < ActiveRecord::Base
end
end
+ def self.stoppable_inaccessible_instances(deployments)
+ failed_accounts = {}
+ res = []
+ deployments.each do |d|
+ next unless acc = d.provider_account
+ failed_accounts[acc.id] = acc.connect.nil? unless failed_accounts.has_key?(acc.id)
+ next unless failed_accounts[acc.id]
+ res += d.instances.stoppable_inaccessible
+ end
+ res
+ end
+
def launch_parameters
@launch_parameters ||= {}
end
@@ -329,6 +341,11 @@ class Deployment < ActiveRecord::Base
inst && inst.provider_account && inst.provider_account.provider
end
+ def provider_account
+ inst = instances.joins(:provider_account).first
+ inst && inst.provider_account
+ end
+
# we try to create an instance for each assembly and check
# if a match is found
def check_assemblies_matches(user)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 0042074..e6ce567 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -114,6 +114,8 @@ class Instance < ActiveRecord::Base
STATE_SHUTTING_DOWN, STATE_STOPPED, STATE_CREATE_FAILED,
STATE_ERROR, STATE_VANISHED]
+ STOPPABLE_INACCESSIBLE_STATES = [STATE_NEW, STATE_PENDING, STATE_RUNNING, STATE_SHUTTING_DOWN]
+
scope :deployed, :conditions => { :state => [STATE_RUNNING, STATE_SHUTTING_DOWN] }
# FIXME: "pending" is misleading as it doesn't just cover STATE_PENDING
scope :pending, :conditions => { :state => [STATE_NEW, STATE_PENDING] }
@@ -122,6 +124,7 @@ class Instance < ActiveRecord::Base
scope :stopped, :conditions => {:state => STATE_STOPPED}
scope :not_stopped, :conditions => "state <> 'stopped'"
scope :stopable, :conditions => { :state => [STATE_NEW, STATE_PENDING, STATE_RUNNING] }
+ scope :stoppable_inaccessible, :conditions => { :state => STOPPABLE_INACCESSIBLE_STATES }
scope :ascending_by_name, :order => 'instances.name ASC'
@@ -434,12 +437,20 @@ class Instance < ActiveRecord::Base
not deployment.instances.deployed.any? {|i| i != self}
end
- def stop
- do_operation('stop')
+ def stop(user)
+ do_operation(user, 'stop')
+ end
+
+ def reboot(user)
+ do_operation(user, 'reboot')
end
- def reboot
- do_operation('reboot')
+ def force_stop(user)
+ self.state = STATE_STOPPED
+ save!
+ event = Event.create!(:source => self, :event_time => Time.now,
+ :summary => "Instance is not accessible, state changed to stopped",
+ :status_code => "force_stop")
end
def deployed?
@@ -466,6 +477,16 @@ class Instance < ActiveRecord::Base
end
end
+ def self.stoppable_inaccessible_instances(instances)
+ failed_accounts = {}
+ instances.select do |i|
+ next unless STOPPABLE_INACCESSIBLE_STATES.include?(i.state)
+ next unless i.provider_account
+ failed_accounts[i.provider_account.id] = i.provider_account.connect.nil? unless failed_accounts.has_key?(i.provider_account.id)
+ failed_accounts[i.provider_account.id]
+ end
+ end
+
private
def self.apply_search_filter(search)
@@ -488,10 +509,10 @@ class Instance < ActiveRecord::Base
self[:uuid] = UUIDTools::UUID.timestamp_create.to_s
end
- def do_operation(operation)
- @task = self.queue_action(@current_user, operation)
+ def do_operation(user, operation)
+ @task = self.queue_action(user, operation)
unless @task
- raise I18n.t("instances.errors.#{operation}_not_be_performed")
+ raise I18n.t("instances.errors.#{operation}_invalid_action")
end
Taskomatic.send("#{operation}_instance", @task)
end
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index 22e4e95..9d5877c 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -117,8 +117,16 @@ class Provider < ActiveRecord::Base
else
# if the provider is not accessible and there are no running
# instances, we just change state of all instances to stopped
- res[:failed_to_terminate] = stoppable_instances.select do |i|
- !i.update_attributes(:state => Instance::STATE_STOPPED)
+ res[:failed_to_terminate] = instances_to_terminate.select do |i|
+ begin
+ i.update_attributes(:state => Instance::STATE_STOPPED)
+ false
+ rescue
+ true
+ # this should never happen, so display an error only in log file
+ logger.warn "failed to stop instance #{i.name}: #{$!.message}"
+ logger.warn $!.backtrace.join("\n ")
+ end
end
end
if res[:failed_to_stop].blank? and res[:failed_to_terminate].blank?
@@ -128,7 +136,8 @@ class Provider < ActiveRecord::Base
end
def instances_to_terminate
- valid_framework? ? [] : stoppable_instances
+ return [] if valid_framework?
+ provider_accounts.inject([]) {|all, pa| all += pa.instances.stoppable_inaccessible}
end
def populate_realms
diff --git a/src/app/stylesheets/custom.scss b/src/app/stylesheets/custom.scss
index ee1ce34..be3e1ec 100644
--- a/src/app/stylesheets/custom.scss
+++ b/src/app/stylesheets/custom.scss
@@ -245,7 +245,7 @@ form.generic section.services {
margin-bottom: 30px;
}
-.instance_details {
+.instance_details, .confirm_instances_termination {
h3{
font-size: 22px;
diff --git a/src/app/views/deployments/confirm_terminate.html.haml b/src/app/views/deployments/confirm_terminate.html.haml
new file mode 100644
index 0000000..2ac762f
--- /dev/null
+++ b/src/app/views/deployments/confirm_terminate.html.haml
@@ -0,0 +1,16 @@
+%header.page-header
+ %h1{:class => controller.controller_name}= t "instances.confirm_terminate.terminate_instances"
+ .corner
+
+%section.content-section
+ .content.confirm_instances_termination
+ .align-center
+ %strong= t('instances.confirm_terminate.terminate_instances_description')
+ = form_tag multi_stop_deployments_path, :method => :post do
+ - @deployments_to_stop.each do |i|
+ = hidden_field_tag 'deployments_selected[]', i.id
+ %ul
+ - @inaccessible_instances.each do |i|
+ %li= i.name
+ = link_to t('cancel'), pools_path(:view => 'filter', :details_tab => 'deployments'), :class => 'button'
+ = submit_tag t('instances.confirm_terminate.terminate'), :name => 'terminate', :class => 'button', :id => 'terminate_button'
diff --git a/src/app/views/instances/confirm_terminate.html.haml b/src/app/views/instances/confirm_terminate.html.haml
new file mode 100644
index 0000000..ea680f2
--- /dev/null
+++ b/src/app/views/instances/confirm_terminate.html.haml
@@ -0,0 +1,16 @@
+%header.page-header
+ %h1{:class => controller.controller_name}= t ".terminate_instances"
+ .corner
+
+%section.content-section
+ .content.confirm_instances_termination
+ .align-center
+ %strong= t('.terminate_instances_description')
+ = form_tag multi_stop_instances_path, :method => :post do
+ - @instances_to_stop.each do |i|
+ = hidden_field_tag 'instance_selected[]', i.id
+ %ul
+ - @inaccessible_instances.each do |i|
+ %li= i.name
+ = link_to t('cancel'), pools_path(:view => 'filter', :details_tab => 'instances'), :class => 'button'
+ = submit_tag t('.terminate'), :name => 'terminate', :class => 'button', :id => 'terminate_button'
diff --git a/src/app/views/providers/confirm_terminate.html.haml b/src/app/views/providers/confirm_terminate.html.haml
index 9df53f5..ef60061 100644
--- a/src/app/views/providers/confirm_terminate.html.haml
+++ b/src/app/views/providers/confirm_terminate.html.haml
@@ -5,8 +5,9 @@
%header
%h2= t(".disable_provider?")
- .content
- = t ".terminate_instances"
+ .content.confirm_instances_termination
+ .align-center
+ %strong= t('instances.confirm_terminate.terminate_instances_description')
%ul
- @instances_to_terminate.each do |i|
%li= i.name
diff --git a/src/config/database.yml.0 b/src/config/database.yml.0
new file mode 100644
index 0000000..2deb8ca
--- /dev/null
+++ b/src/config/database.yml.0
@@ -0,0 +1,72 @@
+# PostgresSQL. Versions 8.2 recommended.
+#
+# Fedora Install Instructions:
+# sudo yum install ruby-postgres postgresql-server
+# sudo /sbin/service postgresql initdb
+#
+# On a local system you may need to edit this file to have only the following
+# /var/lib/pgsql/data/pg_hba.conf
+# local all all trust
+# host all all 127.0.0.1/32 trust
+#
+# sudo /sbin/service postgresql start
+# sudo su - postgres
+# $ psql
+# $-# CREATE USER aeolus WITH PASSWORD 'v23zj59an' CREATEDB;
+# $-# \q
+# $ exit
+#
+# To start off a new environment, use the following commands.
+# If running from /usr/share/aeolus-conductor, use 'sudo' or run as root
+# as the migrate will write to a file.
+#
+# rake db:drop:all
+# rake db:create:all
+#
+# If you are running this in /usr/share/aeolus-conductor, use:
+# sudo RAILS_ENV=production rake db:migrate
+#
+# or else just:
+# rake db:migrate
+#
+# rake db:test:prepare
+#
+# And when there are changes to the database, simply run:
+#
+# rake db:migrate
+# rake db:test:prepare
+# for the environment you wish to update.
+#
+
+
+development:
+ adapter: postgresql
+ database: conductor_development
+ username: aeolus
+ password: v23zj59an
+ host: localhost
+ allow_concurrency: true
+ min_messages: warning
+
+# Warning: The database defined as 'test' will be erased and
+# re-generated from your development database when you run 'rake test'.
+# Do not set this db to the same as development or production.
+test: &TEST
+ adapter: postgresql
+ database: conductor_test
+ username: aeolus
+ password: v23zj59an
+ host: localhost
+ allow_concurrency: true
+ min_messages: warning
+
+production:
+ adapter: postgresql
+ database: conductor
+ username: aeolus
+ password: v23zj59an
+ host: localhost
+ allow_concurrency: true
+
+cucumber:
+ <<: *TEST
diff --git a/src/config/locales/cs.yml b/src/config/locales/cs.yml
index 7ada0cc..6b0f7b4 100644
--- a/src/config/locales/cs.yml
+++ b/src/config/locales/cs.yml
@@ -476,7 +476,6 @@ cs:
invalid_state: okhbeh kigib bog mhknokdmj klonm kcolb ndjhmhk neafi
no_config_server_available: "%{account_name}: ae hmenoo lidmgk mboinakkm boc cnfcjbli abicnag"
user_quota_reached: kone bdgjo kbggdbl
- stop_not_be_performed: cdim lfnggh nk ogldenhne gk mhde makmngjfl
provider_account_quota_too_low: "%{match_provider_account} ifcjl omcdh lkm dke gi gkcomo efehjbfgnl"
provider_account_quota_reached: "%{account_name}: boefladm ebbjhmd caidj klmghik"
image_not_pushed_to_provider: "%{account_name}: ofeif km fef minkbc gc bcei gncmokeo hgeickk"
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index addb68e..2e4f8c9 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -279,7 +279,6 @@ en:
other: "The deployments %{list} were successfully updated."
errors:
config_server_connection: 'Cannot connect to the config server'
- stop_invalid_action: "stop is an invalid action."
cannot_stop: "stop cannot be performed on this instance."
all_stopped: "All instances must be stopped or running"
not_valid_deployable_xml: "seems to be not valid deployable XML: %{msg}"
@@ -343,6 +342,10 @@ en:
shared_to: "Shared to: "
error: "Error: "
n_a: "N/A"
+ confirm_terminate:
+ terminate: "Terminate"
+ terminate_instances: "Terminate Instances"
+ terminate_instances_description: "Provider is not accessible, status of following instances will be changed to 'stopped' but their actual state is unknown."
flash:
warning:
ssh_key_not_found: "SSH Key not found for this Instance."
@@ -363,6 +366,7 @@ en:
other: "The instances %{list} were successfully deleted."
notice:
stop: "stop action was successfully queued."
+ forced_stop: "state changed to stopped."
reboot: "%{name}: reboot 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}"
@@ -378,9 +382,8 @@ en:
no_config_server_available: "%{account_name}: no config server available for provider account"
realm_not_mapped: "%{account_name}: realm %{frontend_realm_name} is not mapped to any applicable provider or provider realm"
provider_account_quota_too_low: "%{match_provider_account} quota limit too low to launch deployable"
- stop_invalid: "stop is an invalid action."
- stop_not_be_performed: "stop cannot be performed on this instance."
- reboot_not_be_performed: "cannot be rebooted because it's not currently running."
+ stop_invalid_action: "stop is an invalid action."
+ reboot_invalid_action: "reboot is an invalid action."
must_be_enabled: "%{account_name}: provider must be enabled"
provider_not_available: "%{account_name}: provider is not available"
cannot_destroy: "destroy cannot be performed on this instance."
@@ -1007,7 +1010,6 @@ en:
required_field: Required field.
caution_image: Caution
confirm_terminate:
- terminate_instances: "Provider is not accessible, status of following instances will be changed to 'stopped' but their actual state is unknown."
disabled_provider: "Disable Provider"
disable: "Disable"
flash:
diff --git a/src/features/deployment.feature b/src/features/deployment.feature
index 7b6a663..b9e195e 100644
--- a/src/features/deployment.feature
+++ b/src/features/deployment.feature
@@ -82,6 +82,18 @@ Feature: Manage Deployments
And I press "stop_button"
Then I should see "testdeployment"
+ Scenario: Stop inaccessible deployments
+ Given there is a deployment named "testdeployment" belonging to "testdeployable" owned by "testuser"
+ And "testdeployment" deployment's provider is not accessible
+ When I go to the deployments page
+ Then I should see "testdeployment"
+ When I check "testdeployment" deployment
+ And I press "stop_button"
+ Then I should see "Terminate Instances"
+ When I press "terminate_button"
+ Then I should see "state changed to stopped"
+
+
Scenario: Stop a deployment over XHR
Given there is a deployment named "testdeployment" belonging to "testdeployable" owned by "testuser"
And I request XHR
diff --git a/src/features/instance.feature b/src/features/instance.feature
index 1d91333..446ee53 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -71,6 +71,17 @@ Feature: Manage Instances
Then I should be on the instances page
And I should see "mock1: stop action was successfully queued"
+ Scenario: Stop inaccessible instance
+ Given there is a "mock1" running instance
+ And I am on the instances page
+ And "mock1" instance's provider is not accessible
+ When I check "mock1" instance
+ And I press "stop_selected_instances"
+ Then I should see "Terminate Instances"
+ And I should see "mock1"
+ When I press "terminate_button"
+ Then I should see "mock1: state changed to stopped"
+
Scenario: Stop multiple instances
Given there is a "mock1" running instance
And there is a "mock2" running instance
diff --git a/src/features/step_definitions/deployment_steps.rb b/src/features/step_definitions/deployment_steps.rb
index 5eedc1d..0640d9d 100644
--- a/src/features/step_definitions/deployment_steps.rb
+++ b/src/features/step_definitions/deployment_steps.rb
@@ -38,6 +38,13 @@ Given /^the deployment "([^"]*)" has an instance named "([^"]*)"$/ do |d_name, i
deployment.instances << FactoryGirl.create(:instance, :name => i_name, :pool => deployment.pool)
end
+Given /^"([^"]*)" deployment's provider is not accessible$/ do |arg1|
+ # FIXME: didn't find a way how to create an inaccessible provider
+ # cleanly
+ provider = @deployment.provider
+ provider.update_attribute(:url, 'http://localhost:3002/invalid_api')
+end
+
When /^I am viewing the deployment "([^"]*)"$/ do |arg1|
visit deployment_url(Deployment.find_by_name(arg1))
end
diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb
index 268fcdb..5f4d3bb 100644
--- a/src/features/step_definitions/instance_steps.rb
+++ b/src/features/step_definitions/instance_steps.rb
@@ -39,6 +39,14 @@ Given /^the instance "([^"]*)" is in the (\w*) state$/ do |instance, state|
instance.save!
end
+Given /^"([^"]*)" instance's provider is not accessible$/ do |arg1|
+ instance = Instance.find_by_name(arg1)
+ # FIXME: didn't find a way how to create an inaccessible provider
+ # cleanly
+ provider = instance.provider_account.provider
+ provider.update_attribute(:url, 'http://localhost:3002/invalid_api')
+end
+
When /^I am viewing the pending instance detail$/ do
visit instance_url(pending_instance)
end
--
1.7.7.6
12 years, 1 month
[PATCH conductor] BZ #796797: Move Role strings out of seeds.rb to allow overrides.
by Jason Guiditta
https://bugzilla.redhat.com/show_bug.cgi?id=796797
Make db/seeds use i18n stuff instead of text for role defs. As a side
effect, the UI now uses the keys and pulls the i18n trnaslation as well
---
aeolus-conductor.spec.in | 3 +-
src/app/controllers/permissions_controller.rb | 16 ++--
src/app/views/permissions/_permissions.html.haml | 4 +-
src/config/locales/role_definitions/en.yml | 50 ++++++++
...d_view_hardware_profile_privileges_to_admins.rb | 2 +-
src/db/seeds.rb | 127 ++++++++++----------
src/features/permission.feature | 6 +-
src/lib/tasks/dc_tasks.rake | 4 +-
.../controllers/config_servers_controller_spec.rb | 4 +-
.../provider_accounts_controller_spec.rb | 2 +-
src/spec/factories/permission.rb | 12 +-
11 files changed, 140 insertions(+), 90 deletions(-)
create mode 100644 src/config/locales/role_definitions/en.yml
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 52b1986..50dea05 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -197,7 +197,8 @@ rhtml="app/views/layouts"
svg="public/images public/images/icons public/javascripts/jquery-svg"
ttf="public/fonts"
txt="public"
-yml="config config/locales config/locales/overrides"
+yml="config config/locales config/locales/overrides config/locales/role_definitions \
+ config/locales/overrides/role_definitions"
xml="app/util"
for filetype in builder css feature gif haml html ico jpg js json key opts png \
rake rb rhtml scss svg ttf txt yml xml; do
diff --git a/src/app/controllers/permissions_controller.rb b/src/app/controllers/permissions_controller.rb
index ede9bb8..1545429 100644
--- a/src/app/controllers/permissions_controller.rb
+++ b/src/app/controllers/permissions_controller.rb
@@ -60,10 +60,10 @@ class PermissionsController < ApplicationController
:permission_object => @permission_object)
if permission.save
added << t('permissions.flash.fragment.user_and_role', :user => permission.user.login,
- :role => permission.role.name)
+ :role => t(permission.role.name, :scope=> :role_defs, :default => permission.role.name))
else
not_added << t('permissions.flash.fragment.user_and_role', :user => permission.user.login,
- :role => permission.role.name)
+ :role => t(permission.role.name, :scope=> :role_defs, :default => permission.role.name) )
end
end
end
@@ -98,12 +98,12 @@ class PermissionsController < ApplicationController
permission.role = role
if permission.save
modified << t('permissions.flash.fragment.user_and_role_change', :user => permission.user.login,
- :old_role => old_role.name,
- :role => permission.role.name)
+ :old_role => t(old_role.name, :scope=> :role_defs, :default => old_role.name),
+ :role => t(permission.role.name, :scope=> :role_defs, :default => permission.role.name))
else
not_modified << t('permissions.flash.fragment.user_and_role_change', :user => permission.user.login,
- :old_role => old_role.name,
- :role => permission.role.name)
+ :old_role => t(old_role.name, :scope=> :role_defs, :default => old_role.name) ,
+ :role => t(permission.role.name, :scope=> :role_defs, :default => permission.role.name))
end
end
end
@@ -133,10 +133,10 @@ class PermissionsController < ApplicationController
Permission.find(params[:permission_selected]).each do |p|
if check_privilege(Privilege::PERM_SET, p.permission_object) && p.destroy
deleted << t('permissions.flash.fragment.user_and_role', :user => p.user.login,
- :role => p.role.name)
+ :role => t(p.role.name, :scope=> :role_defs, :default => p.role.name))
else
not_deleted << t('permissions.flash.fragment.user_and_role', :user => p.user.login,
- :role => p.role.name)
+ :role => t(p.role.name, :scope=> :role_defs, :default => p.role.name))
end
end
diff --git a/src/app/views/permissions/_permissions.html.haml b/src/app/views/permissions/_permissions.html.haml
index f412570..dec5af7 100644
--- a/src/app/views/permissions/_permissions.html.haml
+++ b/src/app/views/permissions/_permissions.html.haml
@@ -23,9 +23,9 @@
%td= permission.user.last_name
%td= permission.user.first_name
- if check_privilege(Privilege::PERM_SET)
- %td= select_tag "permission_role_selected[]", options_for_select((a)roles.map {|r| [ r.name, "#{permission.id},#{r.id}" ] }, :selected => "#{permission.id},#{permission.role.id}", :disabled => @permission_object.permissions.where(["user_id = ? and role_id != ?", permission.user_id, permission.role_id]).collect {|p| "#{permission.id},#{p.role.id}"}), :id => "permission_role_selected_#{permission.id}"
+ %td= select_tag "permission_role_selected[]", options_for_select((a)roles.map {|r| [ t(r.name, :scope=> :role_defs, :default => r.name), "#{permission.id},#{r.id}" ] }, :selected => "#{permission.id},#{permission.role.id}", :disabled => @permission_object.permissions.where(["user_id = ? and role_id != ?", permission.user_id, permission.role_id]).collect {|p| "#{permission.id},#{p.role.id}"}), :id => "permission_role_selected_#{permission.id}"
:javascript
$("#permission_role_selected_#{permission.id}").change(function () { $("#perm_edit_button").click(); } );
-else
- %td= permission.role.name
+ %td= t(permission.role.name, :scope=> :role_defs, :default => permission.role.name)
diff --git a/src/config/locales/role_definitions/en.yml b/src/config/locales/role_definitions/en.yml
new file mode 100644
index 0000000..8563db6
--- /dev/null
+++ b/src/config/locales/role_definitions/en.yml
@@ -0,0 +1,50 @@
+en:
+ role_defs:
+ base:
+ admin: Global Administrator
+ catalog:
+ user: Global Catalog User
+ deployable:
+ admin: Global Deployable Administrator
+ user: Global Deployable User
+ hwp:
+ admin: Global HWP Administrator
+ user: Global HWP User
+ image:
+ admin: Global Image Administrator
+ pool:
+ admin: Global Pool Administrator
+ creator: Global Pool Creator
+ user: Global Pool User
+ provider:
+ admin: Global Provider Administrator
+ creator: Global Provider Creator
+ realm:
+ admin: Global Realm Administrator
+ catalog:
+ admin: Catalog Administrator
+ user: Catalog User
+ deployable:
+ owner: Deployable Owner
+ user: Deployable User
+ deployment:
+ owner: Deployment Owner
+ user: Deployment User
+ instance:
+ owner: Instance Owner
+ user: Instance User
+ pool:
+ admin: Pool Administrator
+ deployable:
+ admin: Pool Deployable Admin
+ user: Pool User
+ pool_family:
+ admin: Pool Family Administrator
+ image:
+ admin: Pool Family Image Administrator
+ user: Pool Family User
+ provider:
+ admin: Provider Administrator
+ provider_account:
+ owner: Provider Account Owner
+ user: Provider Account User
diff --git a/src/db/migrate/20110913150708_add_view_hardware_profile_privileges_to_admins.rb b/src/db/migrate/20110913150708_add_view_hardware_profile_privileges_to_admins.rb
index a3149d9..7b7f20d 100644
--- a/src/db/migrate/20110913150708_add_view_hardware_profile_privileges_to_admins.rb
+++ b/src/db/migrate/20110913150708_add_view_hardware_profile_privileges_to_admins.rb
@@ -19,7 +19,7 @@ class AddViewHardwareProfilePrivilegesToAdmins < ActiveRecord::Migration
return if Role.all.empty?
Role.transaction do
- ["HWP Administrator", "Administrator"].each do |role_name|
+ ["base.hwp.admin", "base.admin"].each do |role_name|
role = Role.find_or_initialize_by_name(role_name)
priv_type = HardwareProfile
diff --git a/src/db/seeds.rb b/src/db/seeds.rb
index 954b670..09a588b 100644
--- a/src/db/seeds.rb
+++ b/src/db/seeds.rb
@@ -16,7 +16,6 @@
# Default Pool Family
PoolFamily.create!(:name => "default", :description => "default pool family", :quota => Quota.create)
-
# Default Pool
Pool.create!(:name => "Default", :quota => Quota.create, :pool_family => PoolFamily.find_by_name('default'), :enabled => true)
@@ -33,72 +32,72 @@ GPRM = "set_perms"
roles =
{Instance =>
- {"Instance Controller" => [false, {Instance => [VIEW,USE]}],
- "Instance Owner" => [true, {Instance => [VIEW,USE,MOD, VPRM,GPRM]}]},
+ {"instance.user" => [false, {Instance => [VIEW,USE]}],
+ "instance.owner" => [true, {Instance => [VIEW,USE,MOD, VPRM,GPRM]}]},
Deployment =>
- {"Deployment Controller" => [false, {Deployment => [VIEW,USE],
- Instance => [VIEW]}],
- "Deployment Owner" => [true, {Deployment => [VIEW,USE,MOD, VPRM,GPRM],
- Instance => [VIEW,USE,MOD]}]},
+ {"deployment.user" => [false, {Deployment => [VIEW,USE],
+ Instance => [VIEW]}],
+ "deployment.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],
- Pool => [VIEW, MOD,CRE,VPRM,GPRM]}]},
+ {"pool_family.user" => [false, {Pool => [VIEW]}],
+ "pool_family.admin" => [true, {PoolFamily => [VIEW, MOD, VPRM,GPRM],
+ Pool => [VIEW, MOD,CRE,VPRM,GPRM]}]},
Pool =>
- {"Pool User" => [false, {Pool => [VIEW],
- Instance => [ CRE],
- Deployment => [ CRE],
- Quota => [VIEW]}],
- "Pool Owner" => [true, {Pool => [VIEW, MOD, VPRM,GPRM],
- Instance => [VIEW,USE,MOD,CRE],
- Deployment => [VIEW,USE,MOD,CRE],
- Quota => [VIEW]}]},
+ {"pool.user" => [false, {Pool => [VIEW],
+ Instance => [ CRE],
+ Deployment => [ CRE],
+ Quota => [VIEW]}],
+ "pool.admin" => [true, {Pool => [VIEW, MOD, VPRM,GPRM],
+ Instance => [VIEW,USE,MOD,CRE],
+ Deployment => [VIEW,USE,MOD,CRE],
+ Quota => [VIEW]}]},
Provider =>
- {"Provider Owner" => [true, {Provider => [VIEW, MOD, VPRM,GPRM],
- ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]}]},
+ {"provider.admin" => [true, {Provider => [VIEW, MOD, VPRM,GPRM],
+ ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]}]},
ProviderAccount =>
- {"Provider Account User" => [false, {ProviderAccount => [VIEW,USE]}],
- "Provider Account Owner" => [true, {ProviderAccount => [VIEW,USE,MOD, VPRM,GPRM]}]},
+ {"provider_account.user" => [false, {ProviderAccount => [VIEW,USE]}],
+ "provider_account.owner" => [true, {ProviderAccount => [VIEW,USE,MOD, VPRM,GPRM]}]},
Catalog =>
- {"Catalog User" => [false, {Catalog => [VIEW, USE]}],
- "Catalog Administrator" => [true, {Catalog => [VIEW,USE,MOD,VPRM,GPRM]}]},
+ {"catalog.user" => [false, {Catalog => [VIEW, USE]}],
+ "catalog.admin" => [true, {Catalog => [VIEW,USE,MOD,VPRM,GPRM]}]},
Deployable =>
- {"Deployable User" => [false, {Deployable => [VIEW,USE]}],
- "Deployable Owner" => [true, {Deployable => [VIEW,USE,MOD,VPRM,GPRM]}]},
+ {"deployable.user" => [false, {Deployable => [VIEW,USE]}],
+ "deployable.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],
- 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],
- Instance => [ CRE],
- Deployment => [ CRE],
- Quota => [VIEW]}],
- "Image Administrator" => [false, {PoolFamily => [VIEW, USE] }],
- "Administrator" => [false, {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
- ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM],
- HardwareProfile => [VIEW, MOD,CRE,VPRM,GPRM],
- Realm => [ USE,MOD,CRE,VPRM,GPRM],
- User => [VIEW, MOD,CRE],
- 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,USE,MOD,CRE,VPRM,GPRM],
- Catalog => [VIEW,USE,MOD,CRE,VPRM,GPRM],
- Deployable => [VIEW,USE,MOD,CRE,VPRM,GPRM],
- BasePermissionObject => [ MOD, VPRM,GPRM]}]}}
+ {"base.provider.creator" => [false, {Provider => [ CRE]}],
+ "base.provider.admin" => [false, {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
+ ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
+ "base.hwp.admin" => [false, {HardwareProfile => [VIEW, MOD,CRE,VPRM,GPRM]}],
+ "base.realm.admin" => [false, {Realm => [ USE,MOD,CRE,VPRM,GPRM]}],
+ "base.pool.creator" => [false, {Pool => [ CRE]}],
+ "base.pool.admin" => [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]}],
+ "base.deployable.admin" => [false, {Deployable => [VIEW,USE,MOD,CRE,VPRM,GPRM]}],
+ "base.deployable.user" => [false, {Deployable=> [VIEW,USE]}],
+ "base.catalog.user" => [false, {Catalog => [VIEW,USE]}],
+ "base.hwp.user" => [false, {HardwareProfile => [VIEW,USE]}],
+ "base.pool.user" => [false, {Pool => [VIEW],
+ Instance => [ CRE],
+ Deployment => [ CRE],
+ Quota => [VIEW]}],
+ "base.image.admin" => [false, {PoolFamily => [VIEW, USE] }],
+ "base.admin" => [false, {Provider => [VIEW, MOD,CRE,VPRM,GPRM],
+ ProviderAccount => [VIEW,USE,MOD,CRE,VPRM,GPRM],
+ HardwareProfile => [VIEW, MOD,CRE,VPRM,GPRM],
+ Realm => [ USE,MOD,CRE,VPRM,GPRM],
+ User => [VIEW, MOD,CRE],
+ 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,USE,MOD,CRE,VPRM,GPRM],
+ Catalog => [VIEW,USE,MOD,CRE,VPRM,GPRM],
+ Deployable => [VIEW,USE,MOD,CRE,VPRM,GPRM],
+ BasePermissionObject => [ MOD, VPRM,GPRM]}]}}
Role.transaction do
roles.each do |role_scope, scoped_hash|
scoped_hash.each do |role_name, role_def|
@@ -122,11 +121,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_catalog_global_user_role = Role.find_by_name("Catalog Global User")
-default_hwp_global_user_role = Role.find_by_name("HWP Global User")
+default_role = Role.find_by_name("pool.user")
+default_deployable_role = Role.find_by_name("base.deployable.user")
+default_pool_global_user_role = Role.find_by_name("base.pool.user")
+default_catalog_global_user_role = Role.find_by_name("base.catalog.user")
+default_hwp_global_user_role = Role.find_by_name("base.hwp.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..3715232 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 "pool.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 "pool.admin" 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 "pool.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/lib/tasks/dc_tasks.rake b/src/lib/tasks/dc_tasks.rake
index 3731712..b83cc6d 100644
--- a/src/lib/tasks/dc_tasks.rake
+++ b/src/lib/tasks/dc_tasks.rake
@@ -69,11 +69,11 @@ namespace :dc do
exit(1)
end
- unless user.permissions.select { |p| p.role.name.eql?('Administrator') }.empty?
+ unless user.permissions.select { |p| p.role.name.eql?('base.admin') }.empty?
puts "Permission already granted for user #{args.login}"
exit(1)
end
- permission = Permission.new(:role => Role.find_by_name('Administrator'),
+ permission = Permission.new(:role => Role.find_by_name('base.admin'),
:permission_object => BasePermissionObject.general_permission_scope,
:user => user)
if permission.save
diff --git a/src/spec/controllers/config_servers_controller_spec.rb b/src/spec/controllers/config_servers_controller_spec.rb
index 288c50c..53b89df 100644
--- a/src/spec/controllers/config_servers_controller_spec.rb
+++ b/src/spec/controllers/config_servers_controller_spec.rb
@@ -26,7 +26,7 @@ describe ConfigServersController do
before(:each) do
@config_server = Factory :mock_config_server
@provider_account = @config_server.provider_account
- @admin_permission = Permission.create :role => Role.find(:first, :conditions => ['name = ?', 'Provider Administrator']),
+ @admin_permission = Permission.create :role => Role.find(:first, :conditions => ['name = ?', 'base.provider.admin']),
:permission_object => @provider_account.provider,
:user => FactoryGirl.create(:provider_admin_user)
@admin = @admin_permission.user
@@ -49,7 +49,7 @@ describe ConfigServersController do
context "creating config servers" do
before(:each) do
@provider_account = Factory :mock_provider_account
- @admin_permission = Permission.create :role => Role.find(:first, :conditions => ['name = ?', 'Provider Administrator']),
+ @admin_permission = Permission.create :role => Role.find(:first, :conditions => ['name = ?', 'base.provider.admin']),
:permission_object => @provider_account.provider,
:user => FactoryGirl.create(:provider_admin_user)
@admin = @admin_permission.user
diff --git a/src/spec/controllers/provider_accounts_controller_spec.rb b/src/spec/controllers/provider_accounts_controller_spec.rb
index 0b722c9..a875938 100644
--- a/src/spec/controllers/provider_accounts_controller_spec.rb
+++ b/src/spec/controllers/provider_accounts_controller_spec.rb
@@ -24,7 +24,7 @@ describe ProviderAccountsController do
@provider_account = FactoryGirl.create :mock_provider_account
@provider = @provider_account.provider
- @admin_permission = Permission.create :role => Role.find(:first, :conditions => ['name = ?', 'Provider Administrator']),
+ @admin_permission = Permission.create :role => Role.find(:first, :conditions => ['name = ?', 'base.provider.admin']),
:permission_object => @provider,
:user => FactoryGirl.create(:provider_admin_user)
@admin = @admin_permission.user
diff --git a/src/spec/factories/permission.rb b/src/spec/factories/permission.rb
index 1a1f025..41c331a 100644
--- a/src/spec/factories/permission.rb
+++ b/src/spec/factories/permission.rb
@@ -21,37 +21,37 @@ FactoryGirl.define do
end
factory :admin_permission, :parent => :permission do
- role { |r| Role.first(:conditions => ['name = ?', 'Administrator']) || FactoryGirl.create(:role, :name => 'Administrator') }
+ role { |r| Role.first(:conditions => ['name = ?', 'base.admin']) || FactoryGirl.create(:role, :name => 'base.admin') }
permission_object { |r| BasePermissionObject.general_permission_scope }
user { |r| r.association(:admin_user) }
end
factory :provider_admin_permission, :parent => :permission do
- role { |r| Role.first(:conditions => ['name = ?', 'Provider Administrator']) || FactoryGirl.create(:role, :name => 'Provider Administrator') }
+ role { |r| Role.first(:conditions => ['name = ?', 'base.provider.admin']) || FactoryGirl.create(:role, :name => 'base.provider.admin') }
permission_object { |r| r.association(:mock_provider) }
user { |r| r.association(:provider_admin_user) }
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 = ?', 'base.pool.creator']) || FactoryGirl.create(:role, :name => 'base.pool.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 = ?', 'pool.user']) || FactoryGirl.create(:role, :name => 'pool.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 = ?', 'pool.user']) || FactoryGirl.create(:role, :name => 'pool.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 = ?', 'pool_family.user']) || FactoryGirl.create(:role, :name => 'pool_family.user') }
permission_object { |r| r.association(:pool_family) }
user { |r| r.association(:pool_family_user) }
end
--
1.7.7.6
12 years, 1 month
[PATCH conductor 0/1] #797254 - Quick bugfix for inability to stop/reboot instances
by Matt Wagner
This looks like it broke with a commit for 788558, possible via some sort of merge conflict. I don't quite understand the intent so use a little caution reviewing.
Also: two huge caveats! I need to head out for the week, but:
1.) I haven't run automated tests after this patch, so it's possible this breaks something.
2.) This is begging for a simple test, but I don't have the time just now. I'll put one together Monday if no one beats me to it.
-- Matt
12 years, 1 month
[PATCH] redmine task 2929, executable tarballed as original name and on start
by Dan Radez
---
configserver/src/lib/model/instance.rb | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configserver/src/lib/model/instance.rb b/configserver/src/lib/model/instance.rb
index 485c360..759ea82 100644
--- a/configserver/src/lib/model/instance.rb
+++ b/configserver/src/lib/model/instance.rb
@@ -458,9 +458,12 @@ module ConfigServer
end
def write_configuration_file(file_data, config_dir, file_type=:executable)
- filename = (:file == file_type) ? file_data[:name] : "start"
+ filename = file_data[:name]
if file_type == :executable
- open("#{config_dir}/#{filename}", "wb", 0777) do |file|
+ open("#{config_dir}/#{filename}", "wb", 0755) do |file|
+ file << file_data[:body]
+ end
+ open("#{config_dir}/start", "wb", 0755) do |file|
file << file_data[:body]
end
else
--
1.7.7.6
12 years, 1 month
[PATCH aeolus-cli] Bug 796781: Handle environment param in cli call for import (revised)
by Scott Seago
https://bugzilla.redhat.com/show_bug.cgi?id=796781
---
lib/aeolus_cli/command/config_parser.rb | 11 +++++++----
lib/aeolus_cli/command/import_command.rb | 5 +++--
man/aeolus-image-import.1 | 8 +++++++-
spec/command/import_command_spec.rb | 15 +++++++++++++--
4 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/lib/aeolus_cli/command/config_parser.rb b/lib/aeolus_cli/command/config_parser.rb
index 1401870..de9689a 100644
--- a/lib/aeolus_cli/command/config_parser.rb
+++ b/lib/aeolus_cli/command/config_parser.rb
@@ -151,7 +151,7 @@ module Aeolus
opts.on('-T', '--target TARGET1,TARGET2', Array, 'provider type (ec2, rackspace, rhevm, etc)') do |name|
@options[:target] = name
end
- opts.on('-E', '--environment ENVIRONMENT', 'Limit image list to environment') do |environment|
+ opts.on('-E', '--environment ENVIRONMENT', 'environment to build for') do |environment|
@options[:environment] = environment
end
opts.on( '-h', '--help', 'Get usage information for this command')
@@ -233,13 +233,16 @@ module Aeolus
opts.on('-A', '--account NAME,NAME', Array, 'name of specific account to import to') do |name|
@options[:provider_account] = name
end
+ opts.on('-E', '--environment ENVIRONMENT', 'environment to import into') do |environment|
+ @options[:environment] = environment
+ end
opts.on( '-h', '--help', 'Get usage information for this command')
opts.separator ""
opts.separator "Examples:"
- opts.separator "aeolus-image import --account my-ec2 --id $ami_id # import an AMI from the specified provider"
- 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 "aeolus-image import --account my-ec2 --id $ami_id --environment default # import an AMI from the specified provider"
+ opts.separator "aeolus-image import --account my-ec2 --id $ami_id --environment default --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 --environment default --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."
diff --git a/lib/aeolus_cli/command/import_command.rb b/lib/aeolus_cli/command/import_command.rb
index c53d749..63ee873 100644
--- a/lib/aeolus_cli/command/import_command.rb
+++ b/lib/aeolus_cli/command/import_command.rb
@@ -34,7 +34,8 @@ module Aeolus
image = Aeolus::CLI::Image.new({:target_identifier => @options[:id],
:image_descriptor => @options[:description],
- :provider_account_name => @options[:provider_account].first})
+ :provider_account_name => @options[:provider_account].first,
+ :environment => @options[:environment]})
image.save!
headers = ActiveSupport::OrderedHash.new
@@ -68,7 +69,7 @@ module Aeolus
raise ArgumentError, "params should not contain nil"
end
- required_keys = [:id, :provider_account]
+ required_keys = [:id, :provider_account, :environment]
optional_keys = [:description]
isect = params.keys & required_keys
diff --git a/man/aeolus-image-import.1 b/man/aeolus-image-import.1
index 33a7653..8772798 100644
--- a/man/aeolus-image-import.1
+++ b/man/aeolus-image-import.1
@@ -2,7 +2,7 @@
.SH NAME
aeolus-image import \- command for importing existing provider images into aeolus
.SH SYNOPSIS
-.B aeolus-image import [\-h|--help] [\-u|--username] [\-w|--password] [\-A|--account [account-name]] [\--id [provider-image-id]] [--description [path-to-file|xml string]] [\-d|--daemon]
+.B aeolus-image import [\-h|--help] [\-u|--username] [\-w|--password] [\-A|--account [account-name]] [\--id [provider-image-id]] [\-E|--environment] [--description [path-to-file|xml string]] [\-d|--daemon]
.SH DESCRIPTION
aeolus-image import allows users to import pre-existing images that exist in cloud provders for example AMI from EC2, into aeolus.
.SH OPTIONS
@@ -19,6 +19,9 @@ The provider account name as it exists in Conductor from where the importing ima
\--id <provider-image-id>
The providers ID given to the importing image
.TP
+\-E, --environment
+Limit image list to environment
+.TP
\--description <path-to-xml-description|xml string>
A user defined description to associate with the importing image
.TP
@@ -33,17 +36,20 @@ Import the AMI ami-1234567 from the provider account my-ec2 into aeolus
.B aeolus-image import
\--account my-ec2
\--id ami-1234567
+\--environment default
.TP
Import the AMI ami-1234567 from the provider account my-ec2 into aeolus with a given xml description
.B aeolus-image import
\--account my-ec2
\--id ami-1234567
+\--environment default
\--description '<image><name>myAMI</name></image>'
.TP
Import the AMI ami-1234567 from the provider account my-ec2 into aeolus providing a path to the description XML file
.B aeolus-image import
\--account my-ec2
\--id ami-1234567
+\--environment default
\--description /foo/bar/description.xml
.SH RHEV
.TP
diff --git a/spec/command/import_command_spec.rb b/spec/command/import_command_spec.rb
index a221b4e..01c57a6 100644
--- a/spec/command/import_command_spec.rb
+++ b/spec/command/import_command_spec.rb
@@ -20,13 +20,15 @@ module Aeolus
let( :description ) { "<image><name>MyImage</name></image>" }
let( :options ) { { :id => "ami-5592553c",
:provider_account => ["ec2-us-east-1"],
+ :environment => "default",
:description => description } }
let( :importc ) { ImportCommand.new( options ) }
describe "#import_image" do
context "without description parameter" do
let( :options ) { { :id => "ami-5592553c",
- :provider_account => ["ec2-us-east-1"] } }
+ :provider_account => ["ec2-us-east-1"],
+ :environment => "default" } }
it "should import an image with default description value" do
VCR.use_cassette('command/import_command/import_image_default') do
@@ -166,7 +168,8 @@ module Aeolus
context "correct params" do
let( :params ) { { :id => "ami-5592553c",
:provider_account => ["ec2-us-east-1"],
- :description => description } }
+ :description => description,
+ :environment => "default" } }
it { subject.call.should be_true }
end
@@ -176,10 +179,18 @@ module Aeolus
it { should raise_error(ArgumentError, /missing/) }
end
+ context "missing environment" do
+ let( :params ) { { :id => "ami-5592553c",
+ :description => description,
+ :provider_account => ["ec2-us-east-1"]} }
+ it { should raise_error(ArgumentError, /missing environment/) }
+ end
+
context "unexpected parameter" do
let( :params ) { { :id => "ami-5592553c",
:provider_account => ["ec2-us-east-1"],
:other_parameter => "other_value",
+ :environment => "default",
:description => description } }
it { should raise_error(ArgumentError, /unexpected/) }
end
--
1.7.6.4
12 years, 1 month