[PATCH conductor] BZ#743377 Show deployable status in the pretty view
by Tomas Sedovic
From: Tomas Sedovic <tomas(a)sedovic.cz>
https://bugzilla.redhat.com/show_bug.cgi?id=743377
The deployment cards on the Monitor page now display a graphical status (with a
textual fallback for text-only browsers) of the deployment.
This makes it easy for the user to determine the status of the deployments at a
glance. For more detailed information (e.g. the statuses of individual
instances), the user still needs to drill down into the deployment in question.
---
src/app/models/deployment.rb | 26 ++++++++----------
src/app/stylesheets/layout.scss | 31 ++++++++++++++++++++++
src/app/views/deployments/_list.html.haml | 4 +-
src/app/views/deployments/_pretty_view.html.haml | 2 +
src/app/views/pools/_deployments.html.haml | 3 ++
src/config/locales/en.yml | 4 +++
6 files changed, 54 insertions(+), 16 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 043b2b4..9593645 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -415,6 +415,16 @@ class Deployment < ActiveRecord::Base
end
end
+ def status
+ if instances.all? {|i| i.state == Instance::STATE_RUNNING}
+ :running
+ elsif instances.all? {|i| [Instance::STATE_STOPPED, Instance::STATE_ERROR, Instance::STATE_CREATE_FAILED].include? i.state}
+ :stopped
+ else
+ :pending
+ end
+ end
+
# A deployment "starts" when _all_ instances begin to run
def start_time
if instances.deployed.count == instances.count && ev = events.find_by_status_code(:all_running)
@@ -437,7 +447,8 @@ class Deployment < ActiveRecord::Base
def as_json(options={})
json = super(options).merge({
:deployable_xml_name => deployable_xml.name,
- :deployment_state => deployment_state,
+ :status => status,
+ :status_description => I18n.t("deployments.status.#{status}"),
:instances_count => instances.count,
:failed_instances_count => failed_instances.count,
:instances_count_text => I18n.t('instances.instances', :count => instances.count.to_i),
@@ -461,19 +472,6 @@ class Deployment < ActiveRecord::Base
json
end
- def deployment_state
- unless instances.empty?
- return instances.first.state if not instances.empty? and instances.length == 1
- oracle = instances.first.state
- instances.each do |i|
- return STATE_MIXED if i.state != oracle
- end
- return oracle
- else
- return
- end
- end
-
def failed_instances
instances.select {|instance| instance.failed?}
end
diff --git a/src/app/stylesheets/layout.scss b/src/app/stylesheets/layout.scss
index 9f385fe..dc51b67 100644
--- a/src/app/stylesheets/layout.scss
+++ b/src/app/stylesheets/layout.scss
@@ -2254,6 +2254,21 @@ ul.deployment-array.large{
}
+ .status {
+ text-indent: -3000px;
+ display: block;
+ background: url('../../images/build_status.png') no-repeat;
+ width: 18px;
+ height: 18px;
+ position: absolute;
+ bottom: 5px;
+ right: 5px;
+
+ &.stopped { background-position: 0px center; }
+ &.pending { background-position: -20px center; }
+ &.running { background-position: -40px center; }
+ }
+
dl.statistics{
margin-top: 8px;
ul{list-style: none; margin-left: 12px;}
@@ -2345,6 +2360,7 @@ ul.deployment-array.small{
height: 100%;
li.deployment{
+ position: relative;
display: table-cell;
float: left;
border: 1px solid #ccc;
@@ -2362,6 +2378,21 @@ ul.deployment-array.small{
margin-bottom: 14px;
}
+ .status {
+ text-indent: -3000px;
+ display: block;
+ background: url('../../images/build_status.png') no-repeat;
+ width: 18px;
+ height: 18px;
+ position: absolute;
+ bottom: 5px;
+ right: 5px;
+
+ &.stopped { background-position: 0px center; }
+ &.pending { background-position: -20px center; }
+ &.running { background-position: -40px center; }
+ }
+
dl.statistics{
ul{list-style: none;}
li{@include display_inline_block;}
diff --git a/src/app/views/deployments/_list.html.haml b/src/app/views/deployments/_list.html.haml
index 75b7f3d..bbf7b9b 100644
--- a/src/app/views/deployments/_list.html.haml
+++ b/src/app/views/deployments/_list.html.haml
@@ -35,7 +35,7 @@
%td= link_to(deployment.name, deployment_path(deployment, :view => :filter))
%td= deployment.created_at
%td= deployment.deployable_xml.name
- %td= deployment.deployment_state
+ %td= deployment.status
%td{:class => 'center'}= deployment.instances.count
%td= link_to deployment.pool.name, pool_path(deployment.pool, :view => :filter)
%td= owner_name(deployment)
@@ -59,7 +59,7 @@
<td><a href="#{deployment_path('replace_id', :view => :filter).sub('replace_id', '${id}')}">${name}</a></td>
<td>${created_at}</td>
<td>${deployable_xml_name}</td>
- <td>${deployment_state}</td>
+ <td>${status}</td>
<td class="center">${instances_count}</td>
<td><a href="#{pool_path('replace_id', :view => :filter).sub('replace_id', '${pool.id}')}">${pool.name}</a></td>
<td>${owner}</td>
diff --git a/src/app/views/deployments/_pretty_view.html.haml b/src/app/views/deployments/_pretty_view.html.haml
index 97c586e..f29e8d4 100644
--- a/src/app/views/deployments/_pretty_view.html.haml
+++ b/src/app/views/deployments/_pretty_view.html.haml
@@ -5,6 +5,7 @@
%li.deployment
%h3.name
= link_to deployment.name, deployment_path(deployment)
+ %span{ :class => "status #{deployment.status}", :title => deployment.as_json[:status_description]}
%dl.statistics
%ul
%li.uptime
@@ -32,6 +33,7 @@
<h3 class="name">
<a href="#{deployment_path('replace_id').sub('replace_id', '${id}')}">${name}</a>
</h3>
+ <span class="status ${status}" title="${status_description}">${status}</span>
<dl class="statistics">
<ul>
<li class="uptime">
diff --git a/src/app/views/pools/_deployments.html.haml b/src/app/views/pools/_deployments.html.haml
index 0aa6143..b4aed1d 100644
--- a/src/app/views/pools/_deployments.html.haml
+++ b/src/app/views/pools/_deployments.html.haml
@@ -5,6 +5,8 @@
%li.deployment
%h3.name
= link_to deployment.name, deployment_path(deployment)
+ %span{ :class => "status #{deployment.status}", :title => deployment.as_json[:status_description]}
+ = deployment.status
%dl.statistics
%ul
%li.right
@@ -21,6 +23,7 @@
<h3 class="name">
<a href="#{deployment_path('replace_id').sub('replace_id', '${id}')}">${name}</a>
</h3>
+ <span class="status ${status}" title="${status_description}">${status}</span>
<dl class="statistics">
<ul>
<li class="right">
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 822962d..a30fc28 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -174,6 +174,10 @@ en:
confirm_delete: "Are you sure you want to delete this deployment?"
list_of_events: List of deployment events
state: State
+ status:
+ running: All instances are running
+ pending: Some (but not all) instances are running
+ stopped: No instances are currently running
launch_time_params:
configure_launch_time_params: "Configure launch-time parameters for your deployment:"
finalize: Finalize
--
1.7.6.5
12 years, 3 months
[PATCH conductor] BZ 785094 - fixed cookie overflow and session store
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Because of wrong syntax in session_store initializer we used
CookieStore instead of ActiveRecordStore.
'session_store=' has been replaced with 'session_store' method in
Rails 3.
---
src/config/initializers/session_store.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/config/initializers/session_store.rb b/src/config/initializers/session_store.rb
index 7838811..8ff62fa 100644
--- a/src/config/initializers/session_store.rb
+++ b/src/config/initializers/session_store.rb
@@ -28,4 +28,4 @@ Conductor::Application.config.session = {
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
-Conductor::Application.config.session_store = :active_record_store
+Conductor::Application.config.session_store :active_record_store
--
1.7.7.5
12 years, 3 months
Aeolus on Fedora 17 / Ruby 1.9.3
by Mo Morsi
deltacloud is working as is and needs no further changes
imagefactory and iwhd need to be rebulit against the updated dependencies
imagefactory-console, aeolus-image, and conductor codebases need some tweaks and needs to be rebuilt against updated dependencies
the following needs to be udpated in rawhide for things to work properly:
rubygem-rails_warden - update to 0.5.6
rubygem-capybara - update to 1.1.2
rubygem-ruby-net-ldap / rubygem-factory_girl / rubygem-factory_girl_rails - updates slated to go in, just haven't been pushed yet
aeolus-conductor - to contain changes included in patchset
rubygem-aeolus-image - build against ruby 1.9, update to new standards
rubygem-imagefactory-console - build against ruby 1.9, update to new standards
Steps to get deltacloud up and running
1. startup a fresh F16 vm & yum update
2. install the ruby 1.9.3 repo, currently based on rawhide / F17 + updates to ruby related packages to work against 1.9.3. Create a file /etc/yum.repos.d/ruby.repo with the following:
[ruby]
name=ruby
baseurl=http://kojipkgs.fedoraproject.org/repos/f17-ruby/latest/x86_64/
enabled=0
gpgcheck=0
3. sudo yum remove groff # due to newly introduced conflicting package groff-base in rawhide
4. sudo yum install deltacloud-core --enablerepo=ruby
5. start / use deltacloud as normal: sudo deltacloudd -i mock ; navigrate to http://localhost:3001/api
Install dependencies to build other packages:
6. Prep the system for additional F17 changes as described here: http://fedoraproject.org/wiki/Upgrading_Fedora_using_yum#Fedora_16_-.3E_F...
7. sudo yum install --enablerepo=ruby git # to checkout sources
7. sudo yum install --enablerepo=ruby autoconf automake bison flex patch gperf gettext-devel gcc-c++ libcurl-devel jansson-devel libmicrohttpd-devel libuuid-deve1 liboauth-devell hail-devel libxml2-devel libgc-devel mongodb-devel help2man rpm-build mongodb-server # for iwhd
8. sudo yum install --enablerepo=ruby python-setuptools # for imagefactory
9. sudo yum install --enablerepo=ruby rubygem-rspec-core # for aeolus-image, imagefactory-console
10. sudo yum install --enablerepo=ruby rubygem-rspec-rails rubygem-factory_girl_rails rubygem-timecop rubygem-cucumber rubygem-database_cleaner # for conductor
Steps to get iwhd up and running:
12. git clone git://git.fedorahosted.org/iwhd.git && cd iwhd
12. At this point, I commented out the 'make -s check' in iwhd.spec.in as problems interfacing / launching mongodb caused error when running the test suite (this will need to be looked into)
13. ./autogen.sh
14. ./configure
15. make rpm
16. At this point, install and start iwhd:
sudo yum install --enablerepo=ruby --nogpgcheck ~/rpmbuild/RPMS/x86_64/iwhd-1.2.11.642c.dirty-1.fc16.x86_64.rpm
sudo service mongod start
sudo service iwhd start
Steps to get imagefactory up and running:
17. git clone git://github.com/aeolusproject/imagefactory && cd imagefactory
18. make rpm
19. You will need updated libguestfs and python-libguestfs installation (as required by libvirt as required by imagefactory) as these have been updated in rawhide to resolve various issues but have not hit the repos yet. You may d/l and install them from here:
http://mo.morsi.org/files/rpms/libguestfs-1.17.4-6.aeolus.fc16.x86_64.rpm
http://mo.morsi.org/files/rpms/python-libguestfs-1.17.4-6.aeolus.fc16.x86...
src: http://mo.morsi.org/files/rpms/libguestfs-1.17.4-6.aeolus.fc16.src.rpm
20. sudo yum install --enablerepo=ruby ~/rpmbuild/RPMS/noarch/imagefactory-1.0.0rc4-1.fc16.noarch.rpm
21. sudo service imagefactory start
Steps to rebuild imagefactory-console & aeolus-image
22. git clone git://github.com/aeolusproject/imagefactory-console
23. git am the respective patch in this thread
24 sudo rake rpms
25. sudo yum install --enablerepo=ruby --nogpgcheck ~/rpmbuild/RPMS/noarch/rubygem-imagefactory-console-...rpm
26. repeat the previous steps for git://github.com/aeolusproject/aeolus-image-rubygem
Steps to get conductor up and running:
27. git clone git://github.com/aeolusproject/conductor
28. git am conductor patch in this email thread
29. make rpms
30. You will need the rubygem-net-ldap dependency which replaces rubygem-ruby-net-ldap and has been approved for Fedora but has yet to be pushed. You may d/l and install it from here:
http://mo.morsi.org/files/rpms/rubygem-net-ldap-0.2.2-1.fc16.noarch.rpm / src: http://mo.morsi.org/files/rpms/rubygem-net-ldap-0.2.2-1.fc16.src.rpm
31. You will also need updated rubygem-rails_warden and rubygem-capybara rpms, which you may d/l and install from here:
http://mo.morsi.org/files/rpms/rubygem-rails_warden-0.5.6-1.fc16.noarch.rpm / src: http://mo.morsi.org/files/rpms/rubygem-rails_warden-0.5.6-1.fc16.src.rpm
http://mo.morsi.org/files/rpms/rubygem-capybara-1.1.2-1.fc16.noarch.rpm / src: http://mo.morsi.org/files/rpms/rubygem-capybara-1.1.2-1.fc16.src.rpm
32. sudo yum install --nogpgcheck --enablerepo=ruby <conductor rpms>
At this point I manually verified the app,
33. cd /usr/share/aeolus-conductor
34. sudo cp config/database.sqlite config/database.yml
35. sudo RAILS_ENV='production' rake db:create
36. sudo RAILS_ENV='production' rake db:migrate
37. sudo RAILS_ENV='production' rake db:seed
38. sudo RAILS_ENV='production' rake "dc:create_user[admin, password, root(a)localhost.localdomain, admin, istrator]"
39. sudo rake dc:oauth_keys
40. Create a /usr/share/aeolus-configure/config/initializers/secret_token.rb with the following contents:
Conductor::Application.config.secret_token = '<rails_token/>' # where rails_token is generated by running sudo rake dc:secret
41. Fix permissions on db file:
sudo chown -R aeolus.aeolus /usr/share/aeolus-configure/db
42. sudo setenforce 0
43. sudo service aeolus-conductor start
44. sudo service httpd start
45. verified I could log into conductor at http://localhost/conductor
Attached is the patchset required to get things working. It is based on the latest upstream HEAD. Things have been parameterized such that these patches should work in both the ruby 1.8 and 1.9 environments.
-Mo
12 years, 3 months
[PATCH conductor] BZ773034, BZ781482: Fix jQuery template on images#show
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
The build/push status has disappeared after backbone update and this patch is
intended to fix this.
Note, that the status in json response needs to capitalized by the controller because in
the jquery template no javascript function nor rails helper methods can be used.
https://bugzilla.redhat.com/show_bug.cgi?id=773034
https://bugzilla.redhat.com/show_bug.cgi?id=781482
---
src/app/controllers/images_controller.rb | 3 ++
src/app/views/images/show.html.haml | 54 +++++++++++++++--------------
2 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index f634bfa..41108c5 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -66,6 +66,8 @@ class ImagesController < ApplicationController
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[driver].attributes['status'].capitalize! if result[driver]
+
result
end
@@ -73,6 +75,7 @@ class ImagesController < ApplicationController
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'])
+ result[account.id].attributes['status'].capitalize! if result[account.id]
end if timg.present?
result
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index c83fc6a..e26a720 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -101,32 +101,34 @@
<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_attempts', :count => '${failed_build_counts[driver]}')}
- </div>
- {{else failed_build_counts[driver] == 1}}
- <div class="light">
- #{t('images.show.failed_build_attempts', :count => 1 )}
- </div>
+ <div class="build-actions">
+ <h3>${groups['type']['name']}</h3>
+ {{if build && active_builds[driver]}}
+ <label>${active_builds[driver]['builder']['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_attempts', :count => '${failed_build_counts[driver]}')}
+ </div>
+ {{else failed_build_counts[driver] == 1}}
+ <div class="light">
+ #{t('images.show.failed_build_attempts', :count => 1 )}
+ </div>
+ {{/if}}
+ {{else}}
+
{{/if}}
- {{else}}
-
- {{/if}}
+ </div>
</dt>
<dd>
<table class="light_table">
@@ -168,7 +170,7 @@
</td>
<td class="image_controls light">
{{if target_images_by_target[driver] && active_pushes[account['id']]}}
- <label>${active_pushes[account['id']]['status']}</label>
+ <label>${active_pushes[account['id']]['builder']['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\']}')
--
1.7.6.5
12 years, 3 months
[PATCH conductor] BZ 788018 Destroy deployables when deleting its last catalog
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
When a Catalog is deleted, all deployables related only to it are destroyed too.
---
src/app/models/catalog.rb | 8 ++++----
src/config/locales/en.yml | 2 +-
src/spec/controllers/catalogs_controller_spec.rb | 13 ++++++-------
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/app/models/catalog.rb b/src/app/models/catalog.rb
index 00d1e7a..3472c59 100644
--- a/src/app/models/catalog.rb
+++ b/src/app/models/catalog.rb
@@ -38,7 +38,7 @@ class Catalog < ActiveRecord::Base
:include => [:role],
:order => "permissions.id ASC"
- before_destroy :check_deployable_references
+ before_destroy :destroy_deployables_related_only_to_self
validates_presence_of :pool
validates_presence_of :name
@@ -48,9 +48,9 @@ class Catalog < ActiveRecord::Base
PRESET_FILTERS_OPTIONS = [
{:title => I18n.t("catalogs.preset_filters.belongs_to_default_pool"), :id => "belongs_to_default_pool", :query => includes(:pool).where("pools.name" => "Default")}
]
- def check_deployable_references
- return true if deployables.empty?
- !(deployables.any? {|d| d.catalogs.count == 1})
+
+ def destroy_deployables_related_only_to_self
+ deployables.each {|d| d.destroy if d.catalogs.count == 1}
end
private
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 048047b..971f0f8 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -411,7 +411,7 @@ en:
owner: Owner
pending: Pending
failed: Failed
- confirm_delete: "Are you sure you want to delete this pool?"
+ confirm_delete: "Are you sure you want to delete this pool? All related catalogs and deployables will be deleted too!"
overview: Overview
your_pools: Your Pools
pool_details: Pool details
diff --git a/src/spec/controllers/catalogs_controller_spec.rb b/src/spec/controllers/catalogs_controller_spec.rb
index 50a53bf..8e46aaf 100644
--- a/src/spec/controllers/catalogs_controller_spec.rb
+++ b/src/spec/controllers/catalogs_controller_spec.rb
@@ -33,10 +33,9 @@ describe CatalogsController do
response.should redirect_to catalogs_path
end
- it "cannot remove catalog2 because it is the last deployable's reference " do
- delete :destroy, :id => @catalog.id
- expect {delete :destroy, :id => @catalog2.id}.not_to change(Catalog, :count).by(-1)
- response.should redirect_to catalog_path(@catalog2)
+ it "cannot remove deployable related to catalog because it is also related to catalog2" do
+ expect {delete :destroy, :id => @catalog.id}.not_to change(Deployable, :count).by(-1)
+ response.should redirect_to catalogs_path
end
context "given catalog with one deployable, that is exclusive in this catalog" do
@@ -44,9 +43,9 @@ describe CatalogsController do
@catalog = Factory :catalog_with_deployable
end
- it "cannot be deleted when its deployables has no reference to other catalogs" do
- expect {delete :destroy, :id => @catalog.id}.not_to change(Catalog, :count).by(-1)
- response.should redirect_to catalog_path(@catalog)
+ it "should delete its deployables if its deployables have no reference to other catalogs" do
+ expect {delete :destroy, :id => @catalog.id}.to change(Deployable, :count).by(-1)
+ response.should redirect_to catalogs_path
end
end
end
--
1.7.7.6
12 years, 3 months
[PATCH conductor 0/1] #788117 - Invalid message is displayed on login
by Matt Wagner
Hi all,
This patch fixes an issue where, if you logged out and then back in, you would be taken to a page with an error that you had to be logged out to access the page.
What was happening, as I discovered, is that the login page ("/login") was setting *itself* as session[:return_to] in that case, so, upon logging in, we redirected the user to /login. As I started to special-case this, I realized that ApplicationController's "require_user" method already does what we want (by way of store_location), and in a manner that isn't prone to this error. So the fix was just to delete the line that set this in UserSessionsController#new.
When testing, please be sure to check for at least the following:
1.) It fixes #788117 -- you can log in, log out, and log in again without receiving the error message in that BZ.
2.) It does not re-introduce #782242. You should still be able to be logged out, attempt access a page that requires that the user be logged in, get redirected to the login page, and, upon successful login, get redirected to the page you tried to access.
-- Matt
12 years, 3 months
Audrey RFC: Non-editable "launch-time" parameters
by Tomas Sedovic
Hello there,
I came across this bug/RFE:
https://bugzilla.redhat.com/show_bug.cgi?id=751037
They want us to add another parameter type to the deployable definition.
The parameter would have a fixed value that could not be changed via the
UI. Other than that, it would behave like any other param: it could be
referenced by other services, config server would be aware of it, agents
could request it, etc.
It is possible to get the same behaviour by taking advantage of the
scripts that the Audrey agent downloads and runs -- any static
configuration may be entered there.
I see two possible scenarios where the requested feature may still be
useful:
1. All deployment configuration is in one place
Having to maintain the configuration in two places (the scripts for
the fixed stuff, deployable XML with launch-time params for variables)
may cause hassle.
2. Inter-service dependencies
Imagine we have a common set of assemblies or configuration scripts
that are reused across multiple deployments. Then a service depending
on, say, an IP address of sorts, may be used in a deployable that sets
it at launch-time and in another deployable that requires a fixed value.
In this case, the value should probably be set via the deployable XML
so that the in-guest agent can request the value from the config server
regardless of how it was set (launch-time or fixed).
I can see how this feature would be useful in situations above, but I
have no idea how common this would be in a real use.
The change doesn't seem too complicated, but it would affect both Audrey
and Conductor and as far as I can tell, you can work around not having
it. Thus, I'm hesitant to move forward with this unless actually it is
of value to our users.
What do you all think?
Thomas
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.
12 years, 3 months
[PATCH conductor] BZ 783378 - log reboot (and other) instance action
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
- instance event with message 'action queued' is now created
on any instance action
- event time is now displayed in the list of instance events
---
src/app/controllers/instances_controller.rb | 2 ++
src/app/models/instance.rb | 14 +++++++++-----
src/app/views/instances/_history.html.haml | 2 +-
src/spec/models/instance_spec.rb | 9 +++++++++
4 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index 96bc2fe..08ce4f5 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -188,6 +188,8 @@ class InstancesController < ApplicationController
notices << "#{instance.name}: #{t('instances.flash.notice.reboot', :name => instance.name)}"
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:
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 68ed3bb..5ecfa3f 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -217,11 +217,15 @@ class Instance < ActiveRecord::Base
def queue_action(user, action, data = nil)
return false unless get_action_list.include?(action)
- task = InstanceTask.new({ :user => user,
- :task_target => self,
- :action => action,
- :args => data})
- task.save!
+ task = InstanceTask.create!({ :user => user,
+ :task_target => self,
+ :action => action,
+ :args => data})
+
+ event = Event.create!(:source => self, :event_time => Time.now,
+ :summary => "#{action} action queued",
+ :status_code => "#{action}_queued")
+
return task
end
diff --git a/src/app/views/instances/_history.html.haml b/src/app/views/instances/_history.html.haml
index ee461e6..60f09e5 100644
--- a/src/app/views/instances/_history.html.haml
+++ b/src/app/views/instances/_history.html.haml
@@ -5,6 +5,6 @@
%ol
- @events.each do |event|
%li
- = event.summary
+ = "#{event.event_time.strftime('%d-%b-%Y %H:%M:%S')}: #{event.summary}"
= will_paginate @events
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb
index d712411..66b1365 100644
--- a/src/spec/models/instance_spec.rb
+++ b/src/spec/models/instance_spec.rb
@@ -92,6 +92,15 @@ describe Instance do
valid_task.should_not == false
end
+ it "should create new event when an action is queued" do
+ @instance.save!
+ @instance.stub!(:get_action_list).and_return(@actions)
+ user = User.new
+ @instance.queue_action(user, 'stop')
+ @instance.events.should_not be_empty
+ @instance.events.last.status_code.should == 'stop_queued'
+ end
+
describe "with time capsule" do
it "should properly calculate the total time that the instance has been in a monitored state" do
--
1.7.7.5
12 years, 3 months
[PATCH conductor] BZ 788018 Destroy deployables when deleting its last catalog
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
When a Catalog is deleted, all deployables related only to it are destroyed too.
---
src/app/models/catalog.rb | 13 +++++++++----
src/config/locales/en.yml | 2 +-
src/spec/controllers/catalogs_controller_spec.rb | 22 +++++++++++++++-------
3 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/src/app/models/catalog.rb b/src/app/models/catalog.rb
index 00d1e7a..2cfc163 100644
--- a/src/app/models/catalog.rb
+++ b/src/app/models/catalog.rb
@@ -38,7 +38,8 @@ class Catalog < ActiveRecord::Base
:include => [:role],
:order => "permissions.id ASC"
- before_destroy :check_deployable_references
+ #before_destroy :check_deployable_references
+ before_destroy :destroy_deployables_related_only_to_self
validates_presence_of :pool
validates_presence_of :name
@@ -48,9 +49,13 @@ class Catalog < ActiveRecord::Base
PRESET_FILTERS_OPTIONS = [
{:title => I18n.t("catalogs.preset_filters.belongs_to_default_pool"), :id => "belongs_to_default_pool", :query => includes(:pool).where("pools.name" => "Default")}
]
- def check_deployable_references
- return true if deployables.empty?
- !(deployables.any? {|d| d.catalogs.count == 1})
+ #def check_deployable_references
+ # return true if deployables.empty?
+ # !(deployables.any? {|d| d.catalogs.count == 1})
+ #end
+
+ def destroy_deployables_related_only_to_self
+ deployables.each {|d| d.destroy if d.catalogs.count == 1}
end
private
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 048047b..971f0f8 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -411,7 +411,7 @@ en:
owner: Owner
pending: Pending
failed: Failed
- confirm_delete: "Are you sure you want to delete this pool?"
+ confirm_delete: "Are you sure you want to delete this pool? All related catalogs and deployables will be deleted too!"
overview: Overview
your_pools: Your Pools
pool_details: Pool details
diff --git a/src/spec/controllers/catalogs_controller_spec.rb b/src/spec/controllers/catalogs_controller_spec.rb
index 50a53bf..3ccb252 100644
--- a/src/spec/controllers/catalogs_controller_spec.rb
+++ b/src/spec/controllers/catalogs_controller_spec.rb
@@ -33,21 +33,29 @@ describe CatalogsController do
response.should redirect_to catalogs_path
end
- it "cannot remove catalog2 because it is the last deployable's reference " do
- delete :destroy, :id => @catalog.id
- expect {delete :destroy, :id => @catalog2.id}.not_to change(Catalog, :count).by(-1)
- response.should redirect_to catalog_path(@catalog2)
+ it "cannot remove deployable related to catalog because it is also related to catalog2" do
+ expect {delete :destroy, :id => @catalog.id}.not_to change(Deployable, :count).by(-1)
+ response.should redirect_to catalogs_path
end
+ #it "cannot remove catalog2 because it is the last deployable's reference " do
+ # delete :destroy, :id => @catalog.id
+ # expect {delete :destroy, :id => @catalog2.id}.not_to change(catalog, :count).by(-1)
+ # response.should redirect_to catalog_path(@catalog2)
+ #end
context "given catalog with one deployable, that is exclusive in this catalog" do
before(:each) do
@catalog = Factory :catalog_with_deployable
end
- it "cannot be deleted when its deployables has no reference to other catalogs" do
- expect {delete :destroy, :id => @catalog.id}.not_to change(Catalog, :count).by(-1)
- response.should redirect_to catalog_path(@catalog)
+ it "should delete its deployables if its deployables have no reference to other catalogs" do
+ expect {delete :destroy, :id => @catalog.id}.to change(Deployable, :count).by(-1)
+ response.should redirect_to catalogs_path
end
+ #it "cannot be deleted when its deployables has no reference to other catalogs" do
+ # expect {delete :destroy, :id => @catalog.id}.not_to change(Catalog, :count).by(-1)
+ # response.should redirect_to catalog_path(@catalog)
+ #end
end
end
--
1.7.7.6
12 years, 3 months