Adds bits providing further post-installation configuration data for the various aeolus components.
Right now adds code creating providers and hardware profiles after a successful aeolus install. Additional bits will be added to create provider accounts, templates, images, and even instances post-install.
Sysadmins using the aeolus puppet recipe directly can also now define custom providers and hardware profiles to be automatically created post-installation.
- adds support for setting up and configuring multiple instances of the deltacloudd service - sets up providers for the mock and ec2 drivers - adds necessary data to the conductor db for these providers --- recipes/aeolus_recipe/aeolus_recipe.pp | 15 ++++- recipes/aeolus_recipe/aeolus_uninstall.pp | 4 +- recipes/aeolus_recipe/files/deltacloud-core | 77 ---------------------- recipes/aeolus_recipe/manifests/aeolus.pp | 12 ++++ recipes/aeolus_recipe/manifests/conductor.pp | 36 ++++++++++ recipes/aeolus_recipe/manifests/deltacloud.pp | 37 +++++++---- recipes/aeolus_recipe/manifests/iwhd.pp | 1 - recipes/aeolus_recipe/templates/deltacloud-core | 79 +++++++++++++++++++++++ 8 files changed, 168 insertions(+), 93 deletions(-) delete mode 100644 recipes/aeolus_recipe/files/deltacloud-core create mode 100644 recipes/aeolus_recipe/templates/deltacloud-core
diff --git a/recipes/aeolus_recipe/aeolus_recipe.pp b/recipes/aeolus_recipe/aeolus_recipe.pp index 65ae86f..317bf5e 100644 --- a/recipes/aeolus_recipe/aeolus_recipe.pp +++ b/recipes/aeolus_recipe/aeolus_recipe.pp @@ -26,8 +26,8 @@ import "aeolus_recipe/aeolus"
# include the various aeolus components +include aeolus::deltacloud::core include aeolus::conductor -include aeolus::deltacloud include aeolus::image-factory include aeolus::iwhd
@@ -38,3 +38,16 @@ aeolus::site_admin{"admin": password => 'password', first_name => 'aeolus', last_name => 'user'} + +aeolus::provider{"ec2": + port => 3002, + login_user => 'admin', + login_password => 'password', + require => Aeolus::Site_admin["admin"] } + +aeolus::provider{"mock": + port => 3003, + login_user => 'admin', + login_password => 'password', + require => Aeolus::Site_admin["admin"] } + diff --git a/recipes/aeolus_recipe/aeolus_uninstall.pp b/recipes/aeolus_recipe/aeolus_uninstall.pp index 4399ac3..e44b18b 100644 --- a/recipes/aeolus_recipe/aeolus_uninstall.pp +++ b/recipes/aeolus_recipe/aeolus_uninstall.pp @@ -27,6 +27,8 @@ import "aeolus_recipe/aeolus"
# disable the various aeolus components include aeolus::conductor::disabled -include aeolus::deltacloud::disabled include aeolus::iwhd::disabled include aeolus::image-factory::disabled + +aeolus::deltacloud::disabled{"ec2": } +aeolus::deltacloud::disabled{"mock": } diff --git a/recipes/aeolus_recipe/files/deltacloud-core b/recipes/aeolus_recipe/files/deltacloud-core deleted file mode 100644 index dda70d7..0000000 --- a/recipes/aeolus_recipe/files/deltacloud-core +++ /dev/null @@ -1,77 +0,0 @@ -#!/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}" -PORT="${PORT:-3002}" -LOCKFILE="${LOCKFILE:-/var/lock/subsys/deltacloud-core }" -LOGFILE="${LOGFILE:-/var/log/deltacloud-core/$DRIVER.log}" -export DELTACLOUD_MOCK_STORAGE=/usr/lib/ruby/gems/1.8/gems/deltacloud-core-0.2.0/lib/deltacloud/drivers/mock/data/ - -PROG=/usr/bin/deltacloudd - -. /etc/init.d/functions - -start() { - echo -n "Starting deltacloud-core: " - - $PROG -i $DRIVER -e $ENV -p $PORT >> $LOGFILE 2>&1 & - 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/recipes/aeolus_recipe/manifests/aeolus.pp b/recipes/aeolus_recipe/manifests/aeolus.pp index e40a2c9..a0b35b7 100644 --- a/recipes/aeolus_recipe/manifests/aeolus.pp +++ b/recipes/aeolus_recipe/manifests/aeolus.pp @@ -28,6 +28,8 @@ if $aeolus_enable_packages == "true" or $aeolus_enable_packages == "1" {
# Base aeolus class class aeolus { + package{'curl': ensure => 'installed'} + # Setup repos which to pull aeolus components # TODO: Don't hardcode these repos to RHEL-6 # The issue is that $releasever resolves to something like 6Server @@ -55,3 +57,13 @@ class aeolus { enabled => 1, gpgcheck => 0} }
+# Create a new provider in aeolus +define aeolus::provider($port, $login_user="", $login_password=""){ + aeolus::deltacloud{$name: port => $port} + aeolus::conductor::provider{$name: + type => $name, + url => "http://localhost:$%7Bport%7D/api", + login_user => $login_user, + login_password => $login_password, + require => Aeolus::Deltacloud[$name] } +} diff --git a/recipes/aeolus_recipe/manifests/conductor.pp b/recipes/aeolus_recipe/manifests/conductor.pp index b6c4c67..a6b029d 100644 --- a/recipes/aeolus_recipe/manifests/conductor.pp +++ b/recipes/aeolus_recipe/manifests/conductor.pp @@ -256,3 +256,39 @@ define aeolus::site_admin($email="", $password="", $first_name="", $last_name="" require => Exec[create_site_admin_user]} }
+define aeolus::conductor::login($user,$password){ + exec{"conductor-login-for-${name}": + command => "/usr/bin/curl -X POST http://localhost/conductor/user_session \ + -d user_session[login]=${user} \ + -d user_session[password]=${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'`"" } +} + +define aeolus::conductor::logout($user){ + exec{"conductor-logout-for-${name}": + command => "/usr/bin/curl -X GET http://localhost/conductor/logout -b /tmp/aeolus-${user}.cookie", + onlyif => "/usr/bin/test -f /tmp/aeolus-${user}.cookie" } # TODO add condition ensuring cookie / session is valid + exec{"conductor-logout-cookie-for-${name}": + command => "/bin/rm /tmp/aeolus-${user}.cookie", + onlyif => "/usr/bin/test -f /tmp/aeolus-${user}.cookie", + require => Exec["conductor-logout-for-${name}"]} +} + + +# Create a new provider via the conductor +define aeolus::conductor::provider($type="",$url="",$login_user="",$login_password=""){ + aeolus::conductor::login{"provider-${name}": user => $login_user, password => $login_password } + exec{"add-conductor-provider-${name}": + command => "/usr/bin/curl -X POST http://localhost/conductor/admin/providers \ + -b /tmp/aeolus-${login_user}.cookie \ + -d provider[name]=${name} \ + -d provider[url]=${url} \ + -d provider[provider_type_codename]=${name}", + logoutput => true, + require => [Aeolus::Conductor::Login["provider-$name"]] } + aeolus::conductor::logout{"provider-${name}": + user => $login_user, + require => Exec["add-conductor-provider-${name}"] } +} diff --git a/recipes/aeolus_recipe/manifests/deltacloud.pp b/recipes/aeolus_recipe/manifests/deltacloud.pp index f4e1802..6950603 100644 --- a/recipes/aeolus_recipe/manifests/deltacloud.pp +++ b/recipes/aeolus_recipe/manifests/deltacloud.pp @@ -1,48 +1,59 @@ # Aeolus deltacloud puppet definitions
-class aeolus::deltacloud inherits aeolus { +class aeolus::deltacloud::core { ### Install the aeolus components + include aeolus + if $enable_packages { package { 'rubygem-deltacloud-core': provider => 'yum', ensure => 'installed', require => Yumrepo['aeolus_arch', 'aeolus_noarch']} + } +}
- +# install the deltacloud component w/ the specified driver +define aeolus::deltacloud($port="3002") { + ### Install the driver-specific components + $enable_ec2_packages = $enable_packages and $name == "ec2" + if $enable_ec2_packages { # install ec2 support, - # TODO eventually we should prompt the user to select which drivers they want to install package { "rubygem-aws": provider => 'yum', ensure => 'installed' } } - file { "/var/log/deltacloud-core": ensure => 'directory' }
### we need to sync time to communicate w/ cloud providers include ntp::client
### Start the aeolus services - file {"/etc/init.d/deltacloud-core": - source => "puppet:///modules/aeolus_recipe/deltacloud-core", + file { "/var/log/deltacloud-${name}": ensure => 'directory' } + file {"/etc/init.d/deltacloud-${name}": + content => template("aeolus_recipe/deltacloud-core"), mode => 755 } - service { 'deltacloud-core': + service { "deltacloud-${name}": ensure => 'running', enable => true, - require => [return_if($enable_packages, Package['rubygem-deltacloud-core', 'rubygem-aws']), - File['/etc/init.d/deltacloud-core', '/var/log/deltacloud-core']] } + require => [return_if($enable_packages, Package['rubygem-deltacloud-core']), + return_if($enable_ec2_packages, Package['rubygem-aws']), + File["/etc/init.d/deltacloud-${name}", "/var/log/deltacloud-${name}"]] } }
-class aeolus::deltacloud::disabled { +define aeolus::deltacloud::disabled() { ### Uninstall the aeolus components if $enable_packages { package { 'rubygem-deltacloud-core': provider => 'yum', ensure => 'absent', - require => Service['deltacloud-core']} + require => Service["deltacloud-${name}"]} package { "rubygem-aws": provider => 'yum', ensure => 'absent', - require => Service['deltacloud-core']} + require => Service["deltacloud-${name}"]} }
### Stop the aeolus services - service { 'deltacloud-core': + service { "deltacloud-${name}": ensure => 'stopped', enable => false, hasstatus => true} + file {"/etc/init.d/deltacloud-${name}": + ensure => absent, + require => Service["deltacloud-${name}"]} }
diff --git a/recipes/aeolus_recipe/manifests/iwhd.pp b/recipes/aeolus_recipe/manifests/iwhd.pp index 2db8e14..cc165df 100644 --- a/recipes/aeolus_recipe/manifests/iwhd.pp +++ b/recipes/aeolus_recipe/manifests/iwhd.pp @@ -67,7 +67,6 @@ class aeolus::iwhd::disabled {
# Create a named bucket in iwhd define aeolus::create_bucket(){ - package{'curl': ensure => 'installed'} exec{"create-bucket-${name}": command => "/usr/bin/curl -X PUT http://localhost:9090/templates", logoutput => true, diff --git a/recipes/aeolus_recipe/templates/deltacloud-core b/recipes/aeolus_recipe/templates/deltacloud-core new file mode 100644 index 0000000..ab120ea --- /dev/null +++ b/recipes/aeolus_recipe/templates/deltacloud-core @@ -0,0 +1,79 @@ +#!/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-<%= name %> ] && . /etc/sysconfig/deltacloud-<%= name %> + +ENV="${ENV:-production}" +DRIVER="${DRIVER:-<%= name %>}" +PORT="${PORT:-<%= port %>}" +LOCKFILE="${LOCKFILE:-/var/lock/subsys/deltacloud-$DRIVER }" +LOGFILE="${LOGFILE:-/var/log/deltacloud-<%= name %>/$DRIVER.log}" +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 + +. /etc/init.d/functions + +start() { + echo -n "Starting deltacloud-<%= name %>: " + + $PROG -i $DRIVER -e $ENV -p $PORT >> $LOGFILE 2>&1 & + RETVAL=$? + if [ $RETVAL -eq 0 ] && touch $LOCKFILE ; then + echo_success + echo + else + echo_failure + echo + fi +} + +stop() { + echo -n "Shutting down deltacloud-<%= name %>: " + RETVAL=$? + # FIXME! we need to do a killproc -p <pidfile> here to ensure other deltacloud + # daemons are not killed as well + 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-<%= name %> {start|stop|restart|status}" + exit 1 + ;; +esac + +exit $RETVAL
On 03/21/2011 04:34 PM, Mohammed Morsi wrote:
- adds support for setting up and configuring multiple instances of the deltacloudd service
- sets up providers for the mock and ec2 drivers
- adds necessary data to the conductor db for these providers
recipes/aeolus_recipe/aeolus_recipe.pp | 15 ++++- recipes/aeolus_recipe/aeolus_uninstall.pp | 4 +- recipes/aeolus_recipe/files/deltacloud-core | 77 ---------------------- recipes/aeolus_recipe/manifests/aeolus.pp | 12 ++++ recipes/aeolus_recipe/manifests/conductor.pp | 36 ++++++++++ recipes/aeolus_recipe/manifests/deltacloud.pp | 37 +++++++---- recipes/aeolus_recipe/manifests/iwhd.pp | 1 - recipes/aeolus_recipe/templates/deltacloud-core | 79 +++++++++++++++++++++++ 8 files changed, 168 insertions(+), 93 deletions(-) delete mode 100644 recipes/aeolus_recipe/files/deltacloud-core create mode 100644 recipes/aeolus_recipe/templates/deltacloud-core
diff --git a/recipes/aeolus_recipe/aeolus_recipe.pp b/recipes/aeolus_recipe/aeolus_recipe.pp index 65ae86f..317bf5e 100644 --- a/recipes/aeolus_recipe/aeolus_recipe.pp +++ b/recipes/aeolus_recipe/aeolus_recipe.pp @@ -26,8 +26,8 @@ import "aeolus_recipe/aeolus"
# include the various aeolus components +include aeolus::deltacloud::core include aeolus::conductor -include aeolus::deltacloud include aeolus::image-factory include aeolus::iwhd
@@ -38,3 +38,16 @@ aeolus::site_admin{"admin": password => 'password', first_name => 'aeolus', last_name => 'user'}
+aeolus::provider{"ec2":
port => 3002,
login_user => 'admin',
login_password => 'password',
require => Aeolus::Site_admin["admin"] }
This isn't going to work as-is. Now that we support multiple amazon regions, the only way factory knows what region to use is by the provider name. Once we support multi-provider deltacloud cores this problem goes away, but for now, 'name' is where we have to specify this.
So for now the ec2 provider needs to have the name 'ec2-us-east-1' (provider type is still ec2 though). See here for the list of valid ec2 provider names: https://github.com/aeolusproject/image_factory/blob/master/imagefactory/buil...
On 03/22/2011 09:59 AM, Scott Seago wrote:
On 03/21/2011 04:34 PM, Mohammed Morsi wrote:
- adds support for setting up and configuring multiple instances of the deltacloudd service
- sets up providers for the mock and ec2 drivers
- adds necessary data to the conductor db for these providers
recipes/aeolus_recipe/aeolus_recipe.pp | 15 ++++- recipes/aeolus_recipe/aeolus_uninstall.pp | 4 +- recipes/aeolus_recipe/files/deltacloud-core | 77
recipes/aeolus_recipe/manifests/aeolus.pp | 12 ++++ recipes/aeolus_recipe/manifests/conductor.pp | 36 ++++++++++ recipes/aeolus_recipe/manifests/deltacloud.pp | 37 +++++++---- recipes/aeolus_recipe/manifests/iwhd.pp | 1 - recipes/aeolus_recipe/templates/deltacloud-core | 79 +++++++++++++++++++++++ 8 files changed, 168 insertions(+), 93 deletions(-) delete mode 100644 recipes/aeolus_recipe/files/deltacloud-core create mode 100644 recipes/aeolus_recipe/templates/deltacloud-core
diff --git a/recipes/aeolus_recipe/aeolus_recipe.pp b/recipes/aeolus_recipe/aeolus_recipe.pp index 65ae86f..317bf5e 100644 --- a/recipes/aeolus_recipe/aeolus_recipe.pp +++ b/recipes/aeolus_recipe/aeolus_recipe.pp @@ -26,8 +26,8 @@ import "aeolus_recipe/aeolus"
# include the various aeolus components +include aeolus::deltacloud::core include aeolus::conductor -include aeolus::deltacloud include aeolus::image-factory include aeolus::iwhd
@@ -38,3 +38,16 @@ aeolus::site_admin{"admin": password => 'password', first_name => 'aeolus', last_name => 'user'}
+aeolus::provider{"ec2":
port => 3002,
login_user => 'admin',
login_password => 'password',
require => Aeolus::Site_admin["admin"] }
This isn't going to work as-is. Now that we support multiple amazon regions, the only way factory knows what region to use is by the provider name. Once we support multi-provider deltacloud cores this problem goes away, but for now, 'name' is where we have to specify this.
So for now the ec2 provider needs to have the name 'ec2-us-east-1' (provider type is still ec2 though). See here for the list of valid ec2 provider names: https://github.com/aeolusproject/image_factory/blob/master/imagefactory/buil...
OK No biggie, will just modify the patch to separate the provider type from the name and to update the name. By default do we want multiple deltacloudd instances setup for all the Amazon regions, or do we just want to stick with the one (ec2-us-east-1)?
-Mo
On Tue, 2011-03-22 at 11:24 -0400, Mo Morsi wrote:
On 03/22/2011 09:59 AM, Scott Seago wrote:
On 03/21/2011 04:34 PM, Mohammed Morsi wrote:
- adds support for setting up and configuring multiple instances of the deltacloudd service
- sets up providers for the mock and ec2 drivers
- adds necessary data to the conductor db for these providers
recipes/aeolus_recipe/aeolus_recipe.pp | 15 ++++- recipes/aeolus_recipe/aeolus_uninstall.pp | 4 +- recipes/aeolus_recipe/files/deltacloud-core | 77
recipes/aeolus_recipe/manifests/aeolus.pp | 12 ++++ recipes/aeolus_recipe/manifests/conductor.pp | 36 ++++++++++ recipes/aeolus_recipe/manifests/deltacloud.pp | 37 +++++++---- recipes/aeolus_recipe/manifests/iwhd.pp | 1 - recipes/aeolus_recipe/templates/deltacloud-core | 79 +++++++++++++++++++++++ 8 files changed, 168 insertions(+), 93 deletions(-) delete mode 100644 recipes/aeolus_recipe/files/deltacloud-core create mode 100644 recipes/aeolus_recipe/templates/deltacloud-core
diff --git a/recipes/aeolus_recipe/aeolus_recipe.pp b/recipes/aeolus_recipe/aeolus_recipe.pp index 65ae86f..317bf5e 100644 --- a/recipes/aeolus_recipe/aeolus_recipe.pp +++ b/recipes/aeolus_recipe/aeolus_recipe.pp @@ -26,8 +26,8 @@ import "aeolus_recipe/aeolus"
# include the various aeolus components +include aeolus::deltacloud::core include aeolus::conductor -include aeolus::deltacloud include aeolus::image-factory include aeolus::iwhd
@@ -38,3 +38,16 @@ aeolus::site_admin{"admin": password => 'password', first_name => 'aeolus', last_name => 'user'}
+aeolus::provider{"ec2":
port => 3002,
login_user => 'admin',
login_password => 'password',
require => Aeolus::Site_admin["admin"] }
This isn't going to work as-is. Now that we support multiple amazon regions, the only way factory knows what region to use is by the provider name. Once we support multi-provider deltacloud cores this problem goes away, but for now, 'name' is where we have to specify this.
So for now the ec2 provider needs to have the name 'ec2-us-east-1' (provider type is still ec2 though). See here for the list of valid ec2 provider names: https://github.com/aeolusproject/image_factory/blob/master/imagefactory/buil...
OK No biggie, will just modify the patch to separate the provider type from the name and to update the name. By default do we want multiple deltacloudd instances setup for all the Amazon regions, or do we just want to stick with the one (ec2-us-east-1)?
-Mo
I would vote for setting them all up, just because with the current setup, it will kind of be a pain for the user (on a few levels). If anyone strongly objects, I would roll with it though.
-j
aeolus-devel mailing list aeolus-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/aeolus-devel
+aeolus::provider{"ec2":
port => 3002,
login_user => 'admin',
login_password => 'password',
require => Aeolus::Site_admin["admin"] }
This isn't going to work as-is. Now that we support multiple amazon regions, the only way factory knows what region to use is by the provider name. Once we support multi-provider deltacloud cores this problem goes away, but for now, 'name' is where we have to specify this.
So for now the ec2 provider needs to have the name 'ec2-us-east-1' (provider type is still ec2 though). See here for the list of valid ec2 provider names: https://github.com/aeolusproject/image_factory/blob/master/imagefactory/buil...
OK No biggie, will just modify the patch to separate the provider type from the name and to update the name. By default do we want multiple deltacloudd instances setup for all the Amazon regions, or do we just want to stick with the one (ec2-us-east-1)?
-Mo
I would vote for setting them all up, just because with the current setup, it will kind of be a pain for the user (on a few levels). If anyone strongly objects, I would roll with it though.
-j
OK Updated and resent, I created providers for the two ec2 us regions (east and west). If we want to add more, its just as trivial as copying and pasting a few lines of code in recipes/aeolus_recipe/aeolus_recipe.pp
-Mo
--- src/app/controllers/admin/providers_controller.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/app/controllers/admin/providers_controller.rb b/src/app/controllers/admin/providers_controller.rb index 435e8a9..3f4e289 100644 --- a/src/app/controllers/admin/providers_controller.rb +++ b/src/app/controllers/admin/providers_controller.rb @@ -50,6 +50,11 @@ class Admin::ProvidersController < ApplicationController
def create require_privilege(Privilege::CREATE, Provider) + if params[:provider].has_key?(:provider_type_codename) + provider_type = params[:provider].delete(:provider_type_codename) + provider_type = ProviderType.find_by_codename(provider_type) + params[:provider][:provider_type_id] = provider_type.id + end @provider = Provider.new(params[:provider]) if params[:test_connection] test_connection(@provider)
--- recipes/aeolus_recipe/aeolus_recipe.pp | 8 ++++++++ recipes/aeolus_recipe/manifests/conductor.pp | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/recipes/aeolus_recipe/aeolus_recipe.pp b/recipes/aeolus_recipe/aeolus_recipe.pp index 317bf5e..2656b5a 100644 --- a/recipes/aeolus_recipe/aeolus_recipe.pp +++ b/recipes/aeolus_recipe/aeolus_recipe.pp @@ -51,3 +51,11 @@ aeolus::provider{"mock": login_password => 'password', require => Aeolus::Site_admin["admin"] }
+aeolus::conductor::hwp{"hwp1": + memory => "1", + cpu => "1", + storage => "1", + architecture => "x86_64", + login_user => 'admin', + login_password => 'password', + require => Aeolus::Site_admin["admin"] } diff --git a/recipes/aeolus_recipe/manifests/conductor.pp b/recipes/aeolus_recipe/manifests/conductor.pp index a6b029d..2a95bb4 100644 --- a/recipes/aeolus_recipe/manifests/conductor.pp +++ b/recipes/aeolus_recipe/manifests/conductor.pp @@ -292,3 +292,25 @@ define aeolus::conductor::provider($type="",$url="",$login_user="",$login_passwo user => $login_user, require => Exec["add-conductor-provider-${name}"] } } + +define aeolus::conductor::hwp($memory='', $cpu='', $storage='', $architecture='', $login_user="",$login_password=""){ + aeolus::conductor::login{"hwp-${name}": user => $login_user, password => $login_password } + exec{"add-conductor-hwp-${name}": + command => "/usr/bin/curl -X POST http://localhost/conductor/admin/hardware_profiles \ + -b /tmp/aeolus-${login_user}.cookie \ + -d hardware_profile[name]=${name} \ + -d hardware_profile[memory_attributes][value]=${memory} \ + -d hardware_profile[cpu_attributes][value]=${cpu} \ + -d hardware_profile[storage_attributes][value]=${storage} \ + -d hardware_profile[architecture_attributes][value]=${architecture} \ + -d hardware_profile[memory_attributes][name]=memory -d hardware_profile[memory_attributes][unit]=MB \ + -d hardware_profile[cpu_attributes][name]=cpu -d hardware_profile[cpu_attributes][unit]=count \ + -d hardware_profile[storage_attributes][name]=storage -d hardware_profile[storage_attributes][unit]=GB \ + -d hardware_profile[architecture_attributes][name]=architecture -d hardware_profile[architecture_attributes][unit]=label \ + -d commit=Save", + logoutput => true, + require => [Aeolus::Conductor::Login["hwp-$name"]] } + aeolus::conductor::logout{"hwp-${name}": + user => $login_user, + require => Exec["add-conductor-hwp-${name}"] } +}
--- spec/configure_spec.rb | 11 +++++++++++ spec/spec_helper.rb | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/spec/configure_spec.rb b/spec/configure_spec.rb index 83d303f..68c368c 100644 --- a/spec/configure_spec.rb +++ b/spec/configure_spec.rb @@ -76,4 +76,15 @@ describe "aeolus-configure" do output = `/bin/echo listpeers | /usr/sbin/ntpdc` output.should =~ /.*client.*/ end + + it "should create mock and ec2 providers" do + ['ec2', 'mock'].each { |provider| + pt = ProviderType.find_by_codename(provider) + Provider.find(:first, :conditions => ['name = ? AND provider_type_id = ?', provider, pt.id]).should_not be_nil, "provider #{provider} should not be nil" + } + end + + it "should create an initial hardware profile" do + HardwareProfile.find_by_name('hwp1').should_not be_nil + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 38932d9..7cd533c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,7 +10,7 @@ AEOLUS_PACKAGES = ['iwhd', 'imagefactory', 'aeolus-conductor', 'aeolus-conductor-doc', 'aeolus-conductor-daemons', 'aeolus-configure']
-AEOLUS_SERVICES = ['iwhd', 'deltacloud-core', 'imagefactoryd', +AEOLUS_SERVICES = ['iwhd', 'deltacloud-mock', 'deltacloud-ec2', 'imagefactoryd', 'aeolus-conductor', 'conductor-condor_refreshd', 'conductor-dbomatic'] # 'conductor-delayed_job'] TODO where is the init script for this?
aeolus-devel@lists.fedorahosted.org