Blob Blame History Raw
From 2b5669f84bbcee825807c421b5a1fc007c45c121 Mon Sep 17 00:00:00 2001
From: Martin Magr <mmagr@redhat.com>
Date: Wed, 20 Aug 2014 18:03:45 +0200
Subject: [PATCH] Add manage_service feature

puppet-heat lacks of disabling service managing. This patch adds
$manage_service parameter to all relevant classes.

Closes-bug: #1359823
Change-Id: I54245b39f3484ccdb9910aa0fa4c8dc2bae3f0ce
---
 manifests/api.pp            | 11 +++++++----
 manifests/api_cfn.pp        | 11 +++++++----
 manifests/api_cloudwatch.pp | 12 ++++++++----
 manifests/engine.pp         | 11 +++++++----
 4 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/manifests/api.pp b/manifests/api.pp
index ef4e454..9e418a1 100644
--- a/manifests/api.pp
+++ b/manifests/api.pp
@@ -1,6 +1,7 @@
 # Installs & configure the heat API service
 
 class heat::api (
+  $manage_service    = true,
   $enabled           = true,
   $bind_host         = '0.0.0.0',
   $bind_port         = '8004',
@@ -20,10 +21,12 @@ class heat::api (
     name   => $::heat::params::api_package_name,
   }
 
-  if $enabled {
-    $service_ensure = 'running'
-  } else {
-    $service_ensure = 'stopped'
+  if $manage_service {
+    if $enabled {
+      $service_ensure = 'running'
+    } else {
+      $service_ensure = 'stopped'
+    }
   }
 
   service { 'heat-api':
diff --git a/manifests/api_cfn.pp b/manifests/api_cfn.pp
index 41c4d37..1e259ea 100644
--- a/manifests/api_cfn.pp
+++ b/manifests/api_cfn.pp
@@ -1,6 +1,7 @@
 # Installs & configure the heat CloudFormation API service
 
 class heat::api_cfn (
+  $manage_service    = true,
   $enabled           = true,
   $bind_host         = '0.0.0.0',
   $bind_port         = '8000',
@@ -19,10 +20,12 @@ class heat::api_cfn (
     name   => $::heat::params::api_cfn_package_name,
   }
 
-  if $enabled {
-    $service_ensure = 'running'
-  } else {
-    $service_ensure = 'stopped'
+  if $manage_service {
+    if $enabled {
+      $service_ensure = 'running'
+    } else {
+      $service_ensure = 'stopped'
+    }
   }
 
   Package['heat-common'] -> Service['heat-api-cfn']
diff --git a/manifests/api_cloudwatch.pp b/manifests/api_cloudwatch.pp
index ac4e7c8..b288dd5 100644
--- a/manifests/api_cloudwatch.pp
+++ b/manifests/api_cloudwatch.pp
@@ -1,6 +1,7 @@
 # Installs & configure the heat CloudWatch API service
 
 class heat::api_cloudwatch (
+  $manage_service    = true,
   $enabled           = true,
   $bind_host         = '0.0.0.0',
   $bind_port         = '8003',
@@ -19,12 +20,15 @@ class heat::api_cloudwatch (
     name   => $::heat::params::api_cloudwatch_package_name,
   }
 
-  if $enabled {
-    $service_ensure = 'running'
-  } else {
-    $service_ensure = 'stopped'
+  if $manage_service {
+    if $enabled {
+      $service_ensure = 'running'
+    } else {
+      $service_ensure = 'stopped'
+    }
   }
 
+
   Package['heat-common'] -> Service['heat-api-cloudwatch']
 
   service { 'heat-api-cloudwatch':
diff --git a/manifests/engine.pp b/manifests/engine.pp
index c5fa882..e1f40f7 100644
--- a/manifests/engine.pp
+++ b/manifests/engine.pp
@@ -34,6 +34,7 @@
 
 class heat::engine (
   $auth_encryption_key,
+  $manage_service                = true,
   $enabled                       = true,
   $heat_stack_user_role          = 'heat_stack_user',
   $heat_metadata_server_url      = 'http://127.0.0.1:8000',
@@ -53,10 +54,12 @@ class heat::engine (
     name   => $::heat::params::engine_package_name,
   }
 
-  if $enabled {
-    $service_ensure = 'running'
-  } else {
-    $service_ensure = 'stopped'
+  if $manage_service {
+    if $enabled {
+      $service_ensure = 'running'
+    } else {
+      $service_ensure = 'stopped'
+    }
   }
 
   service { 'heat-engine':
-- 
1.9.3