foreman_discovery 23.0.0 → 24.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c06b773090a573270dd6c59f3f3ea9236a4a92aee4097904c7306b4190b71870
4
- data.tar.gz: 6aeb520a8f222918d58459f5afa95430ac490f3bde6066eafc030f550ea39109
3
+ metadata.gz: 76f3192238fe98894488060d699286e6dd1a0baf5288aeb121688d8109064868
4
+ data.tar.gz: d8367489d3500b8c5339fab630f4a88cacf0ba04c4be60964747b8b2f47246a7
5
5
  SHA512:
6
- metadata.gz: 02a2a1a166d4412c82aaeadd5d1b8e200776d5680e97baccda80ffbc07f7013b84a44a512dcc4c77921dfc85e4c33c56f039213d58a05f81eaca9fad8687540e
7
- data.tar.gz: a2c342f5b8dfe0b74fd3694d2fe58b7ea64b68835d08d731c33cea5007c39a4b237e374fd725307c6e40af6074f78f3b4b29d118a5a8f7cc6e084c5ac7cc073f
6
+ metadata.gz: c1f64acaf2b19c689d5d11f7a9ce557a7f2d7ec1cf612bcd5bc710b303764289507c9e80d9b2541102203d0a125cb37f091ed843db58a1d9ddfd0357f7846a68
7
+ data.tar.gz: 4de514ded1d66d77b69a4510b26db4c74f549262c52266abedbf7ec573435409e689a23b86beacdcc550bfd0041561454d2fcc00afd9644b00a0a0150d54ac23
data/README.md CHANGED
@@ -26,11 +26,11 @@ instead of github.com issues. Please report issues there.
26
26
 
27
27
  There are unit and integration tests in the repository, to run them execute the following in the *Foreman core* directory:
28
28
 
29
- bundle exec rake test:discovery
29
+ bundle exec rake test:foreman_discovery
30
30
 
31
31
  It is possible to execute a single test, however the path must be *absolute* (e.g. use `$HOME` variable):
32
32
 
33
- bundle exec rake test:discovery TEST=~/work/foreman_discovery/test/unit/host_discovered_test.rb
33
+ bundle exec rake test:foreman_discovery TEST=~/work/foreman_discovery/test/unit/host_discovered_test.rb
34
34
 
35
35
  # Copyright
36
36
 
@@ -218,7 +218,7 @@ module Api
218
218
  :message => error_message
219
219
  }
220
220
  else
221
- process_success _("Discovered hosts are rebooting now")
221
+ process_success :success_msg => _("Discovered hosts are rebooting now")
222
222
  end
223
223
  end
224
224
 
@@ -83,7 +83,8 @@ class DiscoveredHostsController < ::ApplicationController
83
83
  ::ForemanDiscovery::HostConverter.set_build_clean_facts(host)
84
84
  ::ForemanDiscovery::HostConverter.unused_ip_for_host(host)
85
85
  if host.save
86
- success_options = { :success_redirect => host_path(host), :redirect_xhr => request.xhr? }
86
+ host_path = Setting['host_details_ui'] ? host_details_page_path(host) : host_path(host)
87
+ success_options = { :success_redirect => host_path, :redirect_xhr => request.xhr? }
87
88
  success_options[:success_msg] = success_message if success_message
88
89
  process_success success_options
89
90
  else
@@ -1,10 +1,3 @@
1
- <% content_for(:javascripts) do %>
2
- <%= webpacked_plugins_js_for :'foreman_discovery' %>
3
- <% end %>
4
- <% content_for(:stylesheets) do %>
5
- <%= webpacked_plugins_css_for :'foreman_discovery' %>
6
- <% end %>
7
-
8
1
  <% content_for(:title, _("Discovered Hosts")) %>
9
2
 
10
3
  <% content_for(:content) do %>
@@ -1,10 +1,3 @@
1
- <% content_for(:javascripts) do %>
2
- <%= webpacked_plugins_js_for :'foreman_discovery' %>
3
- <% end %>
4
- <% content_for(:stylesheets) do %>
5
- <%= webpacked_plugins_css_for :'foreman_discovery' %>
6
- <% end %>
7
-
8
1
  <% content_for(:title, _("Discovered Rules")) %>
9
2
 
10
3
  <% content_for(:content) do %>
@@ -30,7 +30,7 @@ module ForemanDiscovery
30
30
 
31
31
  initializer 'foreman_discovery.register_plugin', :before => :finisher_hook do |app|
32
32
  Foreman::Plugin.register :foreman_discovery do
33
- requires_foreman '>= 3.8'
33
+ requires_foreman '>= 3.10'
34
34
  register_gettext
35
35
 
36
36
  # settings
@@ -75,11 +75,10 @@ module ForemanDiscovery
75
75
  setting "discovery_hostname",
76
76
  type: :array,
77
77
  default: ["discovery_bootif"],
78
+ validate: { presence: true },
78
79
  full_name: N_("Hostname facts"),
79
80
  description: N_("List of facts to use for the hostname (first wins)")
80
81
 
81
- validates "discovery_hostname", presence: true
82
-
83
82
  setting "discovery_auto",
84
83
  type: :boolean,
85
84
  default: false,
@@ -95,11 +94,10 @@ module ForemanDiscovery
95
94
  setting "discovery_prefix",
96
95
  type: :string,
97
96
  default: "mac",
97
+ validate: { presence: true },
98
98
  full_name: N_("Hostname prefix"),
99
99
  description: N_("The default prefix to use for the host name, must start with a letter")
100
100
 
101
- validates "discovery_prefix", presence: true
102
-
103
101
  setting "discovery_fact_column",
104
102
  type: :array,
105
103
  default: [],
@@ -367,7 +365,7 @@ module ForemanDiscovery
367
365
  end
368
366
 
369
367
  rake_tasks do
370
- load "discovery.rake"
368
+ load "foreman_discovery.rake"
371
369
  Rake::Task['db:seed'].enhance do
372
370
  ForemanDiscovery::Engine.load_seed
373
371
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "23.0.0"
2
+ VERSION = "24.0.0"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # Setup Tests
2
2
  namespace :test do
3
3
  desc "Test Discovery plugin"
4
- Rake::TestTask.new(:discovery) do |t|
4
+ Rake::TestTask.new(:foreman_discovery) do |t|
5
5
  test_dir = File.join(File.dirname(__FILE__), '..', 'test')
6
6
  t.libs << ["test",test_dir]
7
7
  if ENV['FILE'] || ENV['TEST']
@@ -14,12 +14,13 @@ namespace :test do
14
14
  end
15
15
  end
16
16
  Rake::Task[:test].enhance do
17
- Rake::Task['test:discovery'].invoke
17
+ Rake::Task['test:foreman_discovery'].invoke
18
18
  end
19
19
 
20
20
  load 'tasks/jenkins.rake'
21
21
  if Rake::Task.task_defined?(:'jenkins:unit')
22
- Rake::Task["jenkins:unit"].enhance do
23
- Rake::Task['test:discovery'].invoke
22
+ # The "unit" tests also include system tests
23
+ Rake::Task["jenkins:unit"].enhance(['webpack:compile']) do
24
+ Rake::Task['test:foreman_discovery'].invoke
24
25
  end
25
26
  end
@@ -101,7 +101,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
101
101
 
102
102
  managed_host = Host.find(host.id)
103
103
  assert managed_host.build
104
- assert_redirected_to host_url(managed_host)
104
+ assert_redirected_to host_details_page_path(managed_host)
105
105
  assert_equal hostgroup.id, managed_host.hostgroup_id
106
106
  assert_match(/Successfully/, flash[:success])
107
107
  end
@@ -3,12 +3,6 @@ require_relative '../test_plugin_helper'
3
3
  class DiscoveryRulesControllerTest < ActionController::TestCase
4
4
  setup :initialize_host
5
5
 
6
- test "should add a link to navigation" do
7
- get :index, params: {}, session: set_session_user
8
- assert_response :success
9
- assert response.body =~ /\/discovery_rules/
10
- end
11
-
12
6
  test "reader role should get index" do
13
7
  get :index, params: {}, session: set_session_user_default_reader
14
8
  assert_response :success
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class ManagedExtensionsTest < ActiveSupport::TestCase
4
+ def test_discovery_rules_is_in_menu
5
+ menu = UserMenu.new.generate
6
+ assert_includes(menu, { name: 'Discovery Rules', url: '/discovery_rules' })
7
+ end
8
+ end
@@ -271,7 +271,8 @@ class HostDiscoveredTest < ActiveSupport::TestCase
271
271
  @facts["productname"] = "Dishwasher DW400"
272
272
  host2 = discover_host_from_facts(@facts)
273
273
  assert_equal 'mace41f13cc3658', host2.name
274
- assert_equal 'Dishwasher DW400', host2.facts["productname"]
274
+ # Bypass fact cache by using it as a method
275
+ assert_equal 'Dishwasher DW400', host2.facts('productname')['productname']
275
276
  assert_equal '10.35.27.2', host2.ip
276
277
  assert_equal 1, Host::Discovered.where(:name => 'mace41f13cc3658').count
277
278
  end
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: 23.0.0
4
+ version: 24.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aditi Puntambekar
@@ -76,7 +76,7 @@ authors:
76
76
  autorequire:
77
77
  bindir: bin
78
78
  cert_chain: []
79
- date: 2023-11-22 00:00:00.000000000 Z
79
+ date: 2024-02-16 00:00:00.000000000 Z
80
80
  dependencies: []
81
81
  description: MaaS Discovery Plugin engine for Foreman
82
82
  email: gsutclif@redhat.com
@@ -213,7 +213,7 @@ files:
213
213
  - db/seeds.d/90_add_permissions_from_default_roles.rb
214
214
  - extra/discover-host
215
215
  - extra/generate-authors-file
216
- - lib/discovery.rake
216
+ - lib/foreman_discovery.rake
217
217
  - lib/foreman_discovery.rb
218
218
  - lib/foreman_discovery/engine.rb
219
219
  - lib/foreman_discovery/version.rb
@@ -295,6 +295,7 @@ files:
295
295
  - test/functional/discovery_rules_controller_test.rb
296
296
  - test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb
297
297
  - test/integration/discovered_hosts_test.rb
298
+ - test/integration/menu_test.rb
298
299
  - test/migrations/20221102075151_migrate_discovery_hostname_and_fact_column_to_array_test.rb
299
300
  - test/migrations/20221102075151_migrate_discovery_hostname_and_fact_column_to_array_test.rb.orig
300
301
  - test/static_fixtures/redhat_kexec.erb
@@ -380,6 +381,7 @@ test_files:
380
381
  - test/functional/discovered_hosts_controller_test.rb
381
382
  - test/functional/discovery_rules_controller_test.rb
382
383
  - test/integration/discovered_hosts_test.rb
384
+ - test/integration/menu_test.rb
383
385
  - test/unit/ui_notifications/destroy_host_test.rb
384
386
  - test/unit/ui_notifications/new_host_test.rb
385
387
  - test/unit/discovered_mailer_test.rb