foreman_discovery 16.1.2 → 16.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/discovered_hosts_controller.rb +5 -3
  3. data/app/models/host/discovered.rb +10 -14
  4. data/app/models/setting/discovered.rb +3 -1
  5. data/app/services/foreman_discovery/host_fact_importer.rb +10 -0
  6. data/app/views/discovered_hosts/_discovered_host_modal.html.erb +0 -2
  7. data/app/views/foreman_discovery/debian_kexec.erb +2 -1
  8. data/app/views/foreman_discovery/redhat_kexec.erb +2 -1
  9. data/extra/discover-host +14 -8
  10. data/lib/foreman_discovery/engine.rb +1 -1
  11. data/lib/foreman_discovery/version.rb +1 -1
  12. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  13. data/locale/ca/foreman_discovery.po +4 -1
  14. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  15. data/locale/de/foreman_discovery.po +4 -1
  16. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  17. data/locale/en/foreman_discovery.po +4 -1
  18. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  19. data/locale/en_GB/foreman_discovery.po +4 -1
  20. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  21. data/locale/es/foreman_discovery.po +4 -1
  22. data/locale/foreman_discovery.pot +77 -73
  23. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  24. data/locale/fr/foreman_discovery.po +4 -1
  25. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  26. data/locale/gl/foreman_discovery.po +4 -1
  27. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  28. data/locale/it/foreman_discovery.po +4 -1
  29. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  30. data/locale/ja/foreman_discovery.po +4 -1
  31. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  32. data/locale/ko/foreman_discovery.po +4 -1
  33. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  34. data/locale/pt_BR/foreman_discovery.po +4 -1
  35. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  36. data/locale/ru/foreman_discovery.po +4 -1
  37. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  38. data/locale/sv_SE/foreman_discovery.po +4 -1
  39. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  40. data/locale/zh_CN/foreman_discovery.po +4 -1
  41. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  42. data/locale/zh_TW/foreman_discovery.po +4 -1
  43. data/test/facts/only-ipv6.json +205 -0
  44. data/test/facts/skylake-ipv6.json +223 -0
  45. data/test/functional/api/v2/settings_controller_test.rb +2 -2
  46. data/test/unit/host_discovered_test.rb +0 -16
  47. metadata +7 -2
@@ -6,10 +6,10 @@ class Api::V2::SettingsControllerTest < ActionController::TestCase
6
6
  end
7
7
 
8
8
  test_attributes :pid => '2c5ecb7e-87bc-4980-9620-7ae00e3f360e'
9
- test "should update hostname prefix without value" do
9
+ test "should not update hostname prefix without value" do
10
10
  setting = Setting.find_by_name("discovery_prefix")
11
11
  put :update, params: { :id => setting.id, :setting => { :value => '' } }
12
- assert_equal JSON.parse(@response.body)['value'], '', "Can't update discovery_prefix setting with empty value"
12
+ assert_nil JSON.parse(@response.body)['value']
13
13
  end
14
14
 
15
15
  test_attributes :pid => '4969994d-f934-4f0e-9a98-476b87eb0527'
@@ -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.1.2
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-09-18 00:00:00.000000000 Z
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
@@ -315,6 +318,8 @@ test_files:
315
318
  - test/facts/simple-bond.json
316
319
  - test/facts/suse-vmware.json
317
320
  - test/facts/vmware_local.json
321
+ - test/facts/only-ipv6.json
322
+ - test/facts/skylake-ipv6.json
318
323
  - test/functional/api/v2/discovered_hosts_controller_test.rb
319
324
  - test/functional/api/v2/discovery_rules_controller_test.rb
320
325
  - test/functional/api/v2/fact_value_extensions_test.rb