Details on pushing to ec2 with current codebase
by Jason Guiditta
This needs to be documented somewhere, but as I don't know where yet, I
will start with the list. For current version of Conductor, the name you
set for your provider matters. In practice right now, this only applies
to EC2, but you need to choose a provider name from the list here:
https://github.com/aeolusproject/image_factory/blob/master/imagefactory/b...
This also assumes you have an instance of core pointing at the correct
ec2 endpoint. Mock provider should just be called 'mock'. We will make
this more flexible/usable in an upcoming rev, but this is how it has to
work for the time being until a few more things are sorted.
-j
12 years, 6 months
[PATCH conductor 1/2] Fix BZ 674564
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=674564
The Administrator user was able to delete its own account. This could lock
everyone up (if this was the only admin).
---
src/app/controllers/admin/users_controller.rb | 14 +++++++++++++-
src/features/step_definitions/user_steps.rb | 7 ++++++-
src/features/user.feature | 16 +++++++++++++++-
src/spec/factories/user.rb | 1 +
4 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/admin/users_controller.rb b/src/app/controllers/admin/users_controller.rb
index 6134cd3..d0297ad 100644
--- a/src/app/controllers/admin/users_controller.rb
+++ b/src/app/controllers/admin/users_controller.rb
@@ -90,7 +90,19 @@ class Admin::UsersController < ApplicationController
def multi_destroy
require_privilege(Privilege::MODIFY, User)
- User.destroy(params[:user_selected])
+ deleted_users = []
+ User.find(params[:user_selected]).each do |user|
+ if user == current_user
+ flash[:warning] = "Cannot delete #{user.login}: you are logged in as this user"
+ else
+ user.destroy
+ deleted_users << user.login
+ end
+ end
+ unless deleted_users.empty?
+ msg = "Deleted user#{'s' if deleted_users.length > 1}"
+ flash[:notice] = "#{msg}: #{deleted_users.join(', ')}"
+ end
redirect_to admin_users_url
end
diff --git a/src/features/step_definitions/user_steps.rb b/src/features/step_definitions/user_steps.rb
index 13932fa..c82566f 100644
--- a/src/features/step_definitions/user_steps.rb
+++ b/src/features/step_definitions/user_steps.rb
@@ -8,6 +8,11 @@ Given /^there are (\d+) users$/ do |number|
User.count.should == number.to_i
end
-Then /^there should only be (\d+) users$/ do |number|
+Then /^there should be (\d+) users?$/ do |number|
User.count.should == number.to_i
end
+
+When /^(?:|I )check "([^"]*)" user$/ do |user_name|
+ user = User.find_by_login(user_name)
+ check("user_checkbox_#{user.id}")
+end
diff --git a/src/features/user.feature b/src/features/user.feature
index 34559c7..b073436 100644
--- a/src/features/user.feature
+++ b/src/features/user.feature
@@ -39,9 +39,23 @@ Feature: Manage Users
When I follow "create"
Then I should be on the new admin user page
When I follow "cancel"
- Then there should only be 2 users
+ Then there should be 2 users
And I should be on the admin users page
+ Scenario: Delete users
+ Given there is a user "testuser"
+ And I am on the admin users page
+ Then there should be 2 users
+ When I check "admin" user
+ And I press "Delete"
+ Then I should see "Cannot delete admin"
+ And there should be 2 users
+ And I should be on the admin users page
+ When I check "testuser" user
+ And I press "Delete"
+ Then I should see "Deleted user"
+ And there should be 1 user
+
Scenario: Search for hardware profiles
Given there is a user "myuser"
And there is a user "someuser"
diff --git a/src/spec/factories/user.rb b/src/spec/factories/user.rb
index 21eae00..3783284 100644
--- a/src/spec/factories/user.rb
+++ b/src/spec/factories/user.rb
@@ -17,6 +17,7 @@ Factory.define :tuser, :parent => :user do |u|
end
Factory.define :admin_user, :parent => :user do |u|
+ u.login 'admin'
end
Factory.define :pool_creator_user, :parent => :user do |u|
--
1.7.4
12 years, 6 months
Platform name fix
by Jan Provazník
This is really tiny one-line change. Platform name instead of platform id should
be displayed in image builds view. No e2e test needed, just check that 'Fedora
13' is displayed (instead of 'fedora13 13'.
12 years, 6 months
[PATCH configure] add script to restart all aeolus services
by Mo Morsi
---
bin/aeolus-services | 18 ++++++++++++-
contrib/aeolus-configure.spec | 2 +
recipes/aeolus_recipe/aeolus_stop_services.pp | 32 -------------------------
3 files changed, 18 insertions(+), 34 deletions(-)
delete mode 100644 recipes/aeolus_recipe/aeolus_stop_services.pp
diff --git a/bin/aeolus-services b/bin/aeolus-services
index 72cd2bb..de71244 100644
--- a/bin/aeolus-services
+++ b/bin/aeolus-services
@@ -1,4 +1,18 @@
#!/bin/sh
-puppet /usr/share/aeolus-configure/aeolus_stop_services.pp \
- --modulepath=/usr/share/aeolus-configure/modules/
+#dependency_services=( 'mongod', 'qpidd', 'libvirtd', 'condor', 'solr', 'sshd', 'httpd' )
+
+services=( 'iwhd' 'imagefactory' 'aeolus-conductor' 'aeolus-connector' 'conductor-condor_refreshd' 'conductor-dbomatic')
+
+core_instances=( 'mock' 'ec2-us-east-1' 'ec2-us-west-1' )
+
+for instance in "${core_instances[@]}"
+do
+ services=( ${services[@]-} $(echo "deltacloud-$instance") )
+done
+
+
+for service in "${services[@]}"
+do
+ service $service restart
+done
diff --git a/contrib/aeolus-configure.spec b/contrib/aeolus-configure.spec
index c973f57..931ef73 100644
--- a/contrib/aeolus-configure.spec
+++ b/contrib/aeolus-configure.spec
@@ -40,6 +40,7 @@ rm -rf %{buildroot}
%{__cp} -R %{pbuild}/recipes/postgres/ %{buildroot}/%{dchome}/modules/postgres
%{__cp} -R %{pbuild}/bin/aeolus-configure %{buildroot}/%{_sbindir}/
%{__cp} -R %{pbuild}/bin/aeolus-cleanup %{buildroot}/%{_sbindir}/
+%{__cp} -R %{pbuild}/bin/aeolus-services %{buildroot}/%{_sbindir}/
%clean
rm -rf %{buildroot}
@@ -48,6 +49,7 @@ rm -rf %{buildroot}
%defattr(-,root,root,-)
%attr(0755, root, root) %{_sbindir}/aeolus-configure
%attr(0755, root, root) %{_sbindir}/aeolus-cleanup
+%attr(0755, root, root) %{_sbindir}/aeolus-services
%{dchome}
%changelog
diff --git a/recipes/aeolus_recipe/aeolus_stop_services.pp b/recipes/aeolus_recipe/aeolus_stop_services.pp
deleted file mode 100644
index 6d9993e..0000000
--- a/recipes/aeolus_recipe/aeolus_stop_services.pp
+++ /dev/null
@@ -1,32 +0,0 @@
-#--
-# Copyright (C) 2010 Red Hat Inc.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Author: Mohammed Morsi <mmorsi(a)redhat.com>
-#--
-
-#
-# aeolus uninstallation recipe
-#
-
-# Modules used by the recipe
-import "aeolus_recipe/aeolus"
-
-$services = ["conductor", "core", 'iwhd', 'image-factory']
-
-# stop aeolus services
-dc::service{$services:
- ensure => 'stopped', enable => false}
--
1.7.2.3
12 years, 6 months
[PATCH configure 2/2] revert patch adding a delay to run after starting up conductor
by Mo Morsi
---
recipes/aeolus_recipe/manifests/conductor.pp | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/recipes/aeolus_recipe/manifests/conductor.pp b/recipes/aeolus_recipe/manifests/conductor.pp
index e7a20f5..fe9d124 100644
--- a/recipes/aeolus_recipe/manifests/conductor.pp
+++ b/recipes/aeolus_recipe/manifests/conductor.pp
@@ -51,13 +51,6 @@ class aeolus::conductor inherits aeolus {
Rails::Migrate::Db[migrate_aeolus_database],
Service['condor', 'httpd']] }
- # XXX ugly hack but iwhd might take some time to come up
- exec{"conductor_startup":
- command => "/bin/sleep 2",
- unless => '/usr/bin/curl http://localhost/conductor',
- logoutput => true,
- require => Service['aeolus-conductor']}
-
service{ 'aeolus-connector':
ensure => 'running',
enable => true,
@@ -276,7 +269,7 @@ define aeolus::conductor::login($user,$password){
-d commit=submit \
-c /tmp/aeolus-${user}.cookie",
onlyif => "/usr/bin/test ! -f /tmp/aeolus-${user}.cookie || \"\" == \"`curl -X GET http://localhost/conductor -b /tmp/aeolus-${user}.cookie -i --silent | grep 'HTTP/1.1 200'`\"",
- require => Exec['conductor_startup']}
+ require => Service['aeolus-conductor']}
}
define aeolus::conductor::logout($user){
--
1.7.2.3
12 years, 6 months
Console Reconnect
by Jason Guiditta
[PATCH conductor] Redmine #752: Reconnect console if no qpid broker found.
This fixes the apparent error in connector log to the effect of:
warning Connect failed: Connection refused
warning Connection closed
<stacktrace>
This is not actually an error in connector, but a missing connect option
in the console. The way to test this is to stop qpidd service, then try
to start connector service. Watch the connector log for the above error.
Assuming you verified the error, apply patch, rebuild console and install
gem or rpm (I do gem, since I can force it to install over the old one).
Leaving qpidd stopped, attempt to start the connector again. Note that you
may do this manually w/o the service using:
./image_factory_connector -p 2003 start
Which will give you the output in STDOUT. You should now see the log above
minus the stacktrace. Let it try a few times, then start the qpidd service
in another window. After a few seconds, the connector should give some more
output showing it has connected, something like this:
$ ./image_factory_connector -p 2003 start
2011-03-23 15:17:06 warning Connect failed: Connection refused
2011-03-23 15:17:06 warning Connection closed
2011-03-23 15:17:09 warning Connect failed: Connection refused
2011-03-23 15:17:09 warning Connection closed
2011-03-23 15:17:15 warning Connect failed: Connection refused
2011-03-23 15:17:15 warning Connection closed
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:2003, CTRL+C to stop
12 years, 6 months
[PATCH configure] only stop specified core instance in init script
by Mo Morsi
---
recipes/aeolus_recipe/templates/deltacloud-core | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/recipes/aeolus_recipe/templates/deltacloud-core b/recipes/aeolus_recipe/templates/deltacloud-core
index 15a6b03..f5c8826 100644
--- a/recipes/aeolus_recipe/templates/deltacloud-core
+++ b/recipes/aeolus_recipe/templates/deltacloud-core
@@ -15,6 +15,7 @@ DRIVER="${DRIVER:-<%= provider_type %>}"
PORT="${PORT:-<%= port %>}"
LOCKFILE="${LOCKFILE:-/var/lock/subsys/deltacloud-$DRIVER }"
LOGFILE="${LOGFILE:-/var/log/deltacloud-<%= name %>/$DRIVER.log}"
+PIDFILE="${THIN_PID:-/var/run/deltacloud-<%= name %>.pid}"
export DELTACLOUD_MOCK_STORAGE=/usr/lib/ruby/gems/1.8/gems/deltacloud-<%= name %>-0.2.0/lib/deltacloud/drivers/mock/data/
PROG=/usr/bin/deltacloudd
@@ -26,6 +27,7 @@ start() {
$PROG -i $DRIVER -e $ENV -p $PORT >> $LOGFILE 2>&1 &
RETVAL=$?
+ echo $! > $PIDFILE
if [ $RETVAL -eq 0 ] && touch $LOCKFILE ; then
echo_success
echo
@@ -40,7 +42,7 @@ stop() {
RETVAL=$?
# FIXME! we need to do a killproc -p <pidfile> here to ensure other deltacloud
# daemons are not killed as well
- killall deltacloudd
+ killproc -p $PIDFILE deltacloudd
if [ $RETVAL -eq 0 ] && rm -f $LOCKFILE ; then
echo_success
echo
--
1.7.2.3
12 years, 6 months
[PATCH conductor] Added multiple platform support
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Don't forget to run "rake dc:prepare_repos"
---
src/app/models/template.rb | 15 ++++++++++-----
src/app/util/image_descriptor_xml.rb | 10 +++++++---
src/app/views/image_factory/templates/_list.haml | 2 +-
.../image_descriptor_package_repositories.yml | 15 +++++++++++----
.../image_descriptor_platform_repositories.yml | 7 ++++++-
src/features/api.feature | 1 +
src/features/instance.feature | 1 +
src/features/provider.feature | 1 +
src/features/provider_account.feature | 1 +
src/features/template.feature | 20 ++++++++++----------
src/spec/factories/template.rb | 2 +-
src/spec/fixtures/repositories.json | 4 ++--
src/spec/utils/repository_manager_spec.rb | 2 +-
13 files changed, 53 insertions(+), 28 deletions(-)
diff --git a/src/app/models/template.rb b/src/app/models/template.rb
index 1b09dae..6784354 100644
--- a/src/app/models/template.rb
+++ b/src/app/models/template.rb
@@ -67,11 +67,12 @@ class Template < ActiveRecord::Base
def update_xml
xml.name = self.name
xml.description = self.summary
- platform = {}
- platform['name'] = self.platform.capitalize
- platform['version'] = self.platform_version
- platform['arch'] = self.architecture
- xml.platform = platform
+ xml.platform = {
+ 'id' => self.platform,
+ 'name' => platforms[self.platform] ? platforms[self.platform]['name'] : '',
+ 'version' => self.platform_version,
+ 'arch' => self.architecture,
+ }
write_attribute(:xml, xml.to_xml)
end
@@ -125,6 +126,10 @@ class Template < ActiveRecord::Base
self.architecture = platforms[plat]['architecture']
end
+ def platform_name
+ platforms[self.platform] ? platforms[self.platform]['name'] : ''
+ end
+
# sets platform info from hash (used when importing images)
def platform_hash=(plat)
write_attribute(:platform, plat[:platform])
diff --git a/src/app/util/image_descriptor_xml.rb b/src/app/util/image_descriptor_xml.rb
index 02634b2..c1c7724 100644
--- a/src/app/util/image_descriptor_xml.rb
+++ b/src/app/util/image_descriptor_xml.rb
@@ -63,6 +63,7 @@ class ImageDescriptorXML
#recreate_repo_nodes
platform_node = get_or_create_node('os')
platform_node.xpath('.//*').remove
+ platform_id = platform_hash.delete('id')
platform_hash.each do |key, value|
snode = Nokogiri::XML::Node.new(key, @doc)
platform_node << snode
@@ -72,9 +73,12 @@ class ImageDescriptorXML
install_node.set_attribute('type', 'url')
platform_node << install_node
url_node = Nokogiri::XML::Node.new('url', @doc)
- # TODO: change when more than one os is supported by conductor
- # url_node.content = "http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora/x86..."
- url_node.content = YAML.load_file("#{RAILS_ROOT}/config/image_descriptor_package_repositories.yml")['baseurl']
+ # TODO - currently we have platform repositories and package repositories,
+ # mainly because it was possible to have multiple package repositories for
+ # a platform before. Also platform url wasn't needed for old imagefactory.
+ # Should be reworked when we switch to pulp
+ rep = repository_manager.repositories.find {|r| r.id == platform_id}
+ url_node.content = rep.yumurl if rep
install_node << url_node
end
diff --git a/src/app/views/image_factory/templates/_list.haml b/src/app/views/image_factory/templates/_list.haml
index 6cec40b..bf8be82 100644
--- a/src/app/views/image_factory/templates/_list.haml
+++ b/src/app/views/image_factory/templates/_list.haml
@@ -15,7 +15,7 @@
= check_box_tag 'selected[]', template.id, @url_params[:select] == 'all', :id => "selected_#{template.id}"
= image_tag "blnk.png", :alt => template.platform, :class => "icon platform #{template.platform}"
= link_to template.name, image_factory_template_path(template)
- %td= template.platform
+ %td= template.platform_name
%td= template.platform_version
%td= image_tag 'blnk.png', :alt => 'yes', :class => "icon yes"
%td= template.architecture
diff --git a/src/config/image_descriptor_package_repositories.yml b/src/config/image_descriptor_package_repositories.yml
index 12a15d1..fd1a747 100644
--- a/src/config/image_descriptor_package_repositories.yml
+++ b/src/config/image_descriptor_package_repositories.yml
@@ -1,7 +1,14 @@
-id: fedora
-name: Fedora
-baseurl: http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora/x86...
-type: xml
+-
+ id: fedora13
+ name: Fedora
+ baseurl: http://download.fedoraproject.org/pub/fedora/linux/releases/13/Fedora/x86...
+ type: xml
+
+-
+ id: fedora14
+ name: Fedora
+ baseurl: http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fedora/x86...
+ type: xml
# you can define multiple repositories, as array, for example:
#
diff --git a/src/config/image_descriptor_platform_repositories.yml b/src/config/image_descriptor_platform_repositories.yml
index d16d0c0..b43c115 100644
--- a/src/config/image_descriptor_platform_repositories.yml
+++ b/src/config/image_descriptor_platform_repositories.yml
@@ -1,4 +1,9 @@
-fedora:
+fedora13:
name: Fedora
version: 13
architecture: x86_64
+
+fedora14:
+ name: Fedora
+ version: 14
+ architecture: x86_64
diff --git a/src/features/api.feature b/src/features/api.feature
index 4ff624a..4651b8f 100644
--- a/src/features/api.feature
+++ b/src/features/api.feature
@@ -6,6 +6,7 @@ Feature: User authentication
Background:
Given I am an authorised user
And I am logged in
+ And There is a mock pulp repository
Scenario: Check can start instance
Given there is a user "testuser"
diff --git a/src/features/instance.feature b/src/features/instance.feature
index ed08fb4..19b80bd 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -7,6 +7,7 @@ Feature: Mange Instances
Background:
Given I am an authorised user
And I am logged in
+ And There is a mock pulp repository
Scenario: Download an Instance Key
Given a mock running instance exists
diff --git a/src/features/provider.feature b/src/features/provider.feature
index 34ab613..e7b186f 100644
--- a/src/features/provider.feature
+++ b/src/features/provider.feature
@@ -6,6 +6,7 @@ Feature: Manage Providers
Background:
Given I am an authorised user
And I am logged in
+ And There is a mock pulp repository
Scenario: List providers
Given I am on the homepage
diff --git a/src/features/provider_account.feature b/src/features/provider_account.feature
index b4ce54a..6a06d32 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -6,6 +6,7 @@ Feature: Manage Provider Accounts
Background:
Given I am an authorised user
And I am logged in
+ And There is a mock pulp repository
Scenario: List provider accounts
Given I am on the homepage
diff --git a/src/features/template.feature b/src/features/template.feature
index a59d7cd..acdf337 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -14,7 +14,7 @@ Feature: Manage Templates
Then I should be on the new image factory template page
When I fill in the following:
| tpl_name | mocktemplate |
- | tpl_platform | fedora |
+ | tpl_platform | fedora13 |
| tpl_summary | mockdesc |
When I press "Save"
Then I should be on the image factory templates page
@@ -177,15 +177,15 @@ Feature: Manage Templates
Scenario: Search for templates
Given there are these templates:
| name | platform | platform_version | architecture | summary |
- | Test1 | fedora | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
- | Mock | fedora | 14 | i386 | Test Template Fedora 14 Description |
- | Other | fedora | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
+ | Test1 | fedora13 | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
+ | Mock | fedora14 | 14 | i386 | Test Template Fedora 14 Description |
+ | Other | fedora14 | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
And I am on the image factory templates page
Then I should see the following:
| NAME | OS | VERSION | ARCH |
- | Test1 | fedora | 13 | x86_64 |
- | Mock | fedora | 14 | i386 |
- | Other | fedora | 10.04 | i386 |
+ | Test1 | Fedora | 13 | x86_64 |
+ | Mock | Fedora | 14 | i386 |
+ | Other | Fedora | 10.04 | i386 |
When I fill in "q" with "test"
And I press "Search"
Then I should see "Test1"
@@ -220,9 +220,9 @@ Feature: Manage Templates
Scenario: Delete multiple templates
Given there are these templates:
| name | platform | platform_version | architecture | summary |
- | Test1 | fedora | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
- | Mock | fedora | 14 | i386 | Test Template Fedora 14 Description |
- | Other | fedora | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
+ | Test1 | fedora13 | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
+ | Mock | fedora13 | 14 | i386 | Test Template Fedora 14 Description |
+ | Other | fedora13 | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
And I am on the image factory templates page
When I check "Test1" template
And I check "Mock" template
diff --git a/src/spec/factories/template.rb b/src/spec/factories/template.rb
index 1bb6fa6..9640cbc 100644
--- a/src/spec/factories/template.rb
+++ b/src/spec/factories/template.rb
@@ -1,6 +1,6 @@
Factory.define :template do |i|
i.sequence(:name) { |n| "template#{n}" }
- i.platform 'fedora'
+ i.platform 'fedora13'
i.after_build do |tpl|
if tpl.respond_to?(:stub!)
tpl.stub!(:upload).and_return(true)
diff --git a/src/spec/fixtures/repositories.json b/src/spec/fixtures/repositories.json
index 4f9a6c8..732cb77 100644
--- a/src/spec/fixtures/repositories.json
+++ b/src/spec/fixtures/repositories.json
@@ -1,7 +1,7 @@
-[ { "_id" : "fedora",
+[ { "_id" : "fedora13",
"arch" : "x86_64",
"errata" : "/repositories/fedora/errata/",
- "id" : "fedora",
+ "id" : "fedora13",
"name" : "fedora",
"packagegroupcategories" : "/repositories/fedora/packagegroupcategories/",
"packagegroups" : "/repositories/fedora/packagegroups/",
diff --git a/src/spec/utils/repository_manager_spec.rb b/src/spec/utils/repository_manager_spec.rb
index 53ce840..7876254 100644
--- a/src/spec/utils/repository_manager_spec.rb
+++ b/src/spec/utils/repository_manager_spec.rb
@@ -32,7 +32,7 @@ describe RepositoryManager do
it 'should return a list of repositories' do
@rmanager.repositories.should have(1).items
- @rmanager.repositories.first.id.should eql('fedora')
+ @rmanager.repositories.first.id.should eql('fedora13')
end
it 'should return a list of packagegroups' do
--
1.7.4
12 years, 6 months