From 51da4c48b82564ed3e5080e0d0b7920dcd61e168 Mon Sep 17 00:00:00 2001
From: Takashi Kajinami <kajinamit@oss.nttdata.com>
Date: Thu, 25 Jul 2024 22:44:33 +0900
Subject: [PATCH] Add support for [healthcheck] enable_by_file_paths

Depends-on: https://review.opendev.org/923648
Change-Id: I964ac7cc60c0a83dc800cde1e67b524cd64f2023
---
 manifests/healthcheck.pp                                   | 7 +++++++
 .../notes/hc-enable_by_file_paths-be1bd2c96e55168f.yaml    | 5 +++++
 spec/classes/mistral_healthcheck_spec.rb                   | 3 +++
 3 files changed, 15 insertions(+)
 create mode 100644 releasenotes/notes/hc-enable_by_file_paths-be1bd2c96e55168f.yaml

diff --git a/manifests/healthcheck.pp b/manifests/healthcheck.pp
index 8dbcd52..43dde16 100644
--- a/manifests/healthcheck.pp
+++ b/manifests/healthcheck.pp
@@ -36,6 +36,11 @@
 #   is running on a port. Expects a "port:path" list of strings.
 #   Defaults to $facts['os_service_default']
 #
+# [*enable_by_file_paths*]
+#   (Optional) Check the presence of files. Used by EnableByFilesHealthcheck
+#   plugin.
+#   Defaults to $facts['os_service_default']
+#
 class mistral::healthcheck (
   $enabled                 = $facts['os_service_default'],
   $detailed                = $facts['os_service_default'],
@@ -44,6 +49,7 @@ class mistral::healthcheck (
   $ignore_proxied_requests = $facts['os_service_default'],
   $disable_by_file_path    = $facts['os_service_default'],
   $disable_by_file_paths   = $facts['os_service_default'],
+  $enable_by_file_paths    = $facts['os_service_default'],
 ) {
 
   include mistral::deps
@@ -59,5 +65,6 @@ class mistral::healthcheck (
     ignore_proxied_requests => $ignore_proxied_requests,
     disable_by_file_path    => $disable_by_file_path,
     disable_by_file_paths   => $disable_by_file_paths,
+    enable_by_file_paths    => $enable_by_file_paths,
   }
 }
diff --git a/releasenotes/notes/hc-enable_by_file_paths-be1bd2c96e55168f.yaml b/releasenotes/notes/hc-enable_by_file_paths-be1bd2c96e55168f.yaml
new file mode 100644
index 0000000..43b471f
--- /dev/null
+++ b/releasenotes/notes/hc-enable_by_file_paths-be1bd2c96e55168f.yaml
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    The new ``mistral::healthcheck::enable_by_file_paths`` parameter has been
+    added.
diff --git a/spec/classes/mistral_healthcheck_spec.rb b/spec/classes/mistral_healthcheck_spec.rb
index 95c70c9..80b3c77 100644
--- a/spec/classes/mistral_healthcheck_spec.rb
+++ b/spec/classes/mistral_healthcheck_spec.rb
@@ -19,6 +19,7 @@ describe 'mistral::healthcheck' do
           :ignore_proxied_requests => '<SERVICE DEFAULT>',
           :disable_by_file_path    => '<SERVICE DEFAULT>',
           :disable_by_file_paths   => '<SERVICE DEFAULT>',
+          :enable_by_file_paths    => '<SERVICE DEFAULT>',
         )
       end
     end
@@ -33,6 +34,7 @@ describe 'mistral::healthcheck' do
           :ignore_proxied_requests => false,
           :disable_by_file_path    => '/etc/mistral/healthcheck/disabled',
           :disable_by_file_paths   => ['8989:/etc/mistral/healthcheck/disabled'],
+          :enable_by_file_paths    => ['/etc/mistral/healthcheck/enabled'],
         }
       end
 
@@ -46,6 +48,7 @@ describe 'mistral::healthcheck' do
           :ignore_proxied_requests => false,
           :disable_by_file_path    => '/etc/mistral/healthcheck/disabled',
           :disable_by_file_paths   => ['8989:/etc/mistral/healthcheck/disabled'],
+          :enable_by_file_paths    => ['/etc/mistral/healthcheck/enabled'],
         )
       end
     end