foreman_discovery 16.1.0 → 16.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/discovered_hosts_controller.rb +5 -3
- data/app/models/host/discovered.rb +22 -26
- data/app/models/host/managed_extensions.rb +2 -2
- data/app/models/setting/discovered.rb +3 -1
- data/app/services/foreman_discovery/host_converter.rb +14 -6
- data/app/services/foreman_discovery/host_fact_importer.rb +10 -0
- data/app/services/foreman_discovery/node_api/node_resource.rb +1 -0
- data/app/views/discovered_hosts/_discovered_host_modal.html.erb +0 -2
- data/app/views/foreman_discovery/debian_kexec.erb +2 -1
- data/app/views/foreman_discovery/redhat_kexec.erb +2 -1
- data/extra/discover-host +14 -8
- data/lib/foreman_discovery/engine.rb +1 -1
- data/lib/foreman_discovery/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ca/foreman_discovery.edit.po +146 -216
- data/locale/ca/foreman_discovery.po +4 -1
- data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/de/foreman_discovery.edit.po +144 -215
- data/locale/de/foreman_discovery.po +4 -1
- data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en/foreman_discovery.edit.po +76 -72
- data/locale/en/foreman_discovery.po +4 -1
- data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en_GB/foreman_discovery.edit.po +146 -216
- data/locale/en_GB/foreman_discovery.po +4 -1
- data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/es/foreman_discovery.edit.po +146 -216
- data/locale/es/foreman_discovery.po +4 -1
- data/locale/foreman_discovery.pot +77 -73
- data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/fr/foreman_discovery.edit.po +144 -215
- data/locale/fr/foreman_discovery.po +4 -1
- data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/gl/foreman_discovery.edit.po +146 -216
- data/locale/gl/foreman_discovery.po +4 -1
- data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/it/foreman_discovery.edit.po +146 -216
- data/locale/it/foreman_discovery.po +4 -1
- data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ja/foreman_discovery.edit.po +149 -216
- data/locale/ja/foreman_discovery.po +4 -1
- data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ko/foreman_discovery.edit.po +147 -215
- data/locale/ko/foreman_discovery.po +4 -1
- data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/pt_BR/foreman_discovery.edit.po +146 -216
- data/locale/pt_BR/foreman_discovery.po +4 -1
- data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ru/foreman_discovery.edit.po +149 -219
- data/locale/ru/foreman_discovery.po +4 -1
- data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/sv_SE/foreman_discovery.edit.po +146 -216
- data/locale/sv_SE/foreman_discovery.po +4 -1
- data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_CN/foreman_discovery.edit.po +149 -216
- data/locale/zh_CN/foreman_discovery.po +4 -1
- data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_TW/foreman_discovery.edit.po +149 -216
- data/locale/zh_TW/foreman_discovery.po +4 -1
- data/test/facts/only-ipv6.json +205 -0
- data/test/facts/skylake-ipv6.json +223 -0
- data/test/functional/api/v2/settings_controller_test.rb +2 -2
- data/test/functional/discovered_hosts_controller_test.rb +17 -8
- data/test/unit/discovered_extensions_test.rb +1 -0
- data/test/unit/host_discovered_test.rb +0 -16
- data/test/unit/managed_extensions_test.rb +1 -0
- metadata +33 -28
@@ -8,7 +8,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
8
8
|
setup do
|
9
9
|
assert discovered_notification_blueprint
|
10
10
|
@request.env['HTTP_REFERER'] = '/discovery_rules'
|
11
|
-
FactoryBot.create(:subnet, :network => "192.168.100.1", :mask => "255.255.255.0", :locations => [location_one], :organizations => [organization_one])
|
11
|
+
FactoryBot.create(:subnet, :dhcp, :network => "192.168.100.1", :mask => "255.255.255.0", :locations => [location_one], :organizations => [organization_one])
|
12
12
|
@facts = {
|
13
13
|
"interfaces" => "lo,eth0",
|
14
14
|
"ipaddress" => "192.168.100.42",
|
@@ -115,7 +115,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
115
115
|
} }, session: set_session_user_default_manager
|
116
116
|
# all inherit buttons are pressed
|
117
117
|
assert_select('button[name=is_overridden_btn]') do |e|
|
118
|
-
e.attribute("class") =~ /active/
|
118
|
+
e.attribute("class").to_s =~ /active/
|
119
119
|
end
|
120
120
|
# particular fields are set
|
121
121
|
assert_select '#host_hostgroup_id [selected]' do |e|
|
@@ -140,6 +140,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
140
140
|
|
141
141
|
def test_update_inheritance
|
142
142
|
host = discover_host_from_facts(@facts)
|
143
|
+
ForemanDiscovery::HostConverter.stubs(:unused_ip_for_subnet).returns(host.ip)
|
143
144
|
hostgroup = setup_hostgroup(host)
|
144
145
|
put :update, params: {
|
145
146
|
commit: 'Update',
|
@@ -183,10 +184,10 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
183
184
|
def test_reboot_failure
|
184
185
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
185
186
|
host = discover_host_from_facts(@facts)
|
186
|
-
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).
|
187
|
+
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
|
187
188
|
post :reboot, params: { :id => host.id }, session: set_session_user_default_manager
|
188
189
|
assert_redirected_to discovered_hosts_url
|
189
|
-
|
190
|
+
assert_match(/ERF42-4036/, flash[:error])
|
190
191
|
end
|
191
192
|
|
192
193
|
def test_reboot_error
|
@@ -195,7 +196,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
195
196
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
|
196
197
|
post :reboot, params: { :id => host.id }, session: set_session_user_default_manager
|
197
198
|
assert_redirected_to discovered_hosts_url
|
198
|
-
assert_match(/
|
199
|
+
assert_match(/ERF42-4036/, flash[:error])
|
199
200
|
end
|
200
201
|
|
201
202
|
def test_auto_provision_success
|
@@ -271,10 +272,10 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
271
272
|
def test_multiple_reboot_failure
|
272
273
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
273
274
|
host = discover_host_from_facts(@facts)
|
274
|
-
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).
|
275
|
+
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
|
275
276
|
post :submit_multiple_reboot, params: {:host_ids => host.id}, session: set_session_user(User.current)
|
276
277
|
assert_redirected_to discovered_hosts_url
|
277
|
-
|
278
|
+
assert_match(/ERF42-4036/, flash[:error])
|
278
279
|
assert_nil flash[:success]
|
279
280
|
end
|
280
281
|
|
@@ -284,12 +285,15 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
284
285
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
|
285
286
|
post :submit_multiple_reboot, params: {:host_ids => host.id}, session: set_session_user(User.current)
|
286
287
|
assert_redirected_to discovered_hosts_url
|
287
|
-
assert_match(/
|
288
|
+
assert_match(/ERF42-4036/, flash[:error])
|
288
289
|
assert_nil flash[:success]
|
289
290
|
end
|
290
291
|
|
291
292
|
def test_no_dns_rebuild_if_dns_pending
|
292
293
|
host = discover_host_from_facts(@facts)
|
294
|
+
ForemanDiscovery::HostConverter.stubs(:unused_ip_for_subnet).returns(host.ip)
|
295
|
+
Nic::Managed.any_instance.stubs(:dhcp_update_required?).returns(false)
|
296
|
+
Net::DHCP::Record.any_instance.stubs(:conflicting?).returns(false)
|
293
297
|
hostgroup = prepare_hostgroup_for_dns_rebuild(host)
|
294
298
|
Nic::Managed.any_instance.expects(:rebuild_dns).never
|
295
299
|
Host::Managed.any_instance.stubs(:skip_orchestration?).returns(false)
|
@@ -306,6 +310,9 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
306
310
|
|
307
311
|
def test_dns_rebuild
|
308
312
|
host = prepare_host_for_dns_rebuild
|
313
|
+
ForemanDiscovery::HostConverter.stubs(:unused_ip_for_subnet).returns(host.ip)
|
314
|
+
Nic::Managed.any_instance.stubs(:dhcp_update_required?).returns(false)
|
315
|
+
Net::DHCP::Record.any_instance.stubs(:conflicting?).returns(false)
|
309
316
|
hostgroup = prepare_hostgroup_for_dns_rebuild(host)
|
310
317
|
Nic::Managed.any_instance.expects(:rebuild_dns)
|
311
318
|
Host::Managed.any_instance.stubs(:skip_orchestration?).returns(false)
|
@@ -319,6 +326,8 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
319
326
|
|
320
327
|
def test_dns_rebuild_with_auto_provision
|
321
328
|
host = prepare_host_for_dns_rebuild
|
329
|
+
ForemanDiscovery::HostConverter.stubs(:unused_ip_for_subnet).returns(host.ip)
|
330
|
+
Nic::Managed.any_instance.stubs(:dhcp_update_required?).returns(false)
|
322
331
|
hostgroup = prepare_hostgroup_for_dns_rebuild(host)
|
323
332
|
Nic::Managed.any_instance.expects(:rebuild_dns)
|
324
333
|
Host::Managed.any_instance.stubs(:skip_orchestration?).returns(false)
|
@@ -9,6 +9,7 @@ class DiscoveredExtensionsTest < ActiveSupport::TestCase
|
|
9
9
|
@facts = facts_simple_network100_42
|
10
10
|
@facts_ipv6 = facts_network_2001_db8
|
11
11
|
set_default_settings
|
12
|
+
ProxyAPI::DHCP.any_instance.stubs(:record).returns(nil)
|
12
13
|
::ForemanDiscovery::HostConverter.stubs(:unused_ip_for_host)
|
13
14
|
end
|
14
15
|
|
@@ -260,12 +260,6 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
260
260
|
assert_equal 'teste41f13cc3658', host.name
|
261
261
|
end
|
262
262
|
|
263
|
-
test "should create discovered host without prefix" do
|
264
|
-
Setting[:discovery_prefix] = ''
|
265
|
-
host = discover_host_from_facts(@facts)
|
266
|
-
assert_equal 'e41f13cc3658',host.name
|
267
|
-
end
|
268
|
-
|
269
263
|
test "should refresh facts and NICs of an existing discovered host" do
|
270
264
|
host1 = discover_host_from_facts(@facts)
|
271
265
|
assert_equal 'mace41f13cc3658', host1.name
|
@@ -290,16 +284,6 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
290
284
|
assert_match(/Invalid facts: hash does not contain a valid value for any of the facts in the discovery_hostname setting:/, exception.message)
|
291
285
|
end
|
292
286
|
|
293
|
-
test "should raise when hostname cannot be computed due to normlization and no prefix" do
|
294
|
-
@facts['invalidhostnamefact'] = '...'
|
295
|
-
Setting[:discovery_hostname] = 'invalidhostnamefact'
|
296
|
-
Setting[:discovery_prefix] = ''
|
297
|
-
exception = assert_raises(::Foreman::Exception) do
|
298
|
-
discover_host_from_facts(@facts)
|
299
|
-
end
|
300
|
-
assert_match(/Invalid hostname: Could not normalize the hostname/, exception.message)
|
301
|
-
end
|
302
|
-
|
303
287
|
test 'discovered host can be searched in multiple taxonomies' do
|
304
288
|
org1 = FactoryBot.create(:organization)
|
305
289
|
org2 = FactoryBot.create(:organization)
|
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: 16.
|
4
|
+
version: 16.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditi Puntambekar
|
@@ -71,7 +71,7 @@ authors:
|
|
71
71
|
autorequire:
|
72
72
|
bindir: bin
|
73
73
|
cert_chain: []
|
74
|
-
date: 2020-
|
74
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
75
75
|
dependencies: []
|
76
76
|
description: MaaS Discovery Plugin engine for Foreman
|
77
77
|
email: gsutclif@redhat.com
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- app/models/setting/discovered.rb
|
107
107
|
- app/services/foreman_discovery/fact_parser.rb
|
108
108
|
- app/services/foreman_discovery/host_converter.rb
|
109
|
+
- app/services/foreman_discovery/host_fact_importer.rb
|
109
110
|
- app/services/foreman_discovery/import_hook.rb
|
110
111
|
- app/services/foreman_discovery/import_hook_service.rb
|
111
112
|
- app/services/foreman_discovery/import_hooks/discovery_attribute.rb
|
@@ -244,12 +245,14 @@ files:
|
|
244
245
|
- test/facts/dell_vlan.json
|
245
246
|
- test/facts/facts_with_lldp.json
|
246
247
|
- test/facts/facts_with_lldp_bond_candidate.json
|
248
|
+
- test/facts/only-ipv6.json
|
247
249
|
- test/facts/pxeless-vlan.json
|
248
250
|
- test/facts/regular_host.json
|
249
251
|
- test/facts/rhel-dl380-1kdisks.json
|
250
252
|
- test/facts/rhel-r730.json
|
251
253
|
- test/facts/rhel7-vlan.json
|
252
254
|
- test/facts/simple-bond.json
|
255
|
+
- test/facts/skylake-ipv6.json
|
253
256
|
- test/facts/suse-vmware.json
|
254
257
|
- test/facts/vmware_local.json
|
255
258
|
- test/functional/api/v2/discovered_hosts_controller_test.rb
|
@@ -294,47 +297,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
294
297
|
- !ruby/object:Gem::Version
|
295
298
|
version: '0'
|
296
299
|
requirements: []
|
297
|
-
rubygems_version: 3.
|
300
|
+
rubygems_version: 3.1.2
|
298
301
|
signing_key:
|
299
302
|
specification_version: 4
|
300
303
|
summary: MaaS Discovery Plugin for Foreman
|
301
304
|
test_files:
|
302
|
-
- test/
|
303
|
-
- test/
|
304
|
-
- test/functional/api/v2/discovered_hosts_controller_test.rb
|
305
|
-
- test/functional/api/v2/fact_value_extensions_test.rb
|
306
|
-
- test/functional/api/v2/settings_controller_test.rb
|
307
|
-
- test/functional/api/v2/discovery_rules_controller_test.rb
|
308
|
-
- test/functional/discovery_rules_controller_test.rb
|
309
|
-
- test/integration/discovered_hosts_test.rb
|
310
|
-
- test/test_plugin_helper.rb
|
311
|
-
- test/facts/facts_with_lldp.json
|
312
|
-
- test/facts/dell_vlan.json
|
305
|
+
- test/factories/discovery_host_related.rb
|
306
|
+
- test/factories/discovery_rule_related.rb
|
313
307
|
- test/facts/bond0-eth0-eth1-active-passive.json
|
314
|
-
- test/facts/
|
315
|
-
- test/facts/rhel-r730.json
|
308
|
+
- test/facts/default.json
|
316
309
|
- test/facts/dell_npars.json
|
310
|
+
- test/facts/dell_vlan.json
|
311
|
+
- test/facts/facts_with_lldp.json
|
312
|
+
- test/facts/facts_with_lldp_bond_candidate.json
|
317
313
|
- test/facts/pxeless-vlan.json
|
318
314
|
- test/facts/regular_host.json
|
319
|
-
- test/facts/facts_with_lldp_bond_candidate.json
|
320
|
-
- test/facts/rhel7-vlan.json
|
321
|
-
- test/facts/default.json
|
322
315
|
- test/facts/rhel-dl380-1kdisks.json
|
316
|
+
- test/facts/rhel-r730.json
|
317
|
+
- test/facts/rhel7-vlan.json
|
318
|
+
- test/facts/simple-bond.json
|
323
319
|
- test/facts/suse-vmware.json
|
324
320
|
- test/facts/vmware_local.json
|
321
|
+
- test/facts/only-ipv6.json
|
322
|
+
- test/facts/skylake-ipv6.json
|
323
|
+
- test/functional/api/v2/discovered_hosts_controller_test.rb
|
324
|
+
- test/functional/api/v2/discovery_rules_controller_test.rb
|
325
|
+
- test/functional/api/v2/fact_value_extensions_test.rb
|
326
|
+
- test/functional/api/v2/settings_controller_test.rb
|
327
|
+
- test/functional/discovery_rules_controller_test.rb
|
328
|
+
- test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb
|
329
|
+
- test/functional/discovered_hosts_controller_test.rb
|
330
|
+
- test/integration/discovered_hosts_test.rb
|
331
|
+
- test/models/setting_test.rb
|
332
|
+
- test/test_helper_discovery.rb
|
333
|
+
- test/test_plugin_helper.rb
|
334
|
+
- test/unit/discovered_mailer_test.rb
|
335
|
+
- test/unit/discovery_attribute_set_test.rb
|
325
336
|
- test/unit/discovery_rule_test.rb
|
326
337
|
- test/unit/discovery_taxonomy_extensions_test.rb
|
327
|
-
- test/unit/discovered_mailer_test.rb
|
328
338
|
- test/unit/fact_parser_test.rb
|
329
|
-
- test/unit/discovered_extensions_test.rb
|
330
|
-
- test/unit/setting_discovered_test.rb
|
331
|
-
- test/unit/host_discovered_test.rb
|
332
339
|
- test/unit/lldp_neighbors_test.rb
|
340
|
+
- test/unit/setting_discovered_test.rb
|
333
341
|
- test/unit/ui_notifications/destroy_host_test.rb
|
334
342
|
- test/unit/ui_notifications/new_host_test.rb
|
335
|
-
- test/unit/
|
343
|
+
- test/unit/host_discovered_test.rb
|
344
|
+
- test/unit/discovered_extensions_test.rb
|
336
345
|
- test/unit/managed_extensions_test.rb
|
337
|
-
- test/models/setting_test.rb
|
338
|
-
- test/test_helper_discovery.rb
|
339
|
-
- test/factories/discovery_rule_related.rb
|
340
|
-
- test/factories/discovery_host_related.rb
|