From 45b4ce4fcc40bd6580bd03f6ba711608542df01f Mon Sep 17 00:00:00 2001
From: Ivan Chavero <ichavero@redhat.com>
Date: Wed, 27 Aug 2014 13:38:32 -0600
Subject: [PATCH] Add manage_service feature for horizon
---
manifests/init.pp | 10 ++++++++++
manifests/wsgi/apache.pp | 10 ++++++++++
spec/classes/horizon_init_spec.rb | 4 ----
spec/classes/horizon_wsgi_apache_spec.rb | 1 -
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/manifests/init.pp b/manifests/init.pp
index 405b732..c0f02c4 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -123,6 +123,12 @@
# [*configure_apache*]
# (optional) Configure Apache for Horizon. (Defaults to true)
#
+# [*manage_apache*]
+# (optional) Start Apache. (Defaults to true)
+#
+# [*enable_apache*]
+# (optional) Enable Apache startup after reboot. (Defaults to true)
+#
# [*bind_address*]
# (optional) Bind address in Apache for Horizon. (Defaults to undef)
#
@@ -188,6 +194,8 @@ class horizon(
$help_url = 'http://openstack.redhat.com/Docs',
$local_settings_template = 'horizon/local_settings.py.erb',
$configure_apache = true,
+ $manage_apache = true,
+ $enable_apache = true,
$bind_address = undef,
$servername = $::fqdn,
$listen_ssl = false,
@@ -281,6 +289,8 @@ class horizon(
if $configure_apache {
class { 'horizon::wsgi::apache':
+ manage_service => $manage_apache,
+ enabled => $enable_apache,
bind_address => $bind_address,
fqdn => $fqdn,
servername => $servername,
diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp
index dd96ce0..e655abb 100644
--- a/manifests/wsgi/apache.pp
+++ b/manifests/wsgi/apache.pp
@@ -35,6 +35,8 @@
# (optional) A hash of extra paramaters for apache::wsgi class.
# Defaults to {}
class horizon::wsgi::apache (
+ $manage_service = true,
+ $enabled = true,
$bind_address = undef,
$fqdn = $::fqdn,
$servername = $::fqdn,
@@ -54,6 +56,14 @@ class horizon::wsgi::apache (
include ::horizon::params
include ::apache
+ if $manage_service {
+ if $enabled {
+ $service_ensure = 'running'
+ } else {
+ $service_ensure = 'stopped'
+ }
+ }
+
if $::osfamily == 'RedHat' {
class { 'apache::mod::wsgi':
wsgi_socket_prefix => '/var/run/wsgi'
diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb
index 759c073..c5d0984 100644
--- a/spec/classes/horizon_init_spec.rb
+++ b/spec/classes/horizon_init_spec.rb
@@ -7,10 +7,6 @@ describe 'horizon' do
'fqdn' => '*' }
end
- let :pre_condition do
- 'include apache'
- end
-
let :fixtures_path do
File.expand_path(File.join(__FILE__, '..', '..', 'fixtures'))
end
diff --git a/spec/classes/horizon_wsgi_apache_spec.rb b/spec/classes/horizon_wsgi_apache_spec.rb
index c9c339e..9330447 100644
--- a/spec/classes/horizon_wsgi_apache_spec.rb
+++ b/spec/classes/horizon_wsgi_apache_spec.rb
@@ -11,7 +11,6 @@ describe 'horizon::wsgi::apache' do
end
let :pre_condition do
- "include apache\n" +
"class { 'horizon': secret_key => 's3cr3t', configure_apache => false }"
end
--
1.9.3