Browse Source

Correctly cleanup self-monitoring sandboxes

Change-Id: I88e794d7bbd4b056d86fcb6ca9a4cbf610370037
Swann Croiset 2 years ago
parent
commit
b19fd832da

+ 17
- 18
deployment_scripts/puppet/modules/lma_collector/manifests/heka.pp View File

@@ -118,24 +118,23 @@ define lma_collector::heka (
118 118
     $heka_monitoring_ensure = absent
119 119
   }
120 120
 
121
-  if $heka_monitoring {
122
-    heka::filter::sandbox { "heka_monitoring_${title}":
123
-      ensure           => $heka_monitoring_ensure,
124
-      config_dir       => $config_dir,
125
-      filename         => "${lma_collector::params::plugins_dir}/filters/heka_monitoring.lua",
126
-      message_matcher  => "Type == 'heka.all-report'",
127
-      require          => ::Heka[$title],
128
-      module_directory => $lua_modules_dir,
129
-      notify           => Class[$service_class],
130
-    }
121
+  heka::filter::sandbox { "heka_monitoring_${title}":
122
+    ensure           => $heka_monitoring_ensure,
123
+    config_dir       => $config_dir,
124
+    filename         => "${lma_collector::params::plugins_dir}/filters/heka_monitoring.lua",
125
+    message_matcher  => "Type == 'heka.all-report'",
126
+    require          => ::Heka[$title],
127
+    module_directory => $lua_modules_dir,
128
+    notify           => Class[$service_class],
129
+  }
131 130
 
132
-    # Dashboard is required to enable monitoring messages
133
-    heka::output::dashboard { "dashboard_${title}":
134
-      config_dir        => $config_dir,
135
-      dashboard_address => $lma_collector::params::dashboard_address,
136
-      dashboard_port    => $dashboard_port,
137
-      require           => ::Heka[$title],
138
-      notify            => Class[$service_class],
139
-    }
131
+  # Dashboard is required to enable monitoring messages
132
+  heka::output::dashboard { "dashboard_${title}":
133
+    ensure            => $heka_monitoring_ensure,
134
+    config_dir        => $config_dir,
135
+    dashboard_address => $lma_collector::params::dashboard_address,
136
+    dashboard_port    => $dashboard_port,
137
+    require           => ::Heka[$title],
138
+    notify            => Class[$service_class],
140 139
   }
141 140
 }

+ 6
- 2
deployment_scripts/puppet/modules/lma_collector/spec/defines/lma_collector_heka_spec.rb View File

@@ -67,8 +67,12 @@ describe 'lma_collector::heka' do
67 67
             )
68 68
             should contain_heka__input__tcp('metric')
69 69
             should contain_heka__decoder__sandbox('metric' )
70
-            is_expected.to_not contain_heka__filter__sandbox('heka_monitoring_metric_collector')
71
-            is_expected.to_not contain_heka__output__dashboard('dashboard_metric_collector' )
70
+            should contain_heka__filter__sandbox('heka_monitoring_metric_collector').with(
71
+              'ensure' => 'absent'
72
+            )
73
+            should contain_heka__output__dashboard('dashboard_metric_collector' ).with(
74
+              'ensure' => 'absent'
75
+            )
72 76
         }
73 77
     end
74 78
 end

Loading…
Cancel
Save