foreman_monitoring 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/models/concerns/foreman_monitoring/host_extensions.rb +5 -2
- data/db/migrate/20221026065954_fix_monitoring_settings_category_to_dsl.rb +9 -0
- data/lib/foreman_monitoring/engine.rb +23 -11
- data/lib/foreman_monitoring/version.rb +1 -1
- data/test/test_plugin_helper.rb +0 -4
- data/test/unit/host_status/monitoring_status_test.rb +0 -1
- data/test/unit/host_test.rb +0 -1
- data/test/unit/monitoring_result_test.rb +0 -1
- data/test/unit/monitoring_test.rb +0 -1
- metadata +12 -12
- data/app/models/setting/monitoring.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bba72edc0a48bb00f5818a0662ef643ea892cef4f457b474fd35332471bf1751
|
4
|
+
data.tar.gz: b62364ba84ac51878993cd2d6d7be654cfb10aa2c2a565b2ec71f6dc38f933a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d0834a1dc76d2009dc1bd1bbd35c0fbcfc166e1b1206c87a3ba1fd7d8543c693d22550cd899129b41d9dcbf76d0a379ab7c0ef6a7d83e2ffa1960c0b8ec3a2
|
7
|
+
data.tar.gz: 8715c42a9d55a3f491a860373c74dcda03351be2752a14e2dc798781f1ab807b55ff332822ead436637b1d479702920cbe9c19b6b30bff4844418acbe3d8611f
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ module ForemanMonitoring
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def monitoring_attributes
|
59
|
-
{
|
59
|
+
attributes = {
|
60
60
|
:ip => ip,
|
61
61
|
:ip6 => ip6,
|
62
62
|
:architecture => architecture.try(:name),
|
@@ -69,9 +69,12 @@ module ForemanMonitoring
|
|
69
69
|
:organization => organization.try(:name),
|
70
70
|
:location => location.try(:name),
|
71
71
|
:comment => comment,
|
72
|
-
:environment => environment.try(:to_s),
|
73
72
|
:owner_name => owner.try(:name)
|
74
73
|
}
|
74
|
+
|
75
|
+
attributes[:environment] = environment.try(:to_s) if defined?(ForemanPuppet)
|
76
|
+
|
77
|
+
attributes
|
75
78
|
end
|
76
79
|
|
77
80
|
private
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class FixMonitoringSettingsCategoryToDsl < ActiveRecord::Migration[6.0]
|
4
|
+
def up
|
5
|
+
# rubocop:disable Rails/SkipsModelValidations
|
6
|
+
Setting.where(category: 'Setting::Monitoring').update_all(category: 'Setting')
|
7
|
+
# rubocop:enable Rails/SkipsModelValidations
|
8
|
+
end
|
9
|
+
end
|
@@ -18,19 +18,31 @@ module ForemanMonitoring
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
initializer 'foreman_monitoring.load_default_settings',
|
22
|
-
:before => :load_config_initializers do |_app|
|
23
|
-
setting_table_exists = begin
|
24
|
-
Setting.table_exists?
|
25
|
-
rescue StandardError
|
26
|
-
false
|
27
|
-
end
|
28
|
-
require_dependency File.expand_path('../../app/models/setting/monitoring.rb', __dir__) if setting_table_exists
|
29
|
-
end
|
30
|
-
|
31
21
|
initializer 'foreman_monitoring.register_plugin', :before => :finisher_hook do |_app|
|
32
22
|
Foreman::Plugin.register :foreman_monitoring do
|
33
|
-
requires_foreman '>=
|
23
|
+
requires_foreman '>= 3.0'
|
24
|
+
|
25
|
+
settings do
|
26
|
+
category(:monitoring, N_('Monitoring')) do
|
27
|
+
setting('monitoring_affect_global_status',
|
28
|
+
type: :boolean,
|
29
|
+
description: N_("Monitoring status will affect a host's global status when enabled"),
|
30
|
+
default: true,
|
31
|
+
full_name: N_('Monitoring status should affect global status'))
|
32
|
+
setting('monitoring_create_action',
|
33
|
+
type: :string,
|
34
|
+
description: N_('What action should be taken when a host is created'),
|
35
|
+
default: 'create',
|
36
|
+
full_name: N_('Host Create Action'),
|
37
|
+
collection: proc { ::Monitoring::CREATE_ACTIONS })
|
38
|
+
setting('monitoring_delete_action',
|
39
|
+
type: :string,
|
40
|
+
description: N_('What action should be taken when a host is deleted'),
|
41
|
+
default: 'delete',
|
42
|
+
full_name: N_('Host Delete Action'),
|
43
|
+
collection: proc { ::Monitoring::DELETE_ACTIONS })
|
44
|
+
end
|
45
|
+
end
|
34
46
|
|
35
47
|
apipie_documented_controllers ["#{ForemanMonitoring::Engine.root}/app/controllers/api/v2/*.rb"]
|
36
48
|
|
data/test/test_plugin_helper.rb
CHANGED
@@ -11,10 +11,6 @@ FactoryBot.reload
|
|
11
11
|
# Foreman's setup doesn't handle cleaning up for Minitest::Spec
|
12
12
|
DatabaseCleaner.strategy = :transaction
|
13
13
|
|
14
|
-
def setup_settings
|
15
|
-
Setting::Monitoring.load_defaults
|
16
|
-
end
|
17
|
-
|
18
14
|
def disable_monitoring_orchestration
|
19
15
|
ProxyAPI::Monitoring.any_instance.stubs(:query_host).returns({})
|
20
16
|
end
|
data/test/unit/host_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Goebel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -115,7 +115,6 @@ files:
|
|
115
115
|
- app/models/concerns/orchestration/monitoring.rb
|
116
116
|
- app/models/host_status/monitoring_status.rb
|
117
117
|
- app/models/monitoring_result.rb
|
118
|
-
- app/models/setting/monitoring.rb
|
119
118
|
- app/overrides/add_host_monitoring_result_tab.rb
|
120
119
|
- app/overrides/add_host_multiple_power_set_downtime_checkbox.rb
|
121
120
|
- app/overrides/add_host_set_downtime_modal.rb
|
@@ -131,6 +130,7 @@ files:
|
|
131
130
|
- db/migrate/20160817135723_create_monitoring_results.rb
|
132
131
|
- db/migrate/20161220201510_add_monitoring_proxy_id_to_host_and_hostgroup.rb
|
133
132
|
- db/migrate/201910180900_rename_downtime_host_permission.rb
|
133
|
+
- db/migrate/20221026065954_fix_monitoring_settings_category_to_dsl.rb
|
134
134
|
- db/seeds.d/60-monitoring_proxy_feature.rb
|
135
135
|
- lib/foreman_monitoring.rb
|
136
136
|
- lib/foreman_monitoring/engine.rb
|
@@ -156,7 +156,7 @@ homepage: https://github.com/theforeman/foreman_monitoring
|
|
156
156
|
licenses:
|
157
157
|
- GPL-3.0
|
158
158
|
metadata: {}
|
159
|
-
post_install_message:
|
159
|
+
post_install_message:
|
160
160
|
rdoc_options: []
|
161
161
|
require_paths:
|
162
162
|
- lib
|
@@ -171,20 +171,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
175
|
-
signing_key:
|
174
|
+
rubygems_version: 3.2.33
|
175
|
+
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Foreman plugin for monitoring system integration.
|
178
178
|
test_files:
|
179
|
+
- test/controllers/api/v2/downtime_controller_test.rb
|
180
|
+
- test/factories/feature.rb
|
179
181
|
- test/factories/host.rb
|
180
182
|
- test/factories/monitoring_results.rb
|
181
183
|
- test/factories/smart_proxy.rb
|
182
|
-
- test/factories/feature.rb
|
183
|
-
- test/lib/proxy_api/monitoring_test.rb
|
184
184
|
- test/functional/hosts_controller_test.rb
|
185
|
-
- test/
|
185
|
+
- test/lib/proxy_api/monitoring_test.rb
|
186
186
|
- test/test_plugin_helper.rb
|
187
|
-
- test/unit/
|
187
|
+
- test/unit/host_status/monitoring_status_test.rb
|
188
188
|
- test/unit/host_test.rb
|
189
|
+
- test/unit/monitoring_result_test.rb
|
189
190
|
- test/unit/monitoring_test.rb
|
190
|
-
- test/unit/host_status/monitoring_status_test.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Setting
|
4
|
-
class Monitoring < ::Setting
|
5
|
-
def self.default_settings
|
6
|
-
[
|
7
|
-
set('monitoring_affect_global_status',
|
8
|
-
_("Monitoring status will affect a host's global status when enabled"),
|
9
|
-
true, N_('Monitoring status should affect global status')),
|
10
|
-
set('monitoring_create_action',
|
11
|
-
_('What action should be taken when a host is created'),
|
12
|
-
'create', N_('Host Create Action'), nil, :collection => proc { ::Monitoring::CREATE_ACTIONS }),
|
13
|
-
set('monitoring_delete_action',
|
14
|
-
_('What action should be taken when a host is deleted'),
|
15
|
-
'delete', N_('Host Delete Action'), nil, :collection => proc { ::Monitoring::DELETE_ACTIONS })
|
16
|
-
]
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.load_defaults
|
20
|
-
# Check the table exists
|
21
|
-
return unless super
|
22
|
-
|
23
|
-
self.transaction do
|
24
|
-
default_settings.each { |s| self.create! s.update(:category => 'Setting::Monitoring') }
|
25
|
-
end
|
26
|
-
|
27
|
-
true
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.humanized_category
|
31
|
-
N_('Monitoring')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|