foreman_discovery 16.1.3 → 16.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/discovered_hosts_controller.rb +14 -8
  3. data/app/controllers/discovered_hosts_controller.rb +5 -3
  4. data/app/helpers/discovered_hosts_helper.rb +5 -0
  5. data/app/models/host/discovered.rb +11 -15
  6. data/app/models/setting/discovered.rb +3 -1
  7. data/app/services/foreman_discovery/host_fact_importer.rb +10 -0
  8. data/app/services/foreman_discovery/import_hooks/subnet_and_taxonomy.rb +2 -0
  9. data/app/views/api/v2/discovery_rules/create.json.rabl +3 -0
  10. data/app/views/discovered_hosts/_discovered_host_modal.html.erb +0 -2
  11. data/app/views/discovered_hosts/welcome.html.erb +14 -9
  12. data/app/views/discovery_rules/index.html.erb +1 -1
  13. data/app/views/foreman_discovery/debian_kexec.erb +3 -2
  14. data/app/views/foreman_discovery/redhat_kexec.erb +3 -2
  15. data/extra/discover-host +14 -8
  16. data/lib/foreman_discovery/engine.rb +3 -2
  17. data/lib/foreman_discovery/version.rb +1 -1
  18. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  19. data/locale/ca/foreman_discovery.edit.po +46 -37
  20. data/locale/ca/foreman_discovery.po +28 -10
  21. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  22. data/locale/de/foreman_discovery.edit.po +54 -47
  23. data/locale/de/foreman_discovery.po +28 -10
  24. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  25. data/locale/en/foreman_discovery.edit.po +40 -28
  26. data/locale/en/foreman_discovery.po +28 -10
  27. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  28. data/locale/en_GB/foreman_discovery.edit.po +45 -44
  29. data/locale/en_GB/foreman_discovery.po +28 -10
  30. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  31. data/locale/es/foreman_discovery.edit.po +79 -76
  32. data/locale/es/foreman_discovery.po +28 -10
  33. data/locale/foreman_discovery.pot +142 -115
  34. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/fr/foreman_discovery.edit.po +85 -82
  36. data/locale/fr/foreman_discovery.po +28 -10
  37. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  38. data/locale/gl/foreman_discovery.edit.po +41 -29
  39. data/locale/gl/foreman_discovery.po +28 -10
  40. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/it/foreman_discovery.edit.po +54 -42
  42. data/locale/it/foreman_discovery.po +28 -10
  43. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  44. data/locale/ja/foreman_discovery.edit.po +88 -87
  45. data/locale/ja/foreman_discovery.po +28 -10
  46. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  47. data/locale/ko/foreman_discovery.edit.po +53 -41
  48. data/locale/ko/foreman_discovery.po +28 -10
  49. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  50. data/locale/pt_BR/foreman_discovery.edit.po +78 -72
  51. data/locale/pt_BR/foreman_discovery.po +28 -10
  52. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  53. data/locale/ru/foreman_discovery.edit.po +53 -41
  54. data/locale/ru/foreman_discovery.po +28 -10
  55. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  56. data/locale/sv_SE/foreman_discovery.edit.po +44 -32
  57. data/locale/sv_SE/foreman_discovery.po +28 -10
  58. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  59. data/locale/zh_CN/foreman_discovery.edit.po +123 -123
  60. data/locale/zh_CN/foreman_discovery.po +28 -10
  61. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  62. data/locale/zh_TW/foreman_discovery.edit.po +53 -41
  63. data/locale/zh_TW/foreman_discovery.po +28 -10
  64. data/package.json +39 -0
  65. data/test/facts/only-ipv6.json +205 -0
  66. data/test/facts/skylake-ipv6.json +223 -0
  67. data/test/functional/api/v2/settings_controller_test.rb +2 -2
  68. data/test/functional/discovered_hosts_controller_test.rb +1 -1
  69. data/test/functional/discovery_rules_controller_test.rb +1 -1
  70. data/test/unit/host_discovered_test.rb +0 -16
  71. data/webpack/index.js +18 -0
  72. data/webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/EmptyState.js +28 -0
  73. data/webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/index.js +1 -0
  74. data/webpack/src/ForemanDiscovery/DiscoveredHosts/index.js +6 -0
  75. data/webpack/src/reducers.js +7 -0
  76. metadata +24 -12
@@ -6,7 +6,7 @@ class DiscoveryRulesControllerTest < ActionController::TestCase
6
6
  test "should add a link to navigation" do
7
7
  get :index, params: {}, session: set_session_user
8
8
  assert_response :success
9
- assert response.body =~ /"\/discovery_rules"/
9
+ assert response.body =~ /\/discovery_rules/
10
10
  end
11
11
 
12
12
  test "reader role should get index" do
@@ -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)
data/webpack/index.js ADDED
@@ -0,0 +1,18 @@
1
+ /* eslint import/no-unresolved: [2, { ignore: [foremanReact/*] }] */
2
+ /* eslint-disable import/no-extraneous-dependencies */
3
+ /* eslint-disable import/extensions */
4
+ import componentRegistry from "foremanReact/components/componentRegistry";
5
+ import { registerReducer } from "foremanReact/common/MountingService";
6
+ import reducers from "./src/reducers";
7
+ import DiscoveredHosts from "./src/ForemanDiscovery/DiscoveredHosts";
8
+
9
+ // register reducers
10
+ Object.entries(reducers).forEach(([key, reducer]) =>
11
+ registerReducer(key, reducer)
12
+ );
13
+
14
+ // register components for erb mounting
15
+ componentRegistry.register({
16
+ name: "DiscoveredHosts",
17
+ type: DiscoveredHosts,
18
+ });
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { translate as __ } from "foremanReact/common/I18n";
4
+ import ForemanEmptyState from "foremanReact/components/common/EmptyState";
5
+
6
+ const EmptyState = (props) => {
7
+ const description = __(
8
+ "No discovered hosts found in this context. This page shows discovered bare-metal or virtual nodes waiting to be provisioned."
9
+ );
10
+ const documentation = {
11
+ url: props.docUrl,
12
+ };
13
+ return (
14
+ <ForemanEmptyState
15
+ header="Foreman Discovery"
16
+ description={description}
17
+ icon="gears"
18
+ iconType="fa"
19
+ documentation={documentation}
20
+ />
21
+ );
22
+ };
23
+
24
+ EmptyState.propTypes = {
25
+ docUrl: PropTypes.string,
26
+ };
27
+
28
+ export default EmptyState;
@@ -0,0 +1 @@
1
+ export { default } from "./EmptyState";
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import EmptyState from "./Components/EmptyState";
3
+
4
+ const DiscoveredHosts = ({ docUrl }) => <EmptyState docUrl={docUrl} />;
5
+
6
+ export default DiscoveredHosts;
@@ -0,0 +1,7 @@
1
+ import { combineReducers } from "redux";
2
+
3
+ const reducers = {
4
+ foremanDiscovery: {},
5
+ };
6
+
7
+ export default reducers;
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.3
4
+ version: 16.3.5
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: 2021-01-11 00:00:00.000000000 Z
74
+ date: 2021-04-27 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
@@ -126,6 +127,7 @@ files:
126
127
  - app/views/api/v2/discovered_hosts/show.json.rabl
127
128
  - app/views/api/v2/discovered_hosts/update.json.rabl
128
129
  - app/views/api/v2/discovery_rules/base.json.rabl
130
+ - app/views/api/v2/discovery_rules/create.json.rabl
129
131
  - app/views/api/v2/discovery_rules/index.json.rabl
130
132
  - app/views/api/v2/discovery_rules/main.json.rabl
131
133
  - app/views/api/v2/discovery_rules/show.json.rabl
@@ -236,6 +238,7 @@ files:
236
238
  - locale/zh_TW/LC_MESSAGES/foreman_discovery.mo
237
239
  - locale/zh_TW/foreman_discovery.edit.po
238
240
  - locale/zh_TW/foreman_discovery.po
241
+ - package.json
239
242
  - test/factories/discovery_host_related.rb
240
243
  - test/factories/discovery_rule_related.rb
241
244
  - test/facts/bond0-eth0-eth1-active-passive.json
@@ -244,12 +247,14 @@ files:
244
247
  - test/facts/dell_vlan.json
245
248
  - test/facts/facts_with_lldp.json
246
249
  - test/facts/facts_with_lldp_bond_candidate.json
250
+ - test/facts/only-ipv6.json
247
251
  - test/facts/pxeless-vlan.json
248
252
  - test/facts/regular_host.json
249
253
  - test/facts/rhel-dl380-1kdisks.json
250
254
  - test/facts/rhel-r730.json
251
255
  - test/facts/rhel7-vlan.json
252
256
  - test/facts/simple-bond.json
257
+ - test/facts/skylake-ipv6.json
253
258
  - test/facts/suse-vmware.json
254
259
  - test/facts/vmware_local.json
255
260
  - test/functional/api/v2/discovered_hosts_controller_test.rb
@@ -275,6 +280,11 @@ files:
275
280
  - test/unit/setting_discovered_test.rb
276
281
  - test/unit/ui_notifications/destroy_host_test.rb
277
282
  - test/unit/ui_notifications/new_host_test.rb
283
+ - webpack/index.js
284
+ - webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/EmptyState.js
285
+ - webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/index.js
286
+ - webpack/src/ForemanDiscovery/DiscoveredHosts/index.js
287
+ - webpack/src/reducers.js
278
288
  homepage: https://github.com/theforeman/foreman_discovery
279
289
  licenses:
280
290
  - GPL-3.0
@@ -294,19 +304,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
304
  - !ruby/object:Gem::Version
295
305
  version: '0'
296
306
  requirements: []
297
- rubygems_version: 3.1.2
307
+ rubygems_version: 3.1.4
298
308
  signing_key:
299
309
  specification_version: 4
300
310
  summary: MaaS Discovery Plugin for Foreman
301
311
  test_files:
302
312
  - test/factories/discovery_host_related.rb
303
313
  - test/factories/discovery_rule_related.rb
304
- - test/facts/bond0-eth0-eth1-active-passive.json
305
314
  - test/facts/default.json
306
315
  - test/facts/dell_npars.json
307
316
  - test/facts/dell_vlan.json
308
317
  - test/facts/facts_with_lldp.json
309
- - test/facts/facts_with_lldp_bond_candidate.json
310
318
  - test/facts/pxeless-vlan.json
311
319
  - test/facts/regular_host.json
312
320
  - test/facts/rhel-dl380-1kdisks.json
@@ -315,26 +323,30 @@ test_files:
315
323
  - test/facts/simple-bond.json
316
324
  - test/facts/suse-vmware.json
317
325
  - test/facts/vmware_local.json
318
- - test/functional/api/v2/discovered_hosts_controller_test.rb
326
+ - test/facts/bond0-eth0-eth1-active-passive.json
327
+ - test/facts/facts_with_lldp_bond_candidate.json
328
+ - test/facts/only-ipv6.json
329
+ - test/facts/skylake-ipv6.json
319
330
  - test/functional/api/v2/discovery_rules_controller_test.rb
320
331
  - test/functional/api/v2/fact_value_extensions_test.rb
321
332
  - test/functional/api/v2/settings_controller_test.rb
333
+ - test/functional/api/v2/discovered_hosts_controller_test.rb
322
334
  - test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb
323
335
  - test/functional/discovered_hosts_controller_test.rb
324
336
  - test/functional/discovery_rules_controller_test.rb
325
337
  - test/integration/discovered_hosts_test.rb
326
338
  - test/models/setting_test.rb
327
- - test/test_helper_discovery.rb
328
- - test/test_plugin_helper.rb
339
+ - test/unit/ui_notifications/destroy_host_test.rb
340
+ - test/unit/ui_notifications/new_host_test.rb
329
341
  - test/unit/discovered_mailer_test.rb
330
- - test/unit/discovery_attribute_set_test.rb
331
- - test/unit/discovery_rule_test.rb
332
342
  - test/unit/discovery_taxonomy_extensions_test.rb
333
343
  - test/unit/fact_parser_test.rb
334
344
  - test/unit/lldp_neighbors_test.rb
335
345
  - test/unit/setting_discovered_test.rb
336
- - test/unit/ui_notifications/destroy_host_test.rb
337
- - test/unit/ui_notifications/new_host_test.rb
338
346
  - test/unit/discovered_extensions_test.rb
347
+ - test/unit/discovery_attribute_set_test.rb
339
348
  - test/unit/managed_extensions_test.rb
349
+ - test/unit/discovery_rule_test.rb
340
350
  - test/unit/host_discovered_test.rb
351
+ - test/test_plugin_helper.rb
352
+ - test/test_helper_discovery.rb