foreman_discovery 22.0.4 → 23.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_discovery/locale/ca/foreman_discovery.js +847 -0
  3. data/app/assets/javascripts/foreman_discovery/locale/cs_CZ/foreman_discovery.js +847 -0
  4. data/app/assets/javascripts/foreman_discovery/locale/de/foreman_discovery.js +847 -0
  5. data/app/assets/javascripts/foreman_discovery/locale/en/foreman_discovery.js +846 -0
  6. data/app/assets/javascripts/foreman_discovery/locale/en_GB/foreman_discovery.js +847 -0
  7. data/app/assets/javascripts/foreman_discovery/locale/es/foreman_discovery.js +850 -0
  8. data/app/assets/javascripts/foreman_discovery/locale/fr/foreman_discovery.js +850 -0
  9. data/app/assets/javascripts/foreman_discovery/locale/gl/foreman_discovery.js +847 -0
  10. data/app/assets/javascripts/foreman_discovery/locale/it/foreman_discovery.js +847 -0
  11. data/app/assets/javascripts/foreman_discovery/locale/ja/foreman_discovery.js +844 -0
  12. data/app/assets/javascripts/foreman_discovery/locale/ka/foreman_discovery.js +847 -0
  13. data/app/assets/javascripts/foreman_discovery/locale/ko/foreman_discovery.js +847 -0
  14. data/app/assets/javascripts/foreman_discovery/locale/pt_BR/foreman_discovery.js +850 -0
  15. data/app/assets/javascripts/foreman_discovery/locale/ru/foreman_discovery.js +851 -0
  16. data/app/assets/javascripts/foreman_discovery/locale/sv_SE/foreman_discovery.js +847 -0
  17. data/app/assets/javascripts/foreman_discovery/locale/zh_CN/foreman_discovery.js +844 -0
  18. data/app/assets/javascripts/foreman_discovery/locale/zh_TW/foreman_discovery.js +847 -0
  19. data/app/controllers/discovered_hosts_controller.rb +4 -0
  20. data/app/helpers/discovered_hosts_helper.rb +9 -2
  21. data/app/services/foreman_discovery/node_api/node_resource.rb +5 -5
  22. data/app/services/foreman_discovery/ui_notifications/failed_discovery.rb +1 -1
  23. data/extra/discover-host +1 -1
  24. data/lib/foreman_discovery/engine.rb +2 -8
  25. data/lib/foreman_discovery/version.rb +1 -1
  26. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  27. data/locale/ca/foreman_discovery.edit.po +1122 -0
  28. data/locale/ca/foreman_discovery.po +15 -3
  29. data/locale/cs_CZ/LC_MESSAGES/foreman_discovery.mo +0 -0
  30. data/locale/cs_CZ/foreman_discovery.edit.po +1120 -0
  31. data/locale/cs_CZ/foreman_discovery.po +846 -0
  32. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  33. data/locale/de/foreman_discovery.edit.po +1129 -0
  34. data/locale/de/foreman_discovery.po +17 -5
  35. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  36. data/locale/en/foreman_discovery.edit.po +1115 -0
  37. data/locale/en/foreman_discovery.po +15 -3
  38. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  39. data/locale/en_GB/foreman_discovery.edit.po +1125 -0
  40. data/locale/en_GB/foreman_discovery.po +17 -5
  41. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  42. data/locale/es/foreman_discovery.edit.po +1130 -0
  43. data/locale/es/foreman_discovery.po +17 -5
  44. data/locale/foreman_discovery.pot +78 -59
  45. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  46. data/locale/fr/foreman_discovery.edit.po +1126 -0
  47. data/locale/fr/foreman_discovery.po +17 -5
  48. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  49. data/locale/gl/foreman_discovery.edit.po +1120 -0
  50. data/locale/gl/foreman_discovery.po +15 -3
  51. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  52. data/locale/it/foreman_discovery.edit.po +1123 -0
  53. data/locale/it/foreman_discovery.po +15 -3
  54. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  55. data/locale/ja/foreman_discovery.edit.po +1119 -0
  56. data/locale/ja/foreman_discovery.po +17 -5
  57. data/locale/ka/LC_MESSAGES/foreman_discovery.mo +0 -0
  58. data/locale/ka/foreman_discovery.edit.po +1120 -0
  59. data/locale/ka/foreman_discovery.po +15 -3
  60. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  61. data/locale/ko/foreman_discovery.edit.po +1119 -0
  62. data/locale/ko/foreman_discovery.po +16 -4
  63. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  64. data/locale/pt_BR/foreman_discovery.edit.po +1132 -0
  65. data/locale/pt_BR/foreman_discovery.po +17 -5
  66. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  67. data/locale/ru/foreman_discovery.edit.po +1131 -0
  68. data/locale/ru/foreman_discovery.po +17 -5
  69. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  70. data/locale/sv_SE/foreman_discovery.edit.po +1123 -0
  71. data/locale/sv_SE/foreman_discovery.po +15 -3
  72. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  73. data/locale/zh_CN/foreman_discovery.edit.po +1117 -0
  74. data/locale/zh_CN/foreman_discovery.po +17 -5
  75. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  76. data/locale/zh_TW/foreman_discovery.edit.po +1120 -0
  77. data/locale/zh_TW/foreman_discovery.po +15 -3
  78. data/package.json +0 -1
  79. data/test/migrations/20221102075151_migrate_discovery_hostname_and_fact_column_to_array_test.rb +11 -25
  80. data/test/migrations/20221102075151_migrate_discovery_hostname_and_fact_column_to_array_test.rb.orig +81 -0
  81. data/webpack/src/ForemanDiscovery/DiscoveryRules/Components/EmptyState/EmptyState.js +1 -1
  82. metadata +54 -16
@@ -198,6 +198,10 @@ class DiscoveredHostsController < ::ApplicationController
198
198
  end
199
199
  end
200
200
 
201
+ def resource_class
202
+ Host::Discovered
203
+ end
204
+
201
205
  private
202
206
 
203
207
  def setup_host_class_variables
@@ -94,8 +94,15 @@ module DiscoveredHostsHelper
94
94
  end
95
95
 
96
96
  def host_path(host)
97
- return super unless controller_name == 'discovered_hosts'
98
- discovered_host_path(host)
97
+ return discovered_host_path(host) if controller_name == 'discovered_hosts'
98
+ # This is a hack to fix the hostgroup selection on the discovered host edit page
99
+ # The hostgroup onChange action is replacing the form url from `/discovered_hosts/:id`
100
+ # to `/hosts/:id``, which is not correct (in this case) and it breaks the form submission
101
+ return discovered_host_path(host) if controller_name == 'hosts' &&
102
+ action_name == 'process_hostgroup' &&
103
+ Host::Discovered.find_by(id: host[:id])
104
+
105
+ super
99
106
  end
100
107
 
101
108
  def discovery_doc_version
@@ -1,8 +1,8 @@
1
1
  module ForemanDiscovery::NodeAPI
2
2
  class NodeResource
3
3
  def initialize(args)
4
- raise ArgumentError, "Options must be hash" unless args.is_a?(Hash)
5
- raise ArgumentError, "Option 'url' must be provided" unless args[:url]
4
+ raise ArgumentError, _("Options must be hash") unless args.is_a?(Hash)
5
+ raise ArgumentError, _("Option 'url' must be provided") unless args[:url]
6
6
  @args = args
7
7
  @connect_params = {
8
8
  :headers => { :accept => :json },
@@ -38,19 +38,19 @@ module ForemanDiscovery::NodeAPI
38
38
  def scheme
39
39
  URI.parse(url).scheme
40
40
  rescue Exception => e
41
- raise ArgumentError, "Option 'url' must be valid URI: #{e}"
41
+ raise ArgumentError, _("Option 'url' must be valid URI: %s") % e
42
42
  end
43
43
 
44
44
  def port
45
45
  URI.parse(url).port
46
46
  rescue Exception => e
47
- raise ArgumentError, "Option 'url' must be valid URI: #{e}"
47
+ raise ArgumentError, _("Option 'url' must be valid URI: %s") % e
48
48
  end
49
49
 
50
50
  def root_path
51
51
  URI.parse(url).path
52
52
  rescue Exception => e
53
- raise ArgumentError, "Option 'url' must be valid URI: #{e}"
53
+ raise ArgumentError, _("Option 'url' must be valid URI: %s") % e
54
54
  end
55
55
 
56
56
  def is_proxy?
@@ -21,7 +21,7 @@ module ForemanDiscovery
21
21
  Notification.create!(
22
22
  initiator: initiator,
23
23
  audience: ::Notification::AUDIENCE_ADMIN,
24
- message: _("One or more hosts with failed discovery due to error: #{@message}"),
24
+ message: _("One or more hosts with failed discovery due to error: %s") % @message,
25
25
  notification_blueprint: blueprint,
26
26
  )
27
27
  end
data/extra/discover-host CHANGED
@@ -6,7 +6,7 @@ require 'rest-client'
6
6
  def find_base name = "default"
7
7
  return name if File.exist?(name)
8
8
 
9
- file = File.absolute_path(File.dirname(__FILE__) + "../../test/facts/#{name}.json")
9
+ file = File.absolute_path(File.dirname(__FILE__) + "/../test/facts/#{name}.json")
10
10
  raise "Unable to find file #{file}" unless File.exist?(file)
11
11
 
12
12
  file
@@ -21,13 +21,6 @@ module ForemanDiscovery
21
21
  end
22
22
  end
23
23
 
24
- initializer 'foreman_discovery.register_gettext', :after => :load_config_initializers do |app|
25
- locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
26
- locale_domain = 'foreman_discovery'
27
-
28
- Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
29
- end
30
-
31
24
  # Add any db migrations
32
25
  initializer "foreman_discovery.load_app_instance_data" do |app|
33
26
  ForemanDiscovery::Engine.paths['db/migrate'].existent.each do |path|
@@ -37,7 +30,8 @@ module ForemanDiscovery
37
30
 
38
31
  initializer 'foreman_discovery.register_plugin', :before => :finisher_hook do |app|
39
32
  Foreman::Plugin.register :foreman_discovery do
40
- requires_foreman '>= 3.3'
33
+ requires_foreman '>= 3.8'
34
+ register_gettext
41
35
 
42
36
  # settings
43
37
  settings do
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "22.0.4"
2
+ VERSION = "23.0.0"
3
3
  end