foreman_discovery 21.0.5 → 22.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/discovered_hosts_controller.rb +1 -1
  3. data/app/models/host/discovered.rb +3 -3
  4. data/app/services/foreman_discovery/import_hooks/lock_templates.rb +1 -1
  5. data/app/views/discovered_hosts/_discovered_host.html.erb +1 -1
  6. data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +1 -1
  7. data/db/migrate/20221102065954_fix_discovery_settings_category_to_dsl.rb +1 -1
  8. data/db/migrate/20221102075151_migrate_discovery_hostname_and_fact_column_to_array.rb +13 -0
  9. data/lib/foreman_discovery/engine.rb +7 -15
  10. data/lib/foreman_discovery/version.rb +1 -1
  11. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  12. data/locale/ca/foreman_discovery.po +8 -8
  13. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  14. data/locale/de/foreman_discovery.po +6 -6
  15. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  16. data/locale/en/foreman_discovery.po +5 -5
  17. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  18. data/locale/en_GB/foreman_discovery.po +6 -6
  19. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  20. data/locale/es/foreman_discovery.po +65 -61
  21. data/locale/foreman_discovery.pot +212 -211
  22. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  23. data/locale/fr/foreman_discovery.po +19 -15
  24. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  25. data/locale/gl/foreman_discovery.po +5 -5
  26. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  27. data/locale/it/foreman_discovery.po +7 -6
  28. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  29. data/locale/ja/foreman_discovery.po +18 -18
  30. data/locale/ka/LC_MESSAGES/foreman_discovery.mo +0 -0
  31. data/locale/ka/foreman_discovery.po +834 -0
  32. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  33. data/locale/ko/foreman_discovery.po +5 -5
  34. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/pt_BR/foreman_discovery.po +45 -41
  36. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  37. data/locale/ru/foreman_discovery.po +5 -5
  38. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  39. data/locale/sv_SE/foreman_discovery.po +5 -5
  40. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/zh_CN/foreman_discovery.po +15 -15
  42. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  43. data/locale/zh_TW/foreman_discovery.po +5 -5
  44. data/test/functional/api/v2/fact_value_extensions_test.rb +1 -1
  45. data/test/functional/discovered_hosts_controller_test.rb +3 -1
  46. data/test/migrations/20221102075151_migrate_discovery_hostname_and_fact_column_to_array_test.rb +89 -0
  47. data/{app/views/foreman_discovery → test/static_fixtures}/redhat_kexec.erb +11 -7
  48. data/test/test_helper_discovery.rb +1 -1
  49. data/test/unit/discovery_attribute_set_test.rb +1 -1
  50. data/test/unit/host_discovered_test.rb +12 -16
  51. data/test/unit/managed_extensions_test.rb +2 -1
  52. data/webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/EmptyState.js +1 -1
  53. metadata +11 -8
  54. data/app/models/setting/discovered.rb +0 -22
  55. data/app/views/foreman_discovery/debian_kexec.erb +0 -41
  56. data/db/seeds.d/50_discovery_templates.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7592ef5cdb3aad271a4373a96f6ee8b2de79352e680147446cebd8bbd9ae2eaa
4
- data.tar.gz: 253b54da9acc15a1401fabfb2c580791667fcc8c43af0b6bb42c16d08f2eada6
3
+ metadata.gz: 7fc5eb4a3d41d11a816e54461373bd33f6b3562d69aa739d2f38802e3c370e46
4
+ data.tar.gz: 2f3ab4b2ac4b57dc7380f7034b4de1956a0d8f04ec41e55aa97dc7a18c853650
5
5
  SHA512:
6
- metadata.gz: 302323e8daf18ad7bdd4f65b9e45c89477bd72ab47f7be2e0a03f0d9f2078c65734451bf84367b444c89ee1a0820565308437d35f1c7388697e136a4089f397f
7
- data.tar.gz: d0751ab0c44157694df0ba32584eef59fc489659e3bfac49a84da40f0c57a21cbfdc14407cc4c275afb5f6de727a48add6d45e963cd65d547f12d6cfcca554e7
6
+ metadata.gz: 9e110a0b8aaab95b616e1c744ed1c720f8d5c97126cef6ee2e49d78e4d3065f34dde95a24d62b76ccc20af93c9b8747e01d585fe7b7a076d4f32004be0e0c183
7
+ data.tar.gz: bf8b6daa88492f1c09349cb0628b8fd4fb4e72f231e0a1926e8e0bef29320600e7301bced891230e4d6d2844dccf912629a921dadc80cd8326ba67447a54eed3
@@ -35,7 +35,7 @@ class DiscoveredHostsController < ::ApplicationController
35
35
  :discovery_attribute_set
36
36
  ], {:interfaces => :subnet})
37
37
  fact_array = @hosts.collect do |host|
38
- [host.id, Hash[host.fact_values.joins(:fact_name).where('fact_names.name' => Setting::Discovered.discovery_fact_column_array).pluck(:name, :value)]]
38
+ [host.id, Hash[host.fact_values.joins(:fact_name).where('fact_names.name' => Setting['discovery_fact_column']).pluck(:name, :value)]]
39
39
  end
40
40
  @host_facts = Hash[fact_array]
41
41
  end
@@ -63,15 +63,15 @@ class Host::Discovered < ::Host::Base
63
63
  bootif_mac = FacterUtils::bootif_mac(facts).try(:downcase)
64
64
  hostname = ''
65
65
  if Setting[:discovery_naming] == 'MAC-name'
66
- hostname_mac = return_first_valid_mac(Setting::Discovered.discovery_hostname_fact_array, facts) || bootif_mac
66
+ hostname_mac = return_first_valid_mac(Setting['discovery_hostname'], facts) || bootif_mac
67
67
  hostname = NameGenerator.new.generate_next_mac_name(hostname_mac)
68
68
  elsif Setting[:discovery_naming] == 'Random-name'
69
69
  hostname = NameGenerator.new.generate_next_random_name
70
70
  else
71
71
  prefix_from_settings = Setting[:discovery_prefix]
72
72
  hostname_prefix = prefix_from_settings if prefix_from_settings.present? && prefix_from_settings.match(/^[a-zA-Z].*/)
73
- name_fact = return_first_valid_fact(Setting::Discovered.discovery_hostname_fact_array, facts)
74
- raise(::Foreman::Exception.new(N_("Invalid facts: hash does not contain a valid value for any of the facts in the discovery_hostname setting: %s"), Setting::Discovered.discovery_hostname_fact_array.join(', '))) unless name_fact && name_fact.present?
73
+ name_fact = return_first_valid_fact(Setting['discovery_hostname'], facts)
74
+ raise(::Foreman::Exception.new(N_("Invalid facts: hash does not contain a valid value for any of the facts in the discovery_hostname setting: %s"), Setting['discovery_hostname'].join(', '))) unless name_fact && name_fact.present?
75
75
  hostname = normalize_string_for_hostname("#{hostname_prefix}#{name_fact}")
76
76
  end
77
77
  Rails.logger.warn "Hostname does not start with an alphabetical character" unless hostname.downcase.match(/^[a-z]/)
@@ -3,7 +3,7 @@ module ForemanDiscovery
3
3
  module ImportHooks
4
4
  class LockTemplates < ImportHook
5
5
  def after_populate
6
- lock_templates if Setting::Discovered.discovery_lock? && host.subnet.tftp?
6
+ lock_templates if Setting['discovery_lock'] && host.subnet.tftp?
7
7
  end
8
8
 
9
9
  def lock_templates
@@ -6,7 +6,7 @@
6
6
  <td class="hidden-tablet hidden-xs"><%= discovery_attribute(host, :disk_count) %></td>
7
7
  <td class="hidden-tablet hidden-xs"><%= number_to_human_size(discovery_attribute(host, :disks_size, 0) * 1024 * 1024) %></td>
8
8
  <%
9
- Setting::Discovered.discovery_fact_column_array.each do |name|
9
+ Setting['discovery_fact_column'].each do |name|
10
10
  %>
11
11
  <td class="hidden-tablet hidden-xs"><%= @host_facts[host.id][name] || 'N/A' %></td>
12
12
  <% end %>
@@ -10,7 +10,7 @@
10
10
  <th class="hidden-tablet hidden-xs"><%= sort :memory, :as => _('Memory') %></th>
11
11
  <th class="hidden-tablet hidden-xs"><%= sort :disk_count, :as => _('Disk Count') %></th>
12
12
  <th class="hidden-tablet hidden-xs"><%= sort :disks_size, :as => _('Disks Size') %></th>
13
- <% Setting::Discovered.discovery_fact_column_array.each do |fact_column| %>
13
+ <% Setting['discovery_fact_column'].each do |fact_column| %>
14
14
  <th class="hidden-tablet hidden-xs"><%= fact_column.capitalize %></th>
15
15
  <% end %>
16
16
  <th class="hidden-tablet hidden-xs"><%= sort :location, :as => _('Location') %></th>
@@ -3,7 +3,7 @@
3
3
  class FixDiscoverySettingsCategoryToDsl < ActiveRecord::Migration[6.0]
4
4
  def up
5
5
  # rubocop:disable Rails/SkipsModelValidations
6
- Setting.where(category: 'Setting::Discovered').update_all(category: 'Setting')
6
+ Setting.where(category: 'Setting::Discovered').update_all(category: 'Setting') if column_exists?(:settings, :category)
7
7
  # rubocop:enable Rails/SkipsModelValidations
8
8
  end
9
9
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MigrateDiscoveryHostnameAndFactColumnToArray < ActiveRecord::Migration[6.0]
4
+ def up
5
+ ['discovery_hostname', 'discovery_fact_column'].each do |setting_name|
6
+ setting = Setting.find_by(name: setting_name)
7
+ if !setting.nil? && setting.value.is_a?(String)
8
+ setting.value = setting.value.split(",").map(&:strip)
9
+ setting.save
10
+ end
11
+ end
12
+ end
13
+ end
@@ -15,12 +15,6 @@ module ForemanDiscovery
15
15
  config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
16
16
  config.autoload_paths += Dir["#{config.root}/app/services"]
17
17
 
18
- # Load this before the Foreman config initializers, so that the Setting.descendants
19
- # list includes the plugin STI setting class
20
- initializer 'foreman_discovery.load_default_settings', :before => :load_config_initializers do |app|
21
- require_dependency File.expand_path("../../../app/models/setting/discovered.rb", __FILE__) if (Setting.table_exists? rescue(false))
22
- end
23
-
24
18
  initializer "foreman_discovery.add_rabl_view_path" do |app|
25
19
  Rabl.configure do |config|
26
20
  config.view_paths << ForemanDiscovery::Engine.root.join('app', 'views')
@@ -43,7 +37,7 @@ module ForemanDiscovery
43
37
 
44
38
  initializer 'foreman_discovery.register_plugin', :before => :finisher_hook do |app|
45
39
  Foreman::Plugin.register :foreman_discovery do
46
- requires_foreman '>= 3.2'
40
+ requires_foreman '>= 3.3'
47
41
 
48
42
  # settings
49
43
  settings do
@@ -85,10 +79,10 @@ module ForemanDiscovery
85
79
  description: N_("Clean all reported facts during provisioning (except discovery facts)")
86
80
 
87
81
  setting "discovery_hostname",
88
- type: :string,
89
- default: "discovery_bootif",
82
+ type: :array,
83
+ default: ["discovery_bootif"],
90
84
  full_name: N_("Hostname facts"),
91
- description: N_("List of facts to use for the hostname (separated by comma, first wins)")
85
+ description: N_("List of facts to use for the hostname (first wins)")
92
86
 
93
87
  validates "discovery_hostname", presence: true
94
88
 
@@ -113,10 +107,10 @@ module ForemanDiscovery
113
107
  validates "discovery_prefix", presence: true
114
108
 
115
109
  setting "discovery_fact_column",
116
- type: :string,
117
- default: "",
110
+ type: :array,
111
+ default: [],
118
112
  full_name: N_("Fact columns"),
119
- description: N_("Extra facter columns to show in host lists (separate by comma)")
113
+ description: N_("Extra facter columns to show in host lists")
120
114
 
121
115
  setting "discovery_facts_highlights",
122
116
  type: :string,
@@ -337,8 +331,6 @@ module ForemanDiscovery
337
331
  # add dashboard widget
338
332
  widget 'discovery_widget', :name=>N_('Discovered Hosts'), :sizex => 6, :sizey =>1
339
333
 
340
- template_labels 'kexec' => N_('Discovery Kexec template')
341
-
342
334
  # apipie API documentation
343
335
  # Only available in 1.8, otherwise it has to be in the initializer below
344
336
  apipie_documented_controllers ["#{ForemanDiscovery::Engine.root}/app/controllers/api/v2/*.rb"]
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "21.0.5"
2
+ VERSION = "22.0.4"
3
3
  end
@@ -3,14 +3,14 @@
3
3
  # This file is distributed under the same license as the foreman_discovery package.
4
4
  #
5
5
  # Translators:
6
- # Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2017
7
- # Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2015-2016
6
+ # Robert Antoni Buj i Gelonch <rbuj@fedoraproject.org>, 2017
7
+ # Robert Antoni Buj i Gelonch <rbuj@fedoraproject.org>, 2015-2016
8
8
  msgid ""
9
9
  msgstr ""
10
- "Project-Id-Version: foreman_discovery 21.0.0\n"
10
+ "Project-Id-Version: foreman_discovery 22.0.2\n"
11
11
  "Report-Msgid-Bugs-To: \n"
12
12
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
13
- "Last-Translator: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>, 2017\n"
13
+ "Last-Translator: Robert Antoni Buj i Gelonch <rbuj@fedoraproject.org>, 2017\n"
14
14
  "Language-Team: Catalan (http://www.transifex.com/foreman/foreman/language/ca/)"
15
15
  "\n"
16
16
  "MIME-Version: 1.0\n"
@@ -88,9 +88,6 @@ msgstr "Clona %s"
88
88
  msgid "Collapse All"
89
89
  msgstr ""
90
90
 
91
- msgid "Command line options for kexec during PXE-less provisioning."
92
- msgstr ""
93
-
94
91
  msgid "Could not get facts from proxy %{url}: %{error}"
95
92
  msgstr "No s'han pogut obtenir els objectes d'interès del servidor intermediari %{url}: %{error}"
96
93
 
@@ -177,7 +174,7 @@ msgstr ""
177
174
  msgid "Discovered hosts summary"
178
175
  msgstr ""
179
176
 
180
- msgid "Discovery Kexec template"
177
+ msgid "Discovery"
181
178
  msgstr ""
182
179
 
183
180
  msgid "Discovery Proxy"
@@ -306,6 +303,9 @@ msgstr ""
306
303
  msgid "Force DNS entries creation when provisioning discovered host"
307
304
  msgstr ""
308
305
 
306
+ msgid "Foreman Discovery"
307
+ msgstr ""
308
+
309
309
  msgid "Foreman discovered hosts summary"
310
310
  msgstr ""
311
311
 
@@ -15,7 +15,7 @@
15
15
  # stbenjam <stephen@redhat.com>, 2016
16
16
  msgid ""
17
17
  msgstr ""
18
- "Project-Id-Version: foreman_discovery 21.0.0\n"
18
+ "Project-Id-Version: foreman_discovery 22.0.2\n"
19
19
  "Report-Msgid-Bugs-To: \n"
20
20
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
21
21
  "Last-Translator: Patrick Dolinic, 2021\n"
@@ -95,9 +95,6 @@ msgstr "%s klonen"
95
95
  msgid "Collapse All"
96
96
  msgstr "Alle einklappen"
97
97
 
98
- msgid "Command line options for kexec during PXE-less provisioning."
99
- msgstr "Kommandozeilenoptionen für kexec während PXE-loser Bereitstellung"
100
-
101
98
  msgid "Could not get facts from proxy %{url}: %{error}"
102
99
  msgstr "Fakten konnten nicht vom Proxy %{url} abgerufen werden: %{error}"
103
100
 
@@ -184,8 +181,8 @@ msgstr "Erkannte Hosts, die von einem unbekannten Subnetz gemeldet wurden %s sin
184
181
  msgid "Discovered hosts summary"
185
182
  msgstr "Zusammenfassung entdeckter Hosts"
186
183
 
187
- msgid "Discovery Kexec template"
188
- msgstr "Discovery Kexec-Vorlage"
184
+ msgid "Discovery"
185
+ msgstr "Entdecken"
189
186
 
190
187
  msgid "Discovery Proxy"
191
188
  msgstr "Discovery-Proxy"
@@ -313,6 +310,9 @@ msgstr "DNS erzwingen"
313
310
  msgid "Force DNS entries creation when provisioning discovered host"
314
311
  msgstr "Erzwingen Sie die Erstellung von DNS-Einträgen bei der Bereitstellung des erkannten Hosts"
315
312
 
313
+ msgid "Foreman Discovery"
314
+ msgstr ""
315
+
316
316
  msgid "Foreman discovered hosts summary"
317
317
  msgstr "Foreman Zusammenfassung entdeckter Hosts"
318
318
 
@@ -2,7 +2,7 @@
2
2
  # This file is distributed under the same license as the foreman_discovery package.
3
3
  msgid ""
4
4
  msgstr ""
5
- "Project-Id-Version: foreman_discovery 21.0.0\n"
5
+ "Project-Id-Version: foreman_discovery 22.0.2\n"
6
6
  "Report-Msgid-Bugs-To: foreman-dev@googlegroups.com\n"
7
7
  "PO-Revision-Date: 2015-12-27 01:18+0000\n"
8
8
  "Last-Translator: \n"
@@ -81,9 +81,6 @@ msgstr ""
81
81
  msgid "Collapse All"
82
82
  msgstr ""
83
83
 
84
- msgid "Command line options for kexec during PXE-less provisioning."
85
- msgstr ""
86
-
87
84
  msgid "Could not get facts from proxy %{url}: %{error}"
88
85
  msgstr ""
89
86
 
@@ -170,7 +167,7 @@ msgstr ""
170
167
  msgid "Discovered hosts summary"
171
168
  msgstr ""
172
169
 
173
- msgid "Discovery Kexec template"
170
+ msgid "Discovery"
174
171
  msgstr ""
175
172
 
176
173
  msgid "Discovery Proxy"
@@ -299,6 +296,9 @@ msgstr ""
299
296
  msgid "Force DNS entries creation when provisioning discovered host"
300
297
  msgstr ""
301
298
 
299
+ msgid "Foreman Discovery"
300
+ msgstr ""
301
+
302
302
  msgid "Foreman discovered hosts summary"
303
303
  msgstr ""
304
304
 
@@ -10,7 +10,7 @@
10
10
  # Lukáš Zapletal, 2015
11
11
  msgid ""
12
12
  msgstr ""
13
- "Project-Id-Version: foreman_discovery 21.0.0\n"
13
+ "Project-Id-Version: foreman_discovery 22.0.2\n"
14
14
  "Report-Msgid-Bugs-To: \n"
15
15
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
16
16
  "Last-Translator: Andi Chandler <andi@gowling.com>, 2015-2019\n"
@@ -91,9 +91,6 @@ msgstr ""
91
91
  msgid "Collapse All"
92
92
  msgstr "Collapse All"
93
93
 
94
- msgid "Command line options for kexec during PXE-less provisioning."
95
- msgstr "Command line options for kexec during PXE-less provisioning."
96
-
97
94
  msgid "Could not get facts from proxy %{url}: %{error}"
98
95
  msgstr "Could not get facts from proxy %{url}: %{error}"
99
96
 
@@ -180,8 +177,8 @@ msgstr ""
180
177
  msgid "Discovered hosts summary"
181
178
  msgstr "Discovered hosts summary"
182
179
 
183
- msgid "Discovery Kexec template"
184
- msgstr "Discovery Kexec template"
180
+ msgid "Discovery"
181
+ msgstr ""
185
182
 
186
183
  msgid "Discovery Proxy"
187
184
  msgstr "Discovery Proxy"
@@ -309,6 +306,9 @@ msgstr "Force DNS"
309
306
  msgid "Force DNS entries creation when provisioning discovered host"
310
307
  msgstr "Force DNS entries creation when provisioning discovered host"
311
308
 
309
+ msgid "Foreman Discovery"
310
+ msgstr ""
311
+
312
312
  msgid "Foreman discovered hosts summary"
313
313
  msgstr "Foreman discovered hosts summary"
314
314