[PATCH] adding package deps for building
by Dan Radez
---
configserver/aeolus-configserver.spec.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configserver/aeolus-configserver.spec.in b/configserver/aeolus-configserver.spec.in
index 0df1f59..42dc3fa 100644
--- a/configserver/aeolus-configserver.spec.in
+++ b/configserver/aeolus-configserver.spec.in
@@ -25,8 +25,8 @@ License: ASL 2.0
URL: http://aeolusproject.org
Source0: http://joev.fedorapeople.org/configserver/aeolus-configserver-%{version}.tgz
-BuildRequires: ruby
-BuildRequires: ruby-devel
+BuildRequires: ruby-devel rubygem-ruby-debug
+BuildRequires: rubygem-test-spec rubygem-archive-tar-minitar
BuildRequires: help2man
Requires: httpd
--
1.7.7.5
12 years, 4 months
[PATCH conductor] BZ773034: Autoupdate for images#show
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=773034
---
src/app/controllers/images_controller.rb | 37 ++++++++++++
src/app/models/provider_account.rb | 6 ++
src/app/views/images/show.html.haml | 83 ++++++++++++++++++++++++++++
src/public/javascripts/application.js | 32 +++++++++++
src/public/javascripts/backbone/models.js | 9 +++-
src/public/javascripts/backbone/routers.js | 20 +++++++
src/public/javascripts/backbone/views.js | 44 +++++++--------
7 files changed, 207 insertions(+), 24 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index 2878e6b..01db915 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -58,6 +58,43 @@ class ImagesController < ApplicationController
@builder = Aeolus::Image::Factory::Builder.first
load_builds
load_target_images(@build)
+
+ respond_to do |format|
+ format.html
+ format.json do
+ active_builds = @account_groups.keys.inject({}) do |result, driver|
+ result[driver] = @builder.find_active_build((a)build.id, driver) if @build
+ result
+ end
+
+ provider_images = @account_groups.inject({}) do |result, (driver, group)|
+ timg = @target_images_by_target[driver]
+ group[:accounts].each do |account|
+ result[account.id] = timg.find_provider_image_by_provider_and_account(account.provider.name, account.warehouse_id).first
+ end if timg.present?
+
+ result
+ end
+
+ active_pushes = @account_groups.inject({}) do |result, (driver, group)|
+ timg = @target_images_by_target[driver]
+ group[:accounts].each do |account|
+ result[account.id] = @builder.find_active_push(timg.id, account.provider.name, account.warehouse_id)
+ end if timg.present?
+
+ result
+ end
+
+ render :json => { :account_groups => @account_groups,
+ :target_images_by_target => @target_images_by_target,
+ :provider_images => provider_images,
+ :active_builds => active_builds,
+ :active_pushes => active_pushes,
+ :build => @build,
+ :latest_build_id => @latest_build,
+ :image => @image }
+ end
+ end
end
def rebuild_all
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 8810968..20fe51c 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -145,6 +145,12 @@ class ProviderAccount < ActiveRecord::Base
label.blank? ? credentials_hash['username'] : label
end
+ def as_json(options={})
+ super(options).merge({
+ :provider_name => provider.name
+ })
+ end
+
def populate_realms
client = connect
deltacloud_realms = client.realms
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index 9074e18..4790df5 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -74,3 +74,86 @@
$("#seletect_build_button").click();
});
});
+
+%script#imageBuildsTemplate{ :type => 'text/x-jquery-tmpl' }
+ :plain
+ {{each(driver, groups) account_groups}}
+ <li>
+ <dl>
+ <dt>
+ <h3>${groups['type']['name']}</h3>
+ {{if build && active_builds[driver]}}
+ <label>${active_builds[driver]['status']}</label>
+ {{else target_images_by_target[driver]}}
+ #{path = image_target_image_path('replace_image_id', 'replace_target_image_id')
+ path = path.sub('replace_image_id', '${image[\'uuid\']}')
+ path = path.sub('replace_target_image_id', '${target_images_by_target[driver][\'uuid\']}')
+ button_to(t('images.show.delete'), path, :method => :delete)}
+ {{else build && build['uuid'] == latest_build_id}}
+ #{path = image_target_images_path('replace_image_id', :target => 'replace_driver', :build_id => 'replace_build_id')
+ path = path.sub('replace_image_id', '${image[\'uuid\']}')
+ path = path.sub('replace_driver', '${driver}')
+ path = path.sub('replace_build_id', '${build[\'uuid\']}')
+ button_to(t('images.show.build'), path, :method => :post)}
+ {{else}}
+
+ {{/if}}
+ </dt>
+ <dd>
+ <table class="light_table">
+ <thead>
+ <tr>
+ <th>
+ <strong>#{t'images.show.account'}</strong>
+ </th>
+ <th>
+ #{t'images.show.provider'}
+ </th>
+ <th>
+ #{t'images.show.image_uri'}
+ </th>
+ <th class="image_controls"></th>
+ </tr></thead>
+
+ <tbody>
+ {{each(index, account) groups['accounts']}}
+ <tr>
+ <td>
+ <strong>${account['label']}</strong>
+ </td>
+ <td class="light">
+ ${account['provider_name']}
+ </td>
+ <td class="light">
+ {{if provider_images[account['id']]}}
+ ${provider_images[account['id']]['target_identifier']}
+ {{/if}}
+ </td>
+ <td class="image_controls">
+ {{if target_images_by_target[driver] && active_pushes[account['id']]}}
+ <label>${active_pushes[account['id']]['status']}</label>
+ {{else target_images_by_target[driver] && !provider_images[account['id']] && build && build['uuid'] == latest_build_id}}
+ #{path = image_provider_images_path('replace_image_id', :build_id => 'replace_build_id', :target_image_id => 'replace_target_image_id', :account_id => 'replace_account_id')
+ path = path.sub('replace_image_id', '${image[\'uuid\']}')
+ path = path.sub('replace_build_id', '${build[\'uuid\']}')
+ path = path.sub('replace_target_image_id', '${target_images_by_target[driver][\'uuid\']}')
+ path = path.sub('replace_account_id', '${account[\'id\']}')
+ button_to(t('images.show.upload'), path, :method => :post, :class => 'upload_image')}
+ {{else provider_images[account['id']]}}
+ #{path = image_provider_image_path('replace_image_id', 'replace_provider_image_id')
+ path = path.sub('replace_image_id', '${image[\'uuid\']}')
+ path = path.sub('replace_provider_image_id', '${provider_images[account[\'id\']][\'uuid\']}')
+ button_to("", path, :method => :delete, :class => 'delete_image')}
+ {{else}}
+
+ {{/if}}
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </dd>
+ </dl>
+ <div class="clear"></div>
+ </li>
+ {{/each}}
diff --git a/src/public/javascripts/application.js b/src/public/javascripts/application.js
index 0605fdf..0541afd 100644
--- a/src/public/javascripts/application.js
+++ b/src/public/javascripts/application.js
@@ -164,6 +164,34 @@ $.extend(Conductor, {
});
},
+ urlParams: function() {
+ var paramsData = window.location.search.slice(1).split('&');
+ var params = {};
+ $.each(paramsData, function(index, value){
+ var eqSign = value.search('=');
+ if(eqSign != -1) {
+ params[value.substring(0, eqSign)] = value.substring(eqSign+1);
+ }
+ });
+
+ return params;
+ },
+
+ extractQueryParams: function(paramsToInclude) {
+ var result = {};
+ var urlParams = Conductor.urlParams();
+
+ $.each(paramsToInclude, function(paramIndex, paramValue) {
+ for (var urlParamName in urlParams) {
+ if (urlParamName == paramValue) {
+ result[urlParamName] = urlParams[urlParamName];
+ break;
+ }
+ };
+ });
+
+ return result;
+ },
prefixedPath: function(path) {
var prefix = this.PATH_PREFIX;
@@ -205,6 +233,10 @@ $.extend(Conductor, {
return parseInt(urlFragment.split('?')[0]);
},
+ uuidFromURLFragment: function(urlFragment) {
+ return urlFragment.split('?')[0];
+ },
+
saveCheckboxes: function(checkboxSelector, $scope) {
if(!$scope) $scope = $;
diff --git a/src/public/javascripts/backbone/models.js b/src/public/javascripts/backbone/models.js
index a89cb6b..0071ed4 100644
--- a/src/public/javascripts/backbone/models.js
+++ b/src/public/javascripts/backbone/models.js
@@ -34,7 +34,6 @@ Conductor.Models.Deployment = Backbone.Model.extend({
this.instances = new Conductor.Models.Instances();
this.instances.url = this.urlRoot + '/' + this.id + '/instances';
}
-
});
Conductor.Models.Deployments = Backbone.Collection.extend({
@@ -45,3 +44,11 @@ Conductor.Models.Deployments = Backbone.Collection.extend({
return Conductor.parameterizedPath(path, this.queryParams);
}
});
+
+Conductor.Models.Image = Backbone.Model.extend({
+ queryParams: {},
+ url: function() {
+ var path = Conductor.prefixedPath('/images/' + this.id);
+ return Conductor.parameterizedPath(path, this.queryParams);
+ }
+});
diff --git a/src/public/javascripts/backbone/routers.js b/src/public/javascripts/backbone/routers.js
index ed896d6..a243b1d 100644
--- a/src/public/javascripts/backbone/routers.js
+++ b/src/public/javascripts/backbone/routers.js
@@ -85,3 +85,23 @@ Conductor.Routers.Deployments = Backbone.Router.extend({
}, Conductor.AJAX_REFRESH_INTERVAL);
}
});
+
+
+Conductor.Routers.Images = Backbone.Router.extend({
+ routes: {
+ 'images/:id': 'show'
+ },
+
+ show: function(id) {
+ id = Conductor.uuidFromURLFragment(id);
+
+ setInterval(function() {
+ var image = new Conductor.Models.Image({ id: id });
+
+ var view = new Conductor.Views.ImagesShow({ model: image });
+ view.model.queryParams = view.queryParams();
+
+ image.fetch({ success: function() { view.render(); } })
+ }, Conductor.AJAX_REFRESH_INTERVAL);
+ }
+});
diff --git a/src/public/javascripts/backbone/views.js b/src/public/javascripts/backbone/views.js
index 97f678d..861a5cd 100644
--- a/src/public/javascripts/backbone/views.js
+++ b/src/public/javascripts/backbone/views.js
@@ -38,32 +38,10 @@ Conductor.Views.PoolsIndex = Backbone.View.extend({
}
},
- urlParams: function() {
- var paramsData = window.location.search.slice(1).split('&');
- var params = {};
- $.each(paramsData, function(index, value){
- var eqSign = value.search('=');
- if(eqSign != -1) {
- params[value.substring(0, eqSign)] = value.substring(eqSign+1);
- }
- });
-
- return params;
- },
-
queryParams: function() {
- var result = {};
var paramsToInclude = [this.currentTab() + '_preset_filter', this.currentTab() + '_search'];
- var urlParams = this.urlParams();
+ var result = Conductor.extractQueryParams(paramsToInclude);
- $.each(paramsToInclude, function(paramIndex, paramValue) {
- for (var urlParamName in urlParams) {
- if (urlParamName == paramValue) {
- result[urlParamName] = urlParams[urlParamName];
- break;
- }
- };
- });
// If there is no URL param for the preset filter, we still need to merge in the preset filter
var filter = this.currentTab() + '_preset_filter';
if(result[filter] == undefined) {
@@ -179,3 +157,23 @@ Conductor.Views.DeploymentsShow = Backbone.View.extend({
}
});
+
+Conductor.Views.ImagesShow = Backbone.View.extend({
+ el: '#content',
+
+ queryParams: function() {
+ var paramsToInclude = ['build'];
+ var result = Conductor.extractQueryParams(paramsToInclude);
+
+ return result;
+ },
+
+ render: function() {
+ var $builds = this.$('ul.image_builds');
+ if($builds.length === 0) return;
+
+ $builds.empty();
+
+ $('#imageBuildsTemplate').tmpl(this.model.toJSON()).appendTo($builds);
+ }
+});
--
1.7.6.5
12 years, 4 months
[PATCH conductor 1/2] BZ 772996: relabel "images ready", disable 'launch' before build
by Scott Seago
https://bugzilla.redhat.com/show_bug.cgi?id=772996
If an assembly in a deployable passes XML validation, it means that
the image is a valid IWHD image, and the HWP is a valid HWP for this
conductor instance. However, the 'images ready' text is confusing
in that it implies that the images are ready to deploy, which isn't
necessarily the case. Whether the images are ready to deploy (i.e.
they're pushed) is indicated in the 'images' section.
So this commit changes 'images ready' to 'images valid' to reflect
the nature of the validation.
In addition, the 'launch' action is disabled unless all images
are pushed to at least one provider account.
---
src/app/controllers/deployables_controller.rb | 5 +++-
src/app/helpers/deployables_helper.rb | 6 ++--
src/app/stylesheets/layout.scss | 2 +-
src/app/views/deployables/show.html.haml | 4 +-
src/config/locales/en.yml | 2 +-
src/features/config_server.feature | 24 ++++++++++----------
src/features/deployables.feature | 1 +
src/features/provider_account.feature | 2 +-
.../step_definitions/config_server_steps.rb | 4 +-
.../step_definitions/provider_account_steps.rb | 13 +++++++++-
src/spec/factories/deployable.rb | 4 +-
11 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb
index 22e87ea..be23bf2 100644
--- a/src/app/controllers/deployables_controller.rb
+++ b/src/app/controllers/deployables_controller.rb
@@ -85,13 +85,16 @@ class DeployablesController < ApplicationController
return unless @missing_images.empty?
@build_results = {}
+ @pushed_count = 0
ProviderAccount.list_for_user(current_user, Privilege::VIEW).includes(:provider).where('providers.enabled' => true).each do |account|
type = account.provider.provider_type.deltacloud_driver
@build_results[type] ||= []
+ status = @deployable.build_status(images, account)
+ @pushed_count += 1 if (status == :pushed)
@build_results[type] << {
:account => account.label,
:provider => account.provider.name,
- :status => @deployable.build_status(images, account),
+ :status => status,
}
end
end
diff --git a/src/app/helpers/deployables_helper.rb b/src/app/helpers/deployables_helper.rb
index 4edf2d2..d97eaef 100644
--- a/src/app/helpers/deployables_helper.rb
+++ b/src/app/helpers/deployables_helper.rb
@@ -1,15 +1,15 @@
module DeployablesHelper
- def image_ready?(assembly)
+ def image_valid?(assembly)
edit_xml_path = edit_polymorphic_path([@catalog, @deployable], :edit_xml => true)
if @missing_images.empty? && assembly[:hwp_name].present?
- link_to t('.images_ready'), edit_xml_path, :class => 'images_ready', :id => 'edit_xml_button'
+ link_to t('.images_valid'), edit_xml_path, :class => 'images_valid', :id => 'edit_xml_button'
elsif assembly[:hwp_name].nil?
link_to t('.repair_images'), edit_xml_path, :class => 'repair_images', :id => 'edit_xml_button'
elsif @missing_images.include?(assembly[:image_uuid])
link_to t('.repair_images'), edit_xml_path, :class => 'repair_images', :id => 'edit_xml_button'
else
- link_to t('.images_ready'), edit_xml_path, :class => 'images_ready', :id => 'edit_xml_button'
+ link_to t('.images_valid'), edit_xml_path, :class => 'images_valid', :id => 'edit_xml_button'
end
end
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index 1ba5a8c..9ecaf71 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -2550,7 +2550,7 @@ table.light_table{
-moz-box-shadow: 0px 0px 1px 0px #333;
box-shadow: 0px 0px 1px 0px #333;
text-shadow: 0px -1px 1px #888;
- &.images_ready{
+ &.images_valid{
background: #33cc00; /* Old browsers */
background: -moz-linear-gradient(top, #33cc00 0%, #28a600 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#33cc00), color-stop(100%,#28a600)); /* Chrome,Safari4+ */
diff --git a/src/app/views/deployables/show.html.haml b/src/app/views/deployables/show.html.haml
index b968857..8519ee0 100644
--- a/src/app/views/deployables/show.html.haml
+++ b/src/app/views/deployables/show.html.haml
@@ -7,7 +7,7 @@
= link_to t('.edit'), edit_polymorphic_path([@catalog, @deployable]), :class => 'button', :id => 'edit_button'
= link_to t('.edit_xml'), edit_polymorphic_path([@catalog, @deployable], :edit_xml => true), :class => 'button', :id => 'edit_xml_button'
- - if @catalog.present? && @deployable_errors.empty?
+ - if @catalog.present? && @deployable_errors.empty? && @pushed_count > 0
= link_to t('.launch'), launch_new_deployments_path(:deployable_id => @deployable.id, :pool_id => @catalog.pool), :id => :launch_deployment_button
-else
%a{:id => :launch_deployment_button, :class => 'disabled'}= t('.launch')
@@ -32,7 +32,7 @@
%tbody
- @images_details.each do |assembly|
%tr
- %td.status= image_ready?(assembly)
+ %td.status= image_valid?(assembly)
%td
%strong=assembly[:name]
%td.align-center=assembly[:images_count]
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 895a23e..6ca9177 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -819,7 +819,7 @@ en:
ram: RAM
arch: ARCH
repair_images: Repair Images
- images_ready: Images Ready
+ images_valid: Images Valid
build_description:
"Allow this deployable's associated image(s) to be built and
pushed to cloud resource providers by enabling them below."
diff --git a/src/features/config_server.feature b/src/features/config_server.feature
index c1fa1ef..4b4a944 100644
--- a/src/features/config_server.feature
+++ b/src/features/config_server.feature
@@ -13,7 +13,7 @@ Feature: Config Servers
Given I am on the homepage
And there is mock provider account "mock_account"
And I want to add a new config server
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "None" within "#config_server"
And I should see "[ Add ]" within "#config_server_control"
When I follow "Add"
@@ -22,7 +22,7 @@ Feature: Config Servers
And I fill in "config_server[key]" with "valid"
And I fill in "config_server[secret]" with "valid"
And I press "Save"
- Then I should be on mockprovider's provider mock_account's provider account page
+ Then I should be on mock's provider mock_account's provider account page
And I should see "Config server added"
And I should see "[ Edit ]" within "#config_server_control"
@@ -32,7 +32,7 @@ Feature: Config Servers
Given I am on the homepage
And there is mock provider account "mock_account"
And I am not sure about the config server endpoint
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "None" within "#config_server"
And I should see "[ Add ]" within "#config_server_control"
When I follow "Add"
@@ -50,7 +50,7 @@ Feature: Config Servers
Given I am on the homepage
And there is mock provider account "mock_account"
And I am not sure about the config server credentials
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "None" within "#config_server"
And I should see "[ Add ]" within "#config_server_control"
When I follow "Add"
@@ -65,36 +65,36 @@ Feature: Config Servers
Scenario: I should be able to edit a config server
Given I am on the homepage
And there is a mock config server "https://mock:443" for account "mock_account"
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "[ Edit ]" within "#config_server_control"
When I follow "Edit" within "#config_server_control"
Then I should be on the edit config server page for account "mock_account"
And I press "Save"
- Then I should be on mockprovider's provider mock_account's provider account page
+ Then I should be on mock's provider mock_account's provider account page
And I should see "Config server updated"
Scenario: I should be able to delete an existing config server
Given I am on the homepage
And there is a mock config server "https://mock:443" for account "mock_account"
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "[ Delete ]" within "#config_server_control"
When I follow "Delete" within "#config_server_control"
Then I should see "Config server was deleted"
- And I should be on mockprovider's provider mock_account's provider account page
+ And I should be on mock's provider mock_account's provider account page
Scenario: I should be able to test a correctly configured and available config server
Given I am on the homepage
And there is a mock config server "https://mock:443" for account "mock_account"
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "[ Test ]" within "#config_server_control"
When I follow "Test" within "#config_server_control"
Then I should see "Test successful"
- And I should be on mockprovider's provider mock_account's provider account page
+ And I should be on mock's provider mock_account's provider account page
Scenario: I should see an error when I test a config server with invalid credentials
Given I am on the homepage
And there is a mock config server "https://bad_credentials" for account "mock_account"
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "[ Test ]" within "#config_server_control"
When I follow "Test" within "#config_server_control"
Then I should see "Could not validate config server connection"
@@ -103,7 +103,7 @@ Feature: Config Servers
Scenario: I should see an error when I test a config server with an invalid endpoint
Given I am on the homepage
And there is a mock config server "https://bad_host" for account "mock_account"
- When I go to mockprovider's provider mock_account's provider account page
+ When I go to mock's provider mock_account's provider account page
Then I should see "[ Test ]" within "#config_server_control"
When I follow "Test" within "#config_server_control"
Then I should see "Could not validate config server connection"
diff --git a/src/features/deployables.feature b/src/features/deployables.feature
index 9a60274..64dbece 100644
--- a/src/features/deployables.feature
+++ b/src/features/deployables.feature
@@ -6,6 +6,7 @@ Feature: Manage Catalog Entries
Background:
Given I am an authorised user
And I am logged in
+ And there is mock provider account "mock_account"
Scenario: Create new catalog entry
Given there is a "default" catalog
diff --git a/src/features/provider_account.feature b/src/features/provider_account.feature
index d105dea..f5b131b 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -22,7 +22,7 @@ Feature: Manage Provider Accounts
Then I should get a XML document
And there should be these mock provider accounts:
| name | provider | provider_type | username | password |
- | mock_account | mockprovider | mock |||
+ | mock_account | mock | mock |||
And there should be these ec2 provider accounts:
| name | provider | provider_type | access_key | secret_access_key |
| ec2_account | ec2provider| ec2 |||
diff --git a/src/features/step_definitions/config_server_steps.rb b/src/features/step_definitions/config_server_steps.rb
index 7493a6b..805f4a9 100644
--- a/src/features/step_definitions/config_server_steps.rb
+++ b/src/features/step_definitions/config_server_steps.rb
@@ -29,8 +29,8 @@ Given /^I am not sure about the config server credentials$/ do
end
Given /^there is a mock config server "(http|https):\/\/(.*)" for account "(.*)"$/ do |scheme,endpoint,acc|
- provider = Provider.find_by_name "mockprovider"
- provider ||= Factory :mock_provider, :name => "mockprovider"
+ provider = Provider.find_by_name "mock"
+ provider ||= Factory :mock_provider, :name => "mock"
mock_account = ProviderAccount.find_by_label(acc)
mock_account ||= Factory :mock_provider_account, :label => acc, :provider => provider
params = {:endpoint => endpoint, :key => "key", :secret => "secret", :provider_account => mock_account}
diff --git a/src/features/step_definitions/provider_account_steps.rb b/src/features/step_definitions/provider_account_steps.rb
index 7284fb2..01d44e3 100644
--- a/src/features/step_definitions/provider_account_steps.rb
+++ b/src/features/step_definitions/provider_account_steps.rb
@@ -80,8 +80,17 @@ Given /^there is ec2 provider account "([^"]*)"$/ do |arg1|
end
Given /^there is mock provider account "([^"]*)"$/ do |arg1|
- provider = FactoryGirl.create(:mock_provider, :name => 'mockprovider')
- FactoryGirl.create(:mock_provider_account, :label => arg1, :provider => provider)
+ if (provider = Provider.find_by_name('mock'))
+ if account = provider.provider_accounts.first
+ account.label = arg1
+ account.save
+ else
+ FactoryGirl.create(:mock_provider_account, :label => arg1, :provider => provider)
+ end
+ else
+ provider = FactoryGirl.create(:mock_provider, :name => 'mock')
+ FactoryGirl.create(:mock_provider_account, :label => arg1, :provider => provider)
+ end
end
Then /^there should be these mock provider accounts:$/ do |table|
diff --git a/src/spec/factories/deployable.rb b/src/spec/factories/deployable.rb
index 98707a2..d5afa1e 100644
--- a/src/spec/factories/deployable.rb
+++ b/src/spec/factories/deployable.rb
@@ -22,10 +22,10 @@ FactoryGirl.define do
<description>This is my testing image</description>
<assemblies>
<assembly name='frontend' hwp='front_hwp1'>
- <image id='85653387-88b2-46b0-b7b2-c779d2af06c7' build='c5fc000b-829a-4bb5-9df1-bb228da2c7ec'></image>
+ <image id='53d2a281-448b-4872-b1b0-680edaad5922' build='63838705-8608-44c6-aded-7c243137172c'></image>
</assembly>
<assembly name='backend' hwp='front_hwp2'>
- <image id='85653387-88b2-46b0-b7b2-c779d2af06c7' build='c5fc000b-829a-4bb5-9df1-bb228da2c7ec'></image>
+ <image id='53d2a281-448b-4872-b1b0-680edaad5922' build='63838705-8608-44c6-aded-7c243137172c'></image>
</assembly>
</assemblies>
</deployable>"
--
1.7.6.4
12 years, 4 months
[PATCH conductor 1/4] Fix the missing tabs in the Admin section for IE
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
---
src/app/stylesheets/layout.scss | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index beb2191..91785a0 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -1658,6 +1658,7 @@ section.admin-content-section{
/* Header code */
header{
position: relative;
+ height: 30px;
h2{
font-family: $font-family-primary;
font-size: 21px;
--
1.7.6.5
12 years, 4 months
[PATCH conductor] Fixed counting uptime
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
Fixed problem of bad uptime counting for RHEV's deployments.
https://bugzilla.redhat.com/show_bug.cgi?id=743395
---
src/app/models/deployment.rb | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 52880c0..991a83c 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -351,16 +351,16 @@ class Deployment < ActiveRecord::Base
def uptime_1st_instance
return if events.empty?
if instances.deployed.empty?
- if instances.count > 1 && events.find_by_status_code(:all_stopped) && events.find_by_status_code(:first_running)
- events.find_by_status_code(:all_stopped).event_time - events.find_by_status_code(:first_running).event_time
- elsif events.find_by_status_code(:all_stopped) && events.find_by_status_code(:all_running)
- events.find_by_status_code(:all_stopped).event_time - events.find_by_status_code(:all_running).event_time
+ if events.find_by_status_code(:all_stopped) && events.find_by_status_code(:first_running) && events.find_last_by_status_code(:all_stopped).event_time > events.find_by_status_code(:first_running).event_time
+ events.find_last_by_status_code(:all_stopped).event_time - events.find_by_status_code(:first_running).event_time
+ else
+ return
end
else
- if instances.count > 1 && events.find_by_status_code(:first_running)
+ if events.find_by_status_code(:first_running)
Time.now.utc - events.find_by_status_code(:first_running).event_time
- elsif events.find_by_status_code(:all_running)
- Time.now.utc - events.find_by_status_code(:all_running).event_time
+ else
+ return
end
end
end
@@ -371,8 +371,8 @@ class Deployment < ActiveRecord::Base
Time.now.utc - events.lifetime.last.event_time
elsif instances.count > 1 && events.find_by_status_code(:all_running) && events.find_by_status_code(:some_stopped)
events.find_by_status_code(:some_stopped).event_time - events.find_by_status_code(:all_running).event_time
- elsif events.find_by_status_code(:all_stopped) && events.find_by_status_code(:all_running)
- events.find_by_status_code(:all_stopped).event_time - events.find_by_status_code(:all_running).event_time
+ elsif events.find_by_status_code(:all_stopped) && events.find_by_status_code(:all_running) && events.find_last_by_status_code(:all_stopped).event_time > events.find_by_status_code(:all_running).event_time
+ events.find_last_by_status_code(:all_stopped).event_time - events.find_by_status_code(:all_running).event_time
end
end
--
1.7.7.5
12 years, 4 months
[PATCH Audrey] BZs 781459, 768433, and 773036
by Greg Blomquist
Fixes for 781459, 768433, and 773036.
Now, config server setup will:
* save iptables rules to survive a reboot
* not fail to create ssh keys on rhel6.2
* not create iptables rules multiple times
pushing changes to master and 1.0 branches
12 years, 4 months
[PATCH conductor 1/4] Fix the missing tabs in the Admin section for IE
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
---
src/app/stylesheets/layout.scss | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index 1ba5a8c..eb2fd4e 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -1644,6 +1644,7 @@ section.admin-content-section{
/* Header code */
header{
position: relative;
+ height: 30px;
h2{
font-family: $font-family-primary;
font-size: 21px;
--
1.7.6.5
12 years, 4 months
[PATCH conductor] BZ771599: Restrict user deletion when user has running instances
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=771599
---
src/app/controllers/users_controller.rb | 28 +++++++++++++++++++---------
src/app/models/user.rb | 6 ++++++
src/config/locales/en.yml | 5 ++++-
src/spec/models/user_spec.rb | 7 +++++++
4 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 0af28e7..a2161ec 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -105,17 +105,27 @@ class UsersController < ApplicationController
def multi_destroy
require_privilege(Privilege::MODIFY, User)
deleted_users = []
- User.find(params[:user_selected]).each do |user|
- if user == current_user
- flash[:warning] = "#{t('users.flash.warning.not_delete', :login => "#{user.login}")}"
- else
- user.destroy
- deleted_users << user.login
+
+ begin
+ User.transaction do
+ User.find(params[:user_selected]).each do |user|
+ if user == current_user
+ flash[:warning] = t('users.flash.warning.not_delete_same_user', :login => "#{user.login}")
+ else
+ user.destroy
+ deleted_users << user.login
+ end
+ end
end
+
+ unless deleted_users.empty?
+ flash[:notice] = "#{t('users.flash.notice.more_deleted', :count => deleted_users.length)} #{deleted_users.join(', ')}"
+ end
+
+ rescue => ex
+ flash[:warning] = t('users.flash.warning.not_delete', :reason => ex.message)
end
- unless deleted_users.empty?
- flash[:notice] = "#{t('users.flash.notice.more_deleted', :count => deleted_users.length)} #{deleted_users.join(', ')}"
- end
+
redirect_to users_url
end
diff --git a/src/app/models/user.rb b/src/app/models/user.rb
index 99ac30f..8b80ba1 100644
--- a/src/app/models/user.rb
+++ b/src/app/models/user.rb
@@ -83,6 +83,7 @@ class User < ActiveRecord::Base
#validates_format_of :email, :with => /^([^\s]+)((?:[-a-z0-9]\.)[a-z]{2,})$/i
before_save :encrypt_password
+ before_destroy :ensure_not_running_any_instances
def name
"#{first_name} #{last_name}"
@@ -148,4 +149,9 @@ class User < ActiveRecord::Base
def self.create_ldap_user!(login)
User.create!(:login => login, :quota => Quota.new, :ignore_password => true)
end
+
+ def ensure_not_running_any_instances
+ raise I18n.t('users.errors.has_running_instances', :login => login) if deployments.any?{ |deployment| deployment.any_instance_running? }
+ end
+
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index ad5f784..84e0a9e 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -52,11 +52,14 @@ en:
one: Deleted user
other: Deleted users
warning:
- not_delete: "Cannot delete %{login} : you are logged in as this user"
+ not_delete: 'Cannot delete: %{reason}'
+ not_delete_same_user: "Cannot delete %{login} : you are logged in as this user"
preset_filters:
all_users: "All Users"
name_starts_with_A: "Name starts with A"
name_starts_with_B: "Name starts with B"
+ errors:
+ has_running_instances: '%{login} has running instances'
user_sessions:
new:
username: "Username:"
diff --git a/src/spec/models/user_spec.rb b/src/spec/models/user_spec.rb
index b0bb1c7..1bd1a8b 100644
--- a/src/spec/models/user_spec.rb
+++ b/src/spec/models/user_spec.rb
@@ -111,4 +111,11 @@ describe User do
u.id.should == user.id
end
+ it "should reject destroy when user has running instances" do
+ user = Factory.create(:tuser)
+ deployment = Factory.create(:deployment, :owner => user)
+ instance = Factory.create(:mock_running_instance, :deployment_id => deployment.id)
+ lambda { user.destroy }.should raise_error(RuntimeError, "#{user.login} has running instances")
+ end
+
end
--
1.7.6.5
12 years, 4 months