Compass improvements
by Tomas Sedovic
These patches are the first step towards actually using Compass in Aggregator.
Namely:
* a place for defining globally-available mixins and variables
* some stylesheet simplification using the Compass goodness
* small formating changes
13 years, 8 months
[PATCH aggregator] Fixed fetching of instance state
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
When a provider is down and instance state is fetched (for example
on instances index page), then there is a nil object and exception
is thrown.
---
src/app/models/instance_task.rb | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/app/models/instance_task.rb b/src/app/models/instance_task.rb
index 9da110b..6c78c0f 100644
--- a/src/app/models/instance_task.rb
+++ b/src/app/models/instance_task.rb
@@ -46,22 +46,21 @@ class InstanceTask < Task
actions = []
# FIXME: cloud_account won't always be set here, but we're requiring
# front end realm for now.
- cloud_account = instance.cloud_account
- c_state = cloud_account.connect.instance_state(state) unless cloud_account.nil?
- if !cloud_account.nil? and c_state
- transitions = c_state.transitions
- transitions.each do |transition|
- # FIXME if we allow actions based on the expected state after
- # automatic transitions, we need to call this method again with
- # the state from transition.to passed in.
- unless transition.action.nil?
- add_action = true
- if (instance and user)
- # FIXME: check permissions here if we filter actions by permission
+ if cloud_account = instance.cloud_account and
+ conn = cloud_account.connect and c_state = conn.instance_state(state)
+ transitions = c_state.transitions
+ transitions.each do |transition|
+ # FIXME if we allow actions based on the expected state after
+ # automatic transitions, we need to call this method again with
+ # the state from transition.to passed in.
+ unless transition.action.nil?
+ add_action = true
+ if (instance and user)
+ # FIXME: check permissions here if we filter actions by permission
+ end
+ actions << transition.action if add_action
end
- actions << transition.action if add_action
end
- end
end
actions
end
--
1.7.0.1
13 years, 8 months
[PATCH aggregator] Converts HardwareProfileProperty 'kind' attr to string.
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Deltacloud client lib returns 'kind' attribute as a symbol,
but activereord doesn't deal well with it when saving. This
patch stringifies value.
---
src/app/models/hardware_profile.rb | 4 ++--
src/app/models/hardware_profile_property.rb | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index de9ef23..2ce6d81 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -85,10 +85,10 @@ class HardwareProfile < ActiveRecord::Base
def new_property(prop)
return nil unless prop.present?
the_property = HardwareProfileProperty.new(:name => prop.name,
- :kind => prop.kind,
+ :kind => prop.kind.to_s,
:unit => prop.unit,
:value => prop.value)
- case prop.kind
+ case prop.kind.to_s
when HardwareProfileProperty::RANGE
the_property.range_first = prop.range[:from]
the_property.range_last = prop.range[:to]
diff --git a/src/app/models/hardware_profile_property.rb b/src/app/models/hardware_profile_property.rb
index 0717484..1291122 100644
--- a/src/app/models/hardware_profile_property.rb
+++ b/src/app/models/hardware_profile_property.rb
@@ -26,9 +26,9 @@ class HardwareProfileProperty < ActiveRecord::Base
CPU = "cpu"
ARCHITECTURE = "architecture"
- FIXED = :fixed
- RANGE = :range
- ENUM = :enum
+ FIXED = 'fixed'
+ RANGE = 'range'
+ ENUM = 'enum'
UNIT_MB = "MB"
UNIT_GB = "GB"
--
1.7.0.1
13 years, 8 months
[PATCH aggregator] Removed "Add a Provider Account" link from Summary dashboard tab.
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Referenced page raises exception because of missing provider_id and we don't know
provider on summary page. Provider account creation is still accessible from
provider page.
---
src/app/views/dashboard/summary.haml | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/app/views/dashboard/summary.haml b/src/app/views/dashboard/summary.haml
index f3a21d3..ff116d4 100644
--- a/src/app/views/dashboard/summary.haml
+++ b/src/app/views/dashboard/summary.haml
@@ -31,8 +31,6 @@
%h2
Actions
- if @is_admin
- %a{:href => url_for(:controller => "cloud_accounts", :action => "new")}
- Add a Provider Account
%a{:href => url_for(:controller => "provider", :action => "new")}
Add a Provider
%a{:href => url_for(:controller => "users", :action => "new")}
--
1.7.0.1
13 years, 8 months
[PATCH aggregator] Fixed Bug 619838 - display errors when user registration fails
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/app/controllers/users_controller.rb | 1 +
src/app/services/registration_service.rb | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 19828db..b9d290a 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -34,6 +34,7 @@ class UsersController < ApplicationController
flash[:notice] = "User registered!"
redirect_back_or_default user_url(@user)
else
+ flash[:warning] = "user registration failed: #{(a)registration.error}"
render :action => :new
end
end
diff --git a/src/app/services/registration_service.rb b/src/app/services/registration_service.rb
index 2083803..37444ad 100644
--- a/src/app/services/registration_service.rb
+++ b/src/app/services/registration_service.rb
@@ -1,11 +1,16 @@
class RegistrationService
+ attr_reader :error
def initialize(user)
@user = user
end
def save
- return false unless valid?
+ unless valid?
+ @error = "validation failed"
+ return false
+ end
+
begin
User.transaction do
@user.save!
@@ -17,11 +22,17 @@ class RegistrationService
@pool.quota_id = @quota.id
@pool.save!
+ raise "Role 'Instance Creator and User' doesn't exist" unless
+ role = Role.find_by_name("Instance Creator and User")
+
Permission.create!({:user => @user,
- :role => Role.find_by_name("Instance Creator and User"),
+ :role => role,
:permission_object => @pool})
end
rescue
+ Rails.logger.error $!.message
+ Rails.logger.error $!.backtrace.join("\n ")
+ @error = $!.message
false
end
end
--
1.7.0.1
13 years, 8 months
controller minor fixes
by Jan Provazník
Hi,
some minor fixes/changes, mostly in controllers, which I found when writing
cucumber test for provider. It depends on "Removed cloud type field from
new provider form" patch.
13 years, 8 months
Re: [deltacloud-devel] Fw: ANNOUNCE: libdeltacloud v0.4
by Chris Lalancette
On 08/31/10 - 10:31:27AM, Ed Bradford wrote:
>
>
> I just recently joined Deltacloud. Yesterday, I downloaded libdeltacloud
> and have two questions.
>
> 1. For past 20 years I've been using Windows. Now to do deltacloud I find
> that Fedora 13 works - everything so far
> on the download page is working. Yesterday I downloaded libdeltacloud and
> today you say you just released version 0.4.
> How do I tell which version I downloaded?
I guess it depends on which version you downloaded :). Did you get it off of
my website, or did you pull it from git? If you pulled it from my website
previous to today, then the only version up there was 0.3, so you must have
that. The name of the file should also be something like libdeltacloud-0.3.
If you pulled it out of git, you can do "git tag" or "git log" to look at
the version you are currently at.
>
> 2. In my past i have been a Unix guru. However, due to my behavior for the
> past 10 -15 years, my Unix/Linux skills have
> waned. How do I build libdeltacloud. I have all the requisite software
> on my Fedora 13 system but just running
>
> bash autogen.sh
>
> didn't seem to build the executable. There is a Makefile.in but no
> Makefile. What have I missed?
autogen.sh is just the first step to building. You basically need to do:
$ ./autogen.sh
$ ./configure
$ make
Which will build the library for you. Note that there is no executable
generated, just a .so. I will add a top-level README into the source code
with this information.
>
> Thank you.
>
> Ed Bradford
> Pflugerville,TX
>
> PS: Has anyone tried to put all this stuff together on Windows with cygwin?
No, not at all. I would be surprised if it works there without some
modification, but if you do get it working, let me know the steps so I can
put them in the README.
--
Chris Lalancette
13 years, 8 months
ANNOUNCE: libdeltacloud v0.4
by Chris Lalancette
All,
I'm pleased to announce the release of libdeltacloud v0.4.
libdeltacloud is a C library that wraps the deltacloud REST API in a
convenient-to-use C/C++ library. This is a fairly minor release, with a
few internal cleanups and some better error reporting:
- Better error reporting for HTTP GET/POST/DELETE problems
- Detailed error reporting when a deltacloud API throws a 500 Internal Server
error. In this case, the deltacloud API will build up an XML document
describing the error in detail; we now properly handle this XML document
and raise our own error.
- Internal cleanups that remove a bunch of duplicated code, which should make
future maintenance a bit easier.
The git repository that holds the source code for libdeltacloud is here:
http://git.fedorahosted.org/git/?p=deltacloud/libdeltacloud.git;a=summary
Until I get this packaged for Fedora proper, pre-compiled RPM packages for
Fedora 12 and 13 are here:
http://people.redhat.com/clalance/libdeltacloud
If you have any questions, problems, concerns, or bugs, please let me know!
--
Chris Lalancette
13 years, 8 months
[PATCH aggregator] initial deltacloud appliance (rev 2)
by Mo Morsi
To create the appliance, simply run through the following steps which will start the appliance via libvirt
$ cd appliance/
$ sudo appliance-creator -n deltacloud -c dcloud.ks --cache /var/tmp/act/
$ sudo virt-image deltacloud/deltacloud.xml
To build an updated deltacloud_appliance puppet recipe rpm,
$ tar czvf deltacloud_appliance.tgz deltacloud_appliance/
$ cp deltacloud_appliance.tgz ~/rpmbuild/SOURCES
$ rpmbuild -ba deltacloud_appliance.spec.
Pulp is currently being installed though integration with deltacloud is tbd (coming soon).
---
appliance/dcloud.ks | 97 ++++++++++++++++
appliance/deltacloud_appliance.spec | 60 ++++++++++
.../deltacloud_appliance/deltacloud_appliance.pp | 117 ++++++++++++++++++++
.../deltacloud_appliance/files/condor_config.local | 21 ++++
.../deltacloud_appliance/files/deltacloud-core | 74 ++++++++++++
appliance/deltacloud_appliance/files/pg_hba.conf | 2 +
6 files changed, 371 insertions(+), 0 deletions(-)
create mode 100644 appliance/dcloud.ks
create mode 100644 appliance/deltacloud_appliance.spec
create mode 100644 appliance/deltacloud_appliance/deltacloud_appliance.pp
create mode 100644 appliance/deltacloud_appliance/files/condor_config.local
create mode 100755 appliance/deltacloud_appliance/files/deltacloud-core
create mode 100644 appliance/deltacloud_appliance/files/pg_hba.conf
diff --git a/appliance/dcloud.ks b/appliance/dcloud.ks
new file mode 100644
index 0000000..129825f
--- /dev/null
+++ b/appliance/dcloud.ks
@@ -0,0 +1,97 @@
+# Deltacloud appliance kickstart
+
+# Yum repos to use
+repo --name=f13 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-13&arch=$basearch
+repo --name=f13-updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f13&arch=$basearch
+repo --name=thincrust --baseurl=http://www.thincrust.net/repo/noarch/
+
+# local yum repo with:
+# * ruby 1.8.7
+# * rails 2.3.8
+# * patched locale_rails, activerecord, haml, and puppet rpms (to fix issues)
+# * deltacloud aggregator rpms
+# * condor-dcloud and libdeltacloud
+# * deltacloud_appliance
+repo --name=deltacloud_local --baseurl=http://yum.morsi.org/repos/13
+
+# pull pulp in from here
+repo --name=pulp --baseurl=http://mmccune.fedorapeople.org/pulp/fedora/13/$basearch
+
+# Firewall / network configuration
+firewall --enable --ssh
+network --bootproto=dhcp --device=eth0 --onboot=on
+
+# System authorization information
+auth --useshadow --enablemd5
+
+# System keyboard
+keyboard us
+
+# System language
+lang en_US.UTF-8
+
+# System timezone
+timezone US/Eastern
+
+# System bootloader configuration
+bootloader --append="5" --location=mbr --timeout=1
+
+# Disk partitioning information
+part / --fstype="ext3" --ondisk=sda --size=3072 --bytes-per-inode=4096
+
+# No need for additional config
+firstboot --disable
+
+%post
+ /sbin/chkconfig --level 35 ace on
+ mkdir /etc/sysconfig/ace
+ echo deltacloud_appliance >> /etc/sysconfig/ace/appliancename
+
+ /usr/sbin/useradd dcuser -p ""
+ # TODO (here or in deltacloud_appliance.pp) startup firefox on duser's X login w/ core & aggregator wuis in tabs
+%end
+
+%packages --excludedocs --nobase --instLangs=en
+@core
+@base-x
+@gnome-desktop
+acpid
+bash
+chkconfig
+dhclient
+e2fsprogs
+grub
+iputils
+kernel
+lokkit
+passwd
+rootfiles
+vim-enhanced
+wget
+bind-utils
+yum
+firefox
+-authconfig
+-checkpolicy
+-dmraid
+-ed
+-fedora-logos
+-fedora-release-notes
+-kbd
+-kpartx
+-kudzu
+-libselinux
+-libselinux-python
+-lvm2
+-mdadm
+-policycoreutils
+-prelink
+-selinux-policy*
+-setserial
+-tar
+-usermode
+-wireless-tools
+-firstboot
+
+deltacloud_appliance
+%end
diff --git a/appliance/deltacloud_appliance.spec b/appliance/deltacloud_appliance.spec
new file mode 100644
index 0000000..44167e3
--- /dev/null
+++ b/appliance/deltacloud_appliance.spec
@@ -0,0 +1,60 @@
+%define aceHome /usr/share/ace
+%define pbuild %{_builddir}/%{name}-%{version}
+
+Summary: DeltaCloud Appliance
+Name: deltacloud_appliance
+Version: 0.0.1
+Release: 1%{?dist}
+
+Group: Applications/Internet
+License: GPLv2+
+URL: http://deltacloud.org
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}
+BuildArch: noarch
+Requires: ace-banners
+Requires: ace-ssh
+Requires: ace-postgres
+
+# Deltacloud and dependencies
+Requires: deltacloud-aggregator
+Requires: deltacloud-aggregator-daemons
+Requires: deltacloud-aggregator-doc
+Requires: condor >= 7.5.0
+Requires: ruby
+Requires: ruby-rdoc
+Requires: ruby-devel
+Requires: rubygem-rails
+Requires: gcc-c++
+Requires: libxml2-devel
+Requires: libxslt-devel
+Requires: pulp
+
+Requires: rubygem-thin
+Requires: rubygem-haml
+
+%description
+Deltacloud appliance
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf %{buildroot}
+%{__mkdir} -p %{buildroot}/%{aceHome}/appliances/%{name}
+%{__cp} -R %{pbuild}/* %{buildroot}/%{aceHome}/appliances/%{name}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%dir %{aceHome}
+%{aceHome}/*
+
+
+%changelog
+* Thu Mar 26 2008 Mohammed Morsi <mmorsi(a)redhat.com> 0.0.1-1
+- Initial package
diff --git a/appliance/deltacloud_appliance/deltacloud_appliance.pp b/appliance/deltacloud_appliance/deltacloud_appliance.pp
new file mode 100644
index 0000000..d47ff46
--- /dev/null
+++ b/appliance/deltacloud_appliance/deltacloud_appliance.pp
@@ -0,0 +1,117 @@
+#--
+# 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>
+#--
+
+#
+# deltacloud thincrust appliance
+#
+
+# Modules used by the appliance
+import "appliance_base"
+import "banners"
+import "firewall"
+#import "console"
+
+# Information about our appliance
+$appliance_name = "Deltacloud Appliance"
+$appliance_version = "0.0.1"
+
+# Configuration
+appliance_base::setup{$appliance_name:}
+appliance_base::enable_updates{$appliance_name:}
+banners::all{$appliance_name:}
+firewall::setup{$appliance_name: status=>"enabled"}
+
+# Install required gems
+single_exec{"install_required_gems":
+ command => "/usr/bin/gem install authlogic gnuplot scruffy compass builder"
+}
+
+# TODO setup a gem repo w/ latest snapshots of deltacloud core if we need those
+
+# Deltacloud core
+single_exec{"install_deltacloud_core":
+ command => "/usr/bin/gem install deltacloud-client deltacloud-core"
+}
+
+# Configure and start condor-dcloud
+file {"/var/lib/condor/condor_config.local":
+ source => "puppet:///deltacloud_appliance/condor_config.local",
+ notify => Service[condor]
+}
+service {"condor" :
+ ensure => running,
+ enable => true
+}
+
+# Configure and start postgres
+single_exec {"initialize_db":
+ command => "/sbin/service postgresql initdb"
+}
+file {"/var/lib/pgsql/data/pg_hba.conf":
+ source => "puppet:///deltacloud_appliance/pg_hba.conf",
+ require => Single_exec[initialize_db]
+}
+service {"postgresql" :
+ ensure => running,
+ enable => true,
+ require => File["/var/lib/pgsql/data/pg_hba.conf"]
+}
+# XXX ugly hack, postgres takes sometime to startup even though reporting as running
+# need to pause for a bit to ensure it is running before we try to access the db
+single_exec{"postgresql_startup_pause":
+ command => "/bin/sleep 5",
+ require => Service[postgresql]
+}
+single_exec{"create_dcloud_postgres_user":
+ command => "/usr/bin/psql postgres postgres -c \"CREATE USER dcloud WITH PASSWORD 'v23zj59an' CREATEDB\"",
+ require => Single_exec[postgresql_startup_pause]
+}
+
+# Create deltacloud database
+single_exec{"create_deltacloud_database":
+ cwd => "/usr/share/deltacloud-aggregator",
+ environment => "RAILS_ENV=production",
+ command => "/usr/bin/rake db:create:all",
+ require => [Single_exec[create_dcloud_postgres_user], Single_exec[install_required_gems], Single_exec[install_deltacloud_core]]
+}
+single_exec{"migrate_deltacloud_database":
+ cwd => "/usr/share/deltacloud-aggregator",
+ environment => "RAILS_ENV=production",
+ command => "/usr/bin/rake db:migrate",
+ require => Single_exec[create_deltacloud_database]
+}
+
+# install init.d control script for deltacloudd
+file {"/etc/init.d/deltacloud-core":
+ source => "puppet:///deltacloud_appliance/deltacloud-core",
+ mode => 755
+}
+
+# Startup Deltacloud services
+service {"deltacloud-aggregator" :
+ ensure => running,
+ enable => true,
+ require => [Single_exec[install_required_gems], Single_exec[migrate_deltacloud_database]]
+}
+service{"deltacloud-core":
+ ensure => running,
+ enable => true,
+ require => [Single_exec[install_deltacloud_core], File["/etc/init.d/deltacloud-core"]]
+}
diff --git a/appliance/deltacloud_appliance/files/condor_config.local b/appliance/deltacloud_appliance/files/condor_config.local
new file mode 100644
index 0000000..8e22206
--- /dev/null
+++ b/appliance/deltacloud_appliance/files/condor_config.local
@@ -0,0 +1,21 @@
+CONDOR_HOST = localhost
+ALLOW_WRITE = *
+
+DAEMON_LIST = MASTER, SCHEDD, COLLECTOR, NEGOTIATOR, STARTD
+
+GRIDMANAGER_DEBUG = D_FULLDEBUG
+MAX_GRIDMANAGER_LOG = 500000000
+GRIDMANAGER_JOB_PROBE_INTERVAL = 30
+
+DCLOUD_GAHP = $(SBIN)/dcloud_gahp
+
+CLASSAD_LIFETIME = 0
+
+# for re-advertising classads (i.e. condor_refreshd)
+CONDOR_DEVELOPERS_COLLECTOR = localhost:7890
+COLLECTOR_UPDATE_INTERVAL = 900
+
+# for the event log parsing (i.e. dbomatic)
+EVENT_LOG=$(LOG)/EventLog
+EVENT_LOG_USE_XML=True
+EVENT_LOG_JOB_AD_INFORMATION_ATTRS=Owner,GlobalJobId,Cmd,JobStartDate,JobCurrentStartDate,JobFinishedHookDone
diff --git a/appliance/deltacloud_appliance/files/deltacloud-core b/appliance/deltacloud_appliance/files/deltacloud-core
new file mode 100755
index 0000000..efd62d3
--- /dev/null
+++ b/appliance/deltacloud_appliance/files/deltacloud-core
@@ -0,0 +1,74 @@
+#!/bin/bash
+#
+#
+# deltacloud-core startup script for deltacloud-core server
+#
+# chkconfig: - 97 03
+# description: deltacloud-core is primary server process for the \
+# Deltacloud Core component.
+#
+
+[ -r /etc/sysconfig/deltacloud-core ] && . /etc/sysconfig/deltacloud-core
+
+ENV="${ENV:-production}"
+DRIVER="${DRIVER:-ec2}"
+LOCKFILE="${LOCKFILE:-/var/lock/subsys/deltacloud-core }"
+
+PROG=/usr/bin/deltacloudd
+
+. /etc/init.d/functions
+
+start() {
+ echo -n "Starting deltacloud-core: "
+
+ $PROG -i $DRIVER -e $ENV&
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] && touch $LOCKFILE ; then
+ echo_success
+ echo
+ else
+ echo_failure
+ echo
+ fi
+}
+
+stop() {
+ echo -n "Shutting down deltacloud-core: "
+ RETVAL=$?
+ killall deltacloudd
+ if [ $RETVAL -eq 0 ] && rm -f $LOCKFILE ; then
+ echo_success
+ echo
+ else
+ echo_failure
+ echo
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ reload)
+ ;;
+ force-reload)
+ restart
+ ;;
+ status)
+ status $PROG
+ RETVAL=$?
+ ;;
+ *)
+ echo "Usage: deltacloud-core {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit $RETVAL
diff --git a/appliance/deltacloud_appliance/files/pg_hba.conf b/appliance/deltacloud_appliance/files/pg_hba.conf
new file mode 100644
index 0000000..70d83bb
--- /dev/null
+++ b/appliance/deltacloud_appliance/files/pg_hba.conf
@@ -0,0 +1,2 @@
+local all all trust
+host all all 127.0.0.1 255.255.255.255 trust
--
1.7.2.1
13 years, 8 months