foreman_discovery 18.0.0 → 18.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/foreman/controller/parameters/discovered_host.rb +16 -4
- data/app/controllers/discovered_hosts_controller.rb +3 -0
- data/app/controllers/discovery_rules_controller.rb +1 -1
- data/app/services/foreman_discovery/subnet_suggestion.rb +8 -1
- data/lib/foreman_discovery/engine.rb +3 -2
- data/lib/foreman_discovery/version.rb +1 -1
- data/test/functional/api/v2/discovered_hosts_controller_test.rb +5 -3
- data/test/functional/discovered_hosts_controller_test.rb +5 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6708c354c29e3e5f53cf0368d5e3fbaa2b478a61f54c8fd93a321e24f45df7
|
4
|
+
data.tar.gz: f1ba15c2d1c069dd694ec9356765c78eb58b8b1fb9b41f28d5d33722c074017b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 910af2e79a1ddde6022df9a851eabc357da0f79e2d7bae2c1106c8413cab21b70dd9a1e6b0f5c66ecedb2c39a3a768f19f071962b9d28a46e66556489f374fe0
|
7
|
+
data.tar.gz: ff026ad7368f99a13e847263771c8f5e53ae6f9ee756b52d2ea3cb51b61219f6184f2600d216c534fe74c8c19dcb807e8c146881083c78a98adecb5a4ad74eb3
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Foreman::Controller::Parameters::DiscoveredHost
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
include Foreman::Controller::Parameters::Host
|
4
|
+
if defined?(ForemanPuppet)
|
5
|
+
include ForemanPuppet::Extensions::ParametersHost
|
6
|
+
end
|
4
7
|
|
5
8
|
class_methods do
|
6
9
|
def discovered_host_params_filter
|
@@ -9,23 +12,32 @@ module Foreman::Controller::Parameters::DiscoveredHost
|
|
9
12
|
|
10
13
|
add_host_base_params_filter(filter)
|
11
14
|
add_host_common_params_filter(filter)
|
15
|
+
add_host_puppet_params_filter(filter) if defined?(ForemanPuppet)
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
16
20
|
def discovered_host_params
|
17
|
-
self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context)
|
21
|
+
filtered_params = self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context)
|
22
|
+
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
|
23
|
+
filtered_params
|
18
24
|
end
|
19
25
|
|
20
26
|
def discovered_host_params_host
|
21
|
-
self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context, :host)
|
27
|
+
filtered_params = self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context, :host)
|
28
|
+
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
|
29
|
+
filtered_params
|
22
30
|
end
|
23
31
|
|
24
32
|
def managed_host_params_host
|
25
|
-
self.class.host_params_filter.filter_params(params, parameter_filter_context, :host)
|
33
|
+
filtered_params = self.class.host_params_filter.filter_params(params, parameter_filter_context, :host)
|
34
|
+
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
|
35
|
+
filtered_params
|
26
36
|
end
|
27
37
|
|
28
38
|
def managed_host_params
|
29
|
-
self.class.host_params_filter.filter_params(params, parameter_filter_context)
|
39
|
+
filtered_params = self.class.host_params_filter.filter_params(params, parameter_filter_context)
|
40
|
+
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
|
41
|
+
filtered_params
|
30
42
|
end
|
31
43
|
end
|
@@ -15,7 +15,10 @@ class DiscoveredHostsController < ::ApplicationController
|
|
15
15
|
|
16
16
|
helper :hosts
|
17
17
|
if defined?(ForemanPuppet)
|
18
|
+
helper ForemanPuppet::HostsHelper
|
18
19
|
helper ForemanPuppet::HostsAndHostgroupsHelper
|
20
|
+
helper ForemanPuppet::PuppetclassesHelper
|
21
|
+
helper ForemanPuppet::PuppetclassLookupKeysHelper
|
19
22
|
end
|
20
23
|
|
21
24
|
layout 'layouts/application'
|
@@ -20,7 +20,7 @@ class DiscoveryRulesController < ApplicationController
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def clone
|
23
|
-
@discovery_rule = @discovery_rule.deep_clone except: [:name, :priority]
|
23
|
+
@discovery_rule = @discovery_rule.deep_clone except: [:name, :priority], include: [:organizations, :locations]
|
24
24
|
@discovery_rule.priority = DiscoveryRule.suggest_priority
|
25
25
|
end
|
26
26
|
|
@@ -14,7 +14,14 @@ module ForemanDiscovery
|
|
14
14
|
def call
|
15
15
|
return unless ip
|
16
16
|
|
17
|
-
|
17
|
+
begin
|
18
|
+
subnet = Subnet.unscoped.subnet_for(ip)
|
19
|
+
rescue Exception => e
|
20
|
+
Rails.logger.error "Error while detecting subnet for IP #{ip}"
|
21
|
+
Foreman::Logging.exception "Unable to detect subnet", e
|
22
|
+
subnet = nil
|
23
|
+
end
|
24
|
+
|
18
25
|
if subnet
|
19
26
|
Rails.logger.info "Detected #{kind} subnet: #{subnet} with taxonomy #{subnet.organizations.collect(&:name)}/#{subnet.locations.collect(&:name)}"
|
20
27
|
else
|
@@ -126,14 +126,12 @@ module ForemanDiscovery
|
|
126
126
|
:assign_locations,
|
127
127
|
:view_architectures,
|
128
128
|
:view_domains,
|
129
|
-
:view_environments,
|
130
129
|
:view_hostgroups,
|
131
130
|
:view_media,
|
132
131
|
:view_models,
|
133
132
|
:view_operatingsystems,
|
134
133
|
:view_provisioning_templates,
|
135
134
|
:view_ptables,
|
136
|
-
:view_puppetclasses,
|
137
135
|
:view_realms,
|
138
136
|
:view_smart_proxies,
|
139
137
|
:view_subnets,
|
@@ -149,6 +147,9 @@ module ForemanDiscovery
|
|
149
147
|
:edit_discovery_rules,
|
150
148
|
:destroy_discovery_rules,
|
151
149
|
]
|
150
|
+
if defined?(ForemanPuppet::VERSION)
|
151
|
+
MANAGER += [ :view_environments, :view_puppetclasses ]
|
152
|
+
end
|
152
153
|
role "Discovery Reader", READER, "Role granting permissions to view discovered hosts"
|
153
154
|
role "Discovery Manager", MANAGER, "Role granting permissions to perform provisioning of discovered hosts"
|
154
155
|
|
@@ -83,9 +83,11 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
83
83
|
assert_equal hostgroup.medium_id, actual.medium_id
|
84
84
|
assert_equal hostgroup.ptable_id, actual.ptable_id
|
85
85
|
assert_equal hostgroup.domain_id, actual.domain_id
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
if defined?(ForemanPuppet)
|
87
|
+
assert_equal hostgroup.environment_id, actual.environment_id
|
88
|
+
assert_equal hostgroup.puppet_proxy_id, actual.puppet_proxy_id
|
89
|
+
assert_equal hostgroup.puppet_ca_proxy_id, actual.puppet_ca_proxy_id
|
90
|
+
end
|
89
91
|
assert actual.build?
|
90
92
|
end
|
91
93
|
|
@@ -161,9 +161,11 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
161
161
|
assert_equal hostgroup.medium_id, actual.medium_id
|
162
162
|
assert_equal hostgroup.ptable_id, actual.ptable_id
|
163
163
|
assert_equal hostgroup.domain_id, actual.domain_id
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
if defined?(ForemanPuppet)
|
165
|
+
assert_equal hostgroup.environment_id, actual.environment_id
|
166
|
+
assert_equal hostgroup.puppet_proxy_id, actual.puppet_proxy_id
|
167
|
+
assert_equal hostgroup.puppet_ca_proxy_id, actual.puppet_ca_proxy_id
|
168
|
+
end
|
167
169
|
end
|
168
170
|
|
169
171
|
def test_add_entry_to_nav_menu
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_discovery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 18.0.
|
4
|
+
version: 18.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditi Puntambekar
|
@@ -74,7 +74,7 @@ authors:
|
|
74
74
|
autorequire:
|
75
75
|
bindir: bin
|
76
76
|
cert_chain: []
|
77
|
-
date: 2021-
|
77
|
+
date: 2021-11-23 00:00:00.000000000 Z
|
78
78
|
dependencies: []
|
79
79
|
description: MaaS Discovery Plugin engine for Foreman
|
80
80
|
email: gsutclif@redhat.com
|
@@ -360,12 +360,12 @@ test_files:
|
|
360
360
|
- test/unit/discovered_mailer_test.rb
|
361
361
|
- test/unit/discovery_taxonomy_extensions_test.rb
|
362
362
|
- test/unit/lldp_neighbors_test.rb
|
363
|
-
- test/unit/host_discovered_test.rb
|
364
363
|
- test/unit/discovery_rule_test.rb
|
365
364
|
- test/unit/fact_to_category_resolver_test.rb
|
366
365
|
- test/unit/managed_extensions_test.rb
|
366
|
+
- test/unit/host_discovered_test.rb
|
367
|
+
- test/unit/discovered_extensions_test.rb
|
367
368
|
- test/unit/discovery_attribute_set_test.rb
|
368
369
|
- test/unit/fact_parser_test.rb
|
369
|
-
- test/unit/discovered_extensions_test.rb
|
370
370
|
- test/test_helper_discovery.rb
|
371
371
|
- test/test_plugin_helper.rb
|