---
recipes/deltacloud_recipe/manifests/aggregator.pp | 28 ++++++++++++++++++-
.../deltacloud_recipe/manifests/image-factory.pp | 2 +-
recipes/deltacloud_recipe/manifests/rails.pp | 7 +++++
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/recipes/deltacloud_recipe/manifests/aggregator.pp b/recipes/deltacloud_recipe/manifests/aggregator.pp
index 1a4c6cb..716d28c 100644
--- a/recipes/deltacloud_recipe/manifests/aggregator.pp
+++ b/recipes/deltacloud_recipe/manifests/aggregator.pp
@@ -35,7 +35,7 @@ class deltacloud::aggregator inherits deltacloud {
enable => true,
hasstatus => true,
require => [Package['deltacloud-aggregator-daemons'],
- Rails::Migrate::Db[migrate_deltacloud_database],
+ Rails::Seed::Db[seed_deltacloud_database],
Service[condor]] }
### Initialize and start the deltacloud database
@@ -60,6 +60,23 @@ class deltacloud::aggregator inherits deltacloud {
cwd => "/usr/share/deltacloud-aggregator",
rails_env => "production",
require => Rails::Create::Db[create_deltacloud_database]}
+ rails::seed::db{"seed_deltacloud_database":
+ cwd => "/usr/share/deltacloud-aggregator",
+ rails_env => "production",
+ require => Rails::Migrate::Db[migrate_deltacloud_database]}
+
+
+ ### Setup/start solr search service
+ exec{"start_solr":
+ cwd => "/usr/share/deltacloud-aggregator",
+ command => "/usr/bin/rake sunspot:solr:start",
+ environment => "RAILS_ENV=production",
+ require => Package['deltacloud-aggregator']}
+ exec{"build_solr_index":
+ cwd => "/usr/share/deltacloud-aggregator",
+ command => "/usr/bin/rake sunspot:reindex",
+ environment => "RAILS_ENV=production",
+ require => Exec['start_solr']}
}
class deltacloud::aggregator::disabled {
@@ -108,6 +125,13 @@ class deltacloud::aggregator::disabled {
postgres::user{"dcloud":
ensure => 'dropped',
require => Rails::Drop::Db["drop_deltacloud_database"]}
+
+ ### stop solr search service
+ exec{"stop_solr":
+ cwd => "/usr/share/deltacloud-aggregator",
+ command => "/usr/bin/rake sunspot:solr:stop",
+ environment => "RAILS_ENV=production",
+ require => Service['deltacloud-aggregator']}
}
# Create a new site admin aggregator web user
@@ -117,7 +141,7 @@ define deltacloud::site_admin($email="", $password="", $first_name="", $last_nam
environment => "RAILS_ENV=production",
command => "/usr/bin/rake dc:create_user[${name}] email=${email} password=${password} first_name=${first_name} last_name=${last_name}",
unless => "/usr/bin/test `psql dcloud dcloud -P tuples_only -c \"select count(*) from users where login = '${name}';\"` = \"1\"",
- require => Rails::Migrate::Db["migrate_deltacloud_database"]}
+ require => Rails::Seed::Db["seed_deltacloud_database"]}
exec{"grant_site_admin_privs":
cwd => '/usr/share/deltacloud-aggregator',
environment => "RAILS_ENV=production",
diff --git a/recipes/deltacloud_recipe/manifests/image-factory.pp b/recipes/deltacloud_recipe/manifests/image-factory.pp
index 036c0e7..c584d5a 100644
--- a/recipes/deltacloud_recipe/manifests/image-factory.pp
+++ b/recipes/deltacloud_recipe/manifests/image-factory.pp
@@ -57,7 +57,7 @@ class deltacloud::image-factory inherits deltacloud {
Package['deltacloud-aggregator-daemons'],
File['/etc/imagefactory.yml'],
Service[qpidd],
- Rails::Migrate::Db[migrate_deltacloud_database],
+ Rails::Seed::Db[seed_deltacloud_database],
Notify['boxgrinder_configured']]
service { 'imagefactoryd':
ensure => 'running',
diff --git a/recipes/deltacloud_recipe/manifests/rails.pp b/recipes/deltacloud_recipe/manifests/rails.pp
index 438a209..701abe3 100644
--- a/recipes/deltacloud_recipe/manifests/rails.pp
+++ b/recipes/deltacloud_recipe/manifests/rails.pp
@@ -15,6 +15,13 @@ define rails::migrate::db($cwd="", $rails_env=""){
command => "/usr/bin/rake db:migrate"}
}
+define rails::seed::db($cwd="", $rails_env=""){
+ exec{"seed_rails_database":
+ cwd => $cwd,
+ environment => "RAILS_ENV=${rails_env}",
+ command => "/usr/bin/rake db:seed"}
+}
+
define rails::drop::db($cwd="", $rails_env=""){
exec{"drop_rails_database":
cwd => $cwd,
--
1.7.2.3