[PATCH conductor] BZ 785334 - fixed migration problem
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
provider_accounts_realm is now precreated before any migrations to make sure that
it won't be missing in migrations which use models realted to this (ProviderAccount, Realm)
---
...000000001000_create_provider_accounts_realms.rb | 38 ++++++++++++++++++++
.../20120118221000_add_provider_accounts_realms.rb | 8 +++--
2 files changed, 43 insertions(+), 3 deletions(-)
create mode 100644 src/db/migrate/00000000001000_create_provider_accounts_realms.rb
diff --git a/src/db/migrate/00000000001000_create_provider_accounts_realms.rb b/src/db/migrate/00000000001000_create_provider_accounts_realms.rb
new file mode 100644
index 0000000..2160631
--- /dev/null
+++ b/src/db/migrate/00000000001000_create_provider_accounts_realms.rb
@@ -0,0 +1,38 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=785334
+# in one of later migrations provider_accounts_realms table was added
+# (new HABTM assoc), but this breaks some earlier migrations
+# because they use ProviderAccount and Realm models too
+
+class CreateProviderAccountsRealms < ActiveRecord::Migration
+ def self.up
+ unless ActiveRecord::Base.connection.tables.include?('provider_accounts_realms')
+ create_table :provider_accounts_realms, :id => false do |t|
+ t.integer :provider_account_id, :null => false
+ t.integer :realm_id, :null => false
+ end
+ end
+ end
+
+ def self.down
+ drop_table :provider_accounts_realms
+ end
+end
diff --git a/src/db/migrate/20120118221000_add_provider_accounts_realms.rb b/src/db/migrate/20120118221000_add_provider_accounts_realms.rb
index 590e921..61dbd7c 100644
--- a/src/db/migrate/20120118221000_add_provider_accounts_realms.rb
+++ b/src/db/migrate/20120118221000_add_provider_accounts_realms.rb
@@ -19,9 +19,11 @@
class AddProviderAccountsRealms < ActiveRecord::Migration
def self.up
- create_table :provider_accounts_realms, :id => false do |t|
- t.integer :provider_account_id, :null => false
- t.integer :realm_id, :null => false
+ unless ActiveRecord::Base.connection.tables.include?('provider_accounts_realms')
+ create_table :provider_accounts_realms, :id => false do |t|
+ t.integer :provider_account_id, :null => false
+ t.integer :realm_id, :null => false
+ end
end
Realm.transaction do
--
1.7.7.5
12 years, 3 months
[PATCH conductor] catalog dropdown visibility fix
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
---
src/app/stylesheets/layout.scss | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index 8588e2b..ccf319e 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -2684,6 +2684,7 @@ div.build_status{
.catalog_list{
position: relative;
+ z-index:1000;
.more{
font-size: 12px;
@@ -2692,7 +2693,6 @@ div.build_status{
border-top: none;
display:none;
position:absolute;
- z-index:1000;
background-color:#ececec;
top: 5px;
right: -15px;
--
1.7.7.6
12 years, 3 months
Re: Aeolus 0.8.0 installation not working with Eucalyptus
by Justin Clift
Hey guys,
Where does an admin set the "X-Deltacloud-Driver" field through Conductor?
Looking at Ilpo's recent message on the Fedora Cloud SIG mailing list, he's passing the "X-Deltacloud-Provider" field, but he may not be setting the "X-Deltacloud-Driver" one.
http://deltacloud.apache.org/drivers.html#h3_2
Not having set up Eucalyptus myself yet, I'm not sure what the correct approach is. :/
Regards and best wishes,
Justin Clift
On 24/01/2012, at 7:08 PM, Ilpo Latvala wrote:
> Hi,
>
> I installed Aeolus 0.8.0 on Fedora 16 and the installation itself went ok.
> I added a new provider:
>
> URL: http://localhost:3002/api
> Provider Type: Amazon EC2
> X-Deltacloud-Provider: ec2=192.168.1.10:8773;s3=192.168.1.10:8773
>
> Test Connection works ok.
>
> Since Aeolus does not have Eucalyptus as a provider I am forced to use EC2 as a provider type and X-Deltacloud-Provider is giving my Euca installation details.
>
> When I try to add a new account with my user details, I get the error "undefined method `provider_type' for nil:NilClass".
> So it seems like the current deltacloud included in aeolus does not recognize the euca provider format (ec2=192.168.1.10:8773;s3=192.168.1.10:8773).
>
> Any plans to get Aeolus to work with a private eucalyptus installation?
>
> Thanks,
>
> -Ilpo Latvala-
> Ilpo.latvala(a)proact.fi
>
> _______________________________________________
> cloud mailing list
> cloud(a)lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/cloud
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 3 months
[PATCH configure] BZ #783220 - change default admin email to 'root@localhost'
by Mo Morsi
---
recipes/aeolus/manifests/profiles/conductor.pp | 6 +++---
recipes/aeolus/manifests/profiles/custom.pp | 6 +++---
recipes/aeolus/manifests/profiles/default.pp | 6 +++---
recipes/aeolus/manifests/profiles/ec2.pp | 6 +++---
recipes/aeolus/manifests/profiles/mock.pp | 6 +++---
recipes/aeolus/manifests/profiles/rhevm.pp | 6 +++---
recipes/aeolus/manifests/profiles/vsphere.pp | 6 +++---
7 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/recipes/aeolus/manifests/profiles/conductor.pp b/recipes/aeolus/manifests/profiles/conductor.pp
index 83e0731..aabd98f 100644
--- a/recipes/aeolus/manifests/profiles/conductor.pp
+++ b/recipes/aeolus/manifests/profiles/conductor.pp
@@ -15,10 +15,10 @@
class aeolus::profiles::conductor {
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
diff --git a/recipes/aeolus/manifests/profiles/custom.pp b/recipes/aeolus/manifests/profiles/custom.pp
index d87c0fe..fdbe126 100644
--- a/recipes/aeolus/manifests/profiles/custom.pp
+++ b/recipes/aeolus/manifests/profiles/custom.pp
@@ -15,10 +15,10 @@
class aeolus::profiles::custom {
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
diff --git a/recipes/aeolus/manifests/profiles/default.pp b/recipes/aeolus/manifests/profiles/default.pp
index c3a58cd..8ac8ab3 100644
--- a/recipes/aeolus/manifests/profiles/default.pp
+++ b/recipes/aeolus/manifests/profiles/default.pp
@@ -17,10 +17,10 @@ class aeolus::profiles::default {
aeolus::create_bucket{"aeolus":}
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
diff --git a/recipes/aeolus/manifests/profiles/ec2.pp b/recipes/aeolus/manifests/profiles/ec2.pp
index 0cec35f..d8f408d 100644
--- a/recipes/aeolus/manifests/profiles/ec2.pp
+++ b/recipes/aeolus/manifests/profiles/ec2.pp
@@ -18,10 +18,10 @@ class aeolus::profiles::ec2 {
aeolus::create_bucket{"aeolus":}
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
diff --git a/recipes/aeolus/manifests/profiles/mock.pp b/recipes/aeolus/manifests/profiles/mock.pp
index c96a48c..a4b4b83 100644
--- a/recipes/aeolus/manifests/profiles/mock.pp
+++ b/recipes/aeolus/manifests/profiles/mock.pp
@@ -17,10 +17,10 @@ class aeolus::profiles::mock {
aeolus::create_bucket{"aeolus":}
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
diff --git a/recipes/aeolus/manifests/profiles/rhevm.pp b/recipes/aeolus/manifests/profiles/rhevm.pp
index 0663a47..5322f30 100644
--- a/recipes/aeolus/manifests/profiles/rhevm.pp
+++ b/recipes/aeolus/manifests/profiles/rhevm.pp
@@ -52,10 +52,10 @@ class aeolus::profiles::rhevm {
aeolus::create_bucket{"aeolus":}
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
diff --git a/recipes/aeolus/manifests/profiles/vsphere.pp b/recipes/aeolus/manifests/profiles/vsphere.pp
index 130a80a..c28e7e1 100644
--- a/recipes/aeolus/manifests/profiles/vsphere.pp
+++ b/recipes/aeolus/manifests/profiles/vsphere.pp
@@ -31,10 +31,10 @@ class aeolus::profiles::vsphere {
require => Package['aeolus-conductor-daemons'] }
aeolus::conductor::site_admin{"admin":
- email => 'dcuser(a)aeolusproject.org',
+ email => 'root@localhost',
password => "password",
- first_name => 'aeolus',
- last_name => 'user'}
+ first_name => 'Admin',
+ last_name => 'User'}
aeolus::conductor::login{"admin": password => "password",
require => Aeolus::Conductor::Site_admin['admin']}
--
1.7.6.5
12 years, 3 months
[PATCH configure] BZ 785217 - check provider add success by inspecting the flash image alt text
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=785217
Bug was produced when "Provider added." was changed to "Cloud Resource Provider added."
This text is internationalized so to simplify the check, we instead,
look at the alt text of the image that is included in the flash message.
The alt text has the value 'Notices' if there are no errors and
has the value 'Warnings' if there are errors.
---
recipes/aeolus/manifests/conductor.pp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/recipes/aeolus/manifests/conductor.pp b/recipes/aeolus/manifests/conductor.pp
index ff68ff5..27a3ca1 100644
--- a/recipes/aeolus/manifests/conductor.pp
+++ b/recipes/aeolus/manifests/conductor.pp
@@ -236,7 +236,7 @@ define aeolus::conductor::provider($deltacloud_driver="",$url="", $deltacloud_pr
'provider[deltacloud_provider]' => $deltacloud_provider },
returns => '200',
follow => true,
- contains => "//html/body//li[text() = 'Provider added.']",
+ contains => "//img[@alt='Notices']", # in the case of an error, @alt='Warnings'
use_cookies_at => '/tmp/aeolus-admin',
log_to => '/tmp/configure-provider-request.log',
only_log_errors => true,
--
1.7.6.5
12 years, 3 months
[PATCH aeolus-configure] BZ #784833. -d param is positionally dependent
by Jason Guiditta
https://bugzilla.redhat.com/show_bug.cgi?id=784833
It turns out both of these flags set a LOGLEVEL variable,
so really only one can be set at a time. configure honors the
last one passed in, so I just updated the help to explain this.
---
bin/aeolus-configure | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/bin/aeolus-configure b/bin/aeolus-configure
index 6afd99b..a12b4fb 100755
--- a/bin/aeolus-configure
+++ b/bin/aeolus-configure
@@ -25,6 +25,8 @@ OPTIONS:
-h | --help Show this message.
-d | --debug Debug logging mode.
-v | --verbose Verbose logging mode.
+ Note that you can only set one of the previous two options per run. If both are set,
+ the last one passed in will be honored.
-p | --profile Name of profile to use. A comma separated list can be used to specify multiple profiles.
EOF
}
--
1.7.7.6
12 years, 3 months
[PATCH conductor] Make tests (and app) work on mysql.
by Jason Guiditta
ILIKE does not work with mysql, this gets around that fact
by simple comparing only lower case in all instances.
I think these methods should also be refactored into a single
method used by all models, by I am going to leave that as a future
exercise.
Test were run for this patch against, pg, mysql, and sqlite.
All passed.
---
src/app/models/catalog.rb | 2 +-
src/app/models/deployable.rb | 2 +-
src/app/models/deployment.rb | 4 ++--
src/app/models/frontend_realm.rb | 2 +-
src/app/models/hardware_profile.rb | 2 +-
src/app/models/instance.rb | 2 +-
src/app/models/pool.rb | 2 +-
src/app/models/provider_account.rb | 2 +-
src/app/models/user.rb | 2 +-
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/app/models/catalog.rb b/src/app/models/catalog.rb
index 69d55f2..00d1e7a 100644
--- a/src/app/models/catalog.rb
+++ b/src/app/models/catalog.rb
@@ -57,7 +57,7 @@ class Catalog < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- includes(:pool).where("catalogs.name ILIKE :search OR pools.name ILIKE :search", :search => "%#{search}%")
+ includes(:pool).where("lower(catalogs.name) LIKE :search OR lower(pools.name) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/deployable.rb b/src/app/models/deployable.rb
index 4eb5695..95db158 100644
--- a/src/app/models/deployable.rb
+++ b/src/app/models/deployable.rb
@@ -160,7 +160,7 @@ class Deployable < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- where("name ILIKE :search", :search => "%#{search}%")
+ where("lower(name) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 28a2f53..ed9c0d7 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -469,8 +469,8 @@ class Deployment < ActiveRecord::Base
if search
includes(:pool, :provider_accounts => :provider).
joins("LEFT OUTER JOIN provider_types ON provider_types.id = providers.provider_type_id").
- where("pools.name ILIKE :search OR deployments.name ILIKE :search OR provider_types.name ILIKE :search",
- :search => "%#{search}%")
+ where("lower(pools.name) LIKE :search OR lower(deployments.name) LIKE :search OR lower(provider_types.name) LIKE :search",
+ :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/frontend_realm.rb b/src/app/models/frontend_realm.rb
index 08ab579..032d0fa 100644
--- a/src/app/models/frontend_realm.rb
+++ b/src/app/models/frontend_realm.rb
@@ -53,7 +53,7 @@ class FrontendRealm < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- where("frontend_realms.name ILIKE :search", :search => "%#{search}%")
+ where("lower(frontend_realms.name) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index 6b7041c..087d2ae 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -165,7 +165,7 @@ class HardwareProfile < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- where("name ILIKE :search", :search => "%#{search}%")
+ where("lower(name) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 6afd88b..8aa8401 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -475,7 +475,7 @@ class Instance < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- where("instances.name ILIKE :search OR instances.state ILIKE :search", :search => "%#{search}%")
+ where("lower(instances.name) LIKE :search OR lower(instances.state) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index ad9d58c..878c96c 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -139,7 +139,7 @@ class Pool < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- includes(:pool_family).where("pools.name ILIKE :search OR pool_families.name ILIKE :search", :search => "%#{search}%")
+ includes(:pool_family).where("lower(pools.name) LIKE :search OR lower(pool_families.name) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 07e5014..e772f52 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -384,7 +384,7 @@ class ProviderAccount < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- includes(:provider => [:provider_type]).where("provider_accounts.label ILIKE :search OR providers.name ILIKE :search OR provider_types.name ILIKE :search", :search => "%#{search}%")
+ includes(:provider => [:provider_type]).where("lower(provider_accounts.label) LIKE :search OR lower(providers.name) LIKE :search OR lower(provider_types.name) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
diff --git a/src/app/models/user.rb b/src/app/models/user.rb
index 8b80ba1..9902464 100644
--- a/src/app/models/user.rb
+++ b/src/app/models/user.rb
@@ -136,7 +136,7 @@ class User < ActiveRecord::Base
def self.apply_search_filter(search)
if search
- where("first_name ILIKE :search OR last_name ILIKE :search OR login ILIKE :search OR email ILIKE :search", :search => "%#{search}%")
+ where("lower(first_name) LIKE :search OR lower(last_name) LIKE :search OR lower(login) LIKE :search OR lower(email) LIKE :search", :search => "%#{search.downcase}%")
else
scoped
end
--
1.7.7.6
12 years, 3 months
Re: [PATCH conductor] BZ 773027 Add image, build, targetImage hash to deployable details
by Tomas Sedovic
On 01/27/2012 01:12 PM, Tomas Sedovic wrote:
> On 01/27/2012 02:39 AM, jzigmund(a)redhat.com wrote:
>> From: Jozef Zigmund<jzigmund(a)redhat.com>
>>
>> Now user see UUIDs of deployable's images when he point to image name
>> in deployables#show.
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=773027
>> ---
>> src/app/controllers/deployables_controller.rb | 1 +
>> src/app/helpers/deployables_helper.rb | 9 +++++++++
>> src/app/models/deployable.rb | 25 +++++++++++++++++++++++++
>> src/app/views/deployables/show.html.haml | 22 +++++++++++-----------
>> 4 files changed, 46 insertions(+), 11 deletions(-)
>>
>> diff --git a/src/app/controllers/deployables_controller.rb
>> b/src/app/controllers/deployables_controller.rb
>> index 9540233..039535e 100644
>> --- a/src/app/controllers/deployables_controller.rb
>> +++ b/src/app/controllers/deployables_controller.rb
>> @@ -70,6 +70,7 @@ class DeployablesController< ApplicationController
>> images = @deployable.fetch_images
>> uuids = @deployable.fetch_image_uuids
>> @missing_images = images.zip(uuids).select{|p| p.first.nil?}.map{|p|
>> p.second}
>> + @images_hash_details = images != [nil] ?
>> @deployable.get_uuids_hash(images) : nil
>>
>> @images_details.each do |assembly|
>> assembly.keys.each do |key|
>> diff --git a/src/app/helpers/deployables_helper.rb
>> b/src/app/helpers/deployables_helper.rb
>> index d97eaef..8414231 100644
>> --- a/src/app/helpers/deployables_helper.rb
>> +++ b/src/app/helpers/deployables_helper.rb
>> @@ -16,4 +16,13 @@ module DeployablesHelper
>> def deployable_ready?
>> false
>> end
>> +
>> + def parse_images_hash_details(index, hash)
>> + return "N/A" unless hash
>> + result = ""
>> + result += (hash[index][0].nil? ? "Image UUID: N/A\n" : "Image UUID:
>> #{hash[index][0]}\n")
>> + result += (hash[index][1].nil? ? "Latest Build UUID: N/A\n" :
>> "Latest Build UUID: #{hash[index][1]}\n")
>> + result += (hash[index][2].nil? ? "Target Images UUIDs: N/A\n" :
>> "Target Images UUIDs: #{hash[index][2]}\n")
>
> Please replace the hardcoded strings above with proper I18n.translate
> calls.
>
>> + result
>> + end
>> end
>> diff --git a/src/app/models/deployable.rb b/src/app/models/deployable.rb
>> index 4eb5695..e4d97a5 100644
>> --- a/src/app/models/deployable.rb
>> +++ b/src/app/models/deployable.rb
>> @@ -156,6 +156,31 @@ class Deployable< ActiveRecord::Base
>> [catalog, self]
>> end
>>
>> + def get_uuids_hash(images)
>> + image_uuids = []
>> + target_image_uuids = []
>> + latest_build_uuid = []
>> +
>> + images.each do |i|
>> + image_uuids<< (i.respond_to?(:uuid) ? i.uuid : nil)
>> + latest_build = i.latest_pushed_build if
>> i.respond_to?(:latest_pushed_build)
>> + latest_build_uuid<< (latest_build ? latest_build.uuid : nil)
>> + if latest_build
>> + target_images = latest_build.target_images
>> + target_image_uuids_for_build = []
>> + target_images.each do |ti|
>> + target_image_uuids_for_build<< ti.uuid
>> + end
>> + target_image_uuids<< target_image_uuids_for_build
>> + else
>> + target_image_uuids<< nil
>> + end
>> + end
>> +
>> + #return array [[image_uuid, latest_build_uuid,
>> [target_image_uuids]], [..]]
>> + image_uuids.zip(latest_build_uuid, target_image_uuids)
>
> I think it would be more maintainable in the future if we used array of
> hashes instead of array of arrays:
>
> [{:image => '9034285', :latest_build => '93284', :target_image =>
> '98345'}, {:image => '93248', :latest_build => '92384', :target_image =>
> '948532'}, ...]
>
> instead of the current:
>
> [['9034285', '93284', '98345'], ['93248', '92384', '948532'], ...]
>
>
>> + end
>> +
>> private
>>
>> def self.apply_search_filter(search)
>> diff --git a/src/app/views/deployables/show.html.haml
>> b/src/app/views/deployables/show.html.haml
>> index 40cc6d6..0a9cb58 100644
>> --- a/src/app/views/deployables/show.html.haml
>> +++ b/src/app/views/deployables/show.html.haml
>> @@ -28,17 +28,17 @@
>> %th.align-center=t'.hdd'
>> %th.align-center=t'.ram'
>> %th.align-center=t'.arch'
>> - %tbody
>> - - @images_details.each do |assembly|
>> - %tr
>> - %td.status= image_valid?(assembly)
>> - %td
>> - %strong=assembly[:name]
>> - %td.align-center=assembly[:images_count]
>> - %td=assembly[:hwp_name]
>> - %td.align-center=assembly[:hwp_hdd]
>> - %td.align-center=assembly[:hwp_ram]
>> - %td.align-center=assembly[:hwp_arch]
>> + %tbody
>> + - @images_details.each_index do |index|
>
> You can use this instead:
>
> @images_details.each_with_index do |assembly, index|
>
> It will simplify all the `@images_details[index]` code but you'll still
> have the index available for the `parse_images_hash_details` call.
>
>> + %tr
>> + %td.status= image_valid?(@images_details[index])
>> + %td
>> + %strong{:title => "#{parse_images_hash_details(index,
>> @images_hash_details)}"}=@images_details[index][:name]
>> + %td.align-center=@images_details[index][:images_count]
>> + %td=@images_details[index][:hwp_name]
>> + %td.align-center=@images_details[index][:hwp_hdd]
>> + %td.align-center=@images_details[index][:hwp_ram]
>> + %td.align-center=@images_details[index][:hwp_arch]
>>
>> %section.admin-content-section
>> - if @missing_images.empty?
>
>
> ACK with some nits inline. Please fix at least the I18n issue them
> before pushing. Ideally the rest, too.
>
> One note on the usability: I think it's pretty much impossible to
> discover this feature so most users won't even know that it's there.
>
> It took me some time to find the UUIDs and I've had the source code open
> right next to the Conductor page.
>
> Was there a reason why you didn't go with what Wes suggested in the
> bug's attachment? That is, put it to the providers/accounts list on the
> deployables#details page and have it collapsed by default?
>
> I think that would make it much more useful. Try to ping Ken and ask
> what he thinks.
>
> Thomas
12 years, 3 months
[PATCH conductor] Move the text in the footer to our I18n dictionary
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
---
src/app/views/layouts/application.html.haml | 8 ++++----
src/config/locales/en.yml | 4 ++++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/app/views/layouts/application.html.haml b/src/app/views/layouts/application.html.haml
index 09b0668..249b19e 100644
--- a/src/app/views/layouts/application.html.haml
+++ b/src/app/views/layouts/application.html.haml
@@ -59,7 +59,7 @@
%span.logo Aeolus
#legal
%nav.footer
- %a{:href => '#'} Disclaimer
- %a{:href => '#'} Terms of Use
- %a{:href => '#'} Support
- %span.copyright Copyright © 2011 Red Hat, Inc. All Rights Reserved.
+ %a{:href => '#'}= t :disclaimer
+ %a{:href => '#'}= t :terms_of_use
+ %a{:href => '#'}= t :support
+ %span.copyright!= t :copyright
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index cc67125..1a3a8a3 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -1,4 +1,8 @@
en:
+ disclaimer: Disclaimer
+ terms_of_use: Terms of Use
+ support: Support
+ copyright: "Copyright © 2011 Red Hat, Inc. All Rights Reserved."
dashboard: Dashboard
datetime:
distance_in_words:
--
1.7.6.5
12 years, 3 months
[PATCH conductor] BZ773034: Autoupdate for images#show (rev. 2)
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
Sending a rebased patch and now it also depends on my previous patchset "BZ781482: feedback for image build/push failures".
https://bugzilla.redhat.com/show_bug.cgi?id=773034
---
src/app/controllers/images_controller.rb | 53 +++++++++++++++
src/app/models/provider_account.rb | 6 ++
src/app/views/images/show.html.haml | 97 ++++++++++++++++++++++++++++
src/public/javascripts/application.js | 32 +++++++++
src/public/javascripts/backbone/models.js | 8 ++
src/public/javascripts/backbone/routers.js | 19 ++++++
src/public/javascripts/backbone/views.js | 45 ++++++-------
7 files changed, 237 insertions(+), 23 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index 41c48a5..997ab6a 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -60,6 +60,59 @@ class ImagesController < ApplicationController
load_builds
load_target_images(@build)
flash[:error] = t("images.flash.error.no_provider_accounts") if @account_groups.size == 0
+
+ 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
+
+ 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.credentials_hash['username'])
+ end if timg.present?
+
+ 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.credentials_hash['username']).first
+ end if timg.present?
+
+ result
+ end
+
+ failed_build_counts = @account_groups.keys.inject({}) do |result, driver|
+ result[driver] = @builder.failed_build_count((a)build.id, driver) if @build
+ result
+ end
+
+ failed_push_counts = @account_groups.inject({}) do |result, (driver, group)|
+ timg = @target_images_by_target[driver]
+ group[:accounts].each do |account|
+ result[account.id] = @builder.failed_push_count(timg.id, account.provider.name, account.credentials_hash['username'])
+ end if timg.present?
+
+ result
+ end
+
+ render :json => { :image => @image,
+ :build => @build,
+ :account_groups => @account_groups,
+ :provider_images => provider_images,
+ :target_images_by_target => @target_images_by_target,
+ :active_builds => active_builds,
+ :active_pushes => active_pushes,
+ :failed_build_counts => failed_build_counts,
+ :failed_push_counts => failed_push_counts,
+ :latest_build_id => @latest_build }
+ end
+ end
end
def rebuild_all
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index 07e5014..21e391b 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -150,6 +150,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_profiles_and_validate
begin
populate_hardware_profiles
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index ffb9599..d16daac 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -87,3 +87,100 @@
$("#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)}
+ {{if failed_build_counts[driver] > 1}}
+ <div class="light">
+ #{t('images.show.failed_build_attemts', :count => '${failed_build_counts[driver]}' )}
+ </div>
+ {{else failed_build_counts[driver] == 1}}
+ <div class="light">
+ #{t('images.show.failed_build_attemts', :count => 1 )}
+ </div>
+ {{/if}}
+ {{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 light">
+ {{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')}
+ {{if failed_push_counts[account['id']] > 1}}
+ #{t('images.show.failed_push_attemts', :count => '${failed_push_counts[account[\'id\']]}' )}
+ {{else failed_push_counts[account['id']] == 1}}
+ #{t('images.show.failed_push_attemts', :count => 1 )}
+ {{/if}}
+ {{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 e9c0ca3..a3dd4a7 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..15ebf7c 100644
--- a/src/public/javascripts/backbone/models.js
+++ b/src/public/javascripts/backbone/models.js
@@ -45,3 +45,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..d2f0123 100644
--- a/src/public/javascripts/backbone/routers.js
+++ b/src/public/javascripts/backbone/routers.js
@@ -85,3 +85,22 @@ 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..ec558e9 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,24 @@ 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, 3 months