foreman_discovery 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/controllers/api/v2/discovered_hosts_controller.rb +6 -4
  4. data/app/controllers/api/v2/discovery_rules_controller.rb +3 -2
  5. data/app/controllers/concerns/foreman/controller/parameters/discovered_host.rb +24 -0
  6. data/app/controllers/concerns/foreman/controller/parameters/discovery_rule.rb +17 -0
  7. data/app/controllers/discovered_hosts_controller.rb +3 -2
  8. data/app/controllers/discovery_rules_controller.rb +4 -2
  9. data/app/helpers/discovered_hosts_helper.rb +7 -10
  10. data/app/models/concerns/discovery_subnet.rb +0 -2
  11. data/app/models/concerns/fact_value_extensions.rb +5 -0
  12. data/app/models/discovery_attribute_set.rb +0 -1
  13. data/app/models/discovery_rule.rb +0 -2
  14. data/app/models/host/discovered.rb +0 -2
  15. data/app/models/host/managed_extensions.rb +1 -3
  16. data/app/models/hostgroup_extensions.rb +0 -1
  17. data/app/models/nic/managed_extensions.rb +26 -0
  18. data/app/models/setting/discovered.rb +1 -0
  19. data/app/views/discovered_hosts/_discovered_host_modal.html.erb +30 -0
  20. data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +1 -29
  21. data/app/views/discovered_hosts/show.html.erb +20 -12
  22. data/app/views/discovery_rules/_form.html.erb +1 -1
  23. data/app/views/foreman_discovery/debian_kexec.erb +2 -3
  24. data/app/views/foreman_discovery/redhat_kexec.erb +2 -3
  25. data/lib/foreman_discovery/engine.rb +8 -1
  26. data/lib/foreman_discovery/version.rb +1 -1
  27. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  28. data/locale/ca/foreman_discovery.edit.po +1 -1
  29. data/locale/ca/foreman_discovery.po +2 -2
  30. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  31. data/locale/de/foreman_discovery.edit.po +33 -33
  32. data/locale/de/foreman_discovery.po +67 -67
  33. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  34. data/locale/en/foreman_discovery.edit.po +138 -130
  35. data/locale/en/foreman_discovery.po +13 -7
  36. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  37. data/locale/en_GB/foreman_discovery.edit.po +34 -33
  38. data/locale/en_GB/foreman_discovery.po +33 -32
  39. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  40. data/locale/es/foreman_discovery.edit.po +51 -51
  41. data/locale/es/foreman_discovery.po +51 -51
  42. data/locale/foreman_discovery.pot +151 -144
  43. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  44. data/locale/fr/foreman_discovery.edit.po +1 -1
  45. data/locale/fr/foreman_discovery.po +33 -33
  46. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  47. data/locale/gl/foreman_discovery.edit.po +1 -1
  48. data/locale/gl/foreman_discovery.po +2 -2
  49. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  50. data/locale/it/foreman_discovery.edit.po +5 -5
  51. data/locale/it/foreman_discovery.po +5 -5
  52. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  53. data/locale/ja/foreman_discovery.edit.po +37 -37
  54. data/locale/ja/foreman_discovery.po +36 -36
  55. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  56. data/locale/ko/foreman_discovery.edit.po +36 -36
  57. data/locale/ko/foreman_discovery.po +35 -35
  58. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  59. data/locale/pt_BR/foreman_discovery.edit.po +40 -40
  60. data/locale/pt_BR/foreman_discovery.po +39 -39
  61. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  62. data/locale/ru/foreman_discovery.edit.po +8 -8
  63. data/locale/ru/foreman_discovery.po +8 -8
  64. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  65. data/locale/sv_SE/foreman_discovery.edit.po +1 -1
  66. data/locale/sv_SE/foreman_discovery.po +2 -2
  67. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  68. data/locale/zh_CN/foreman_discovery.edit.po +37 -37
  69. data/locale/zh_CN/foreman_discovery.po +36 -36
  70. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  71. data/locale/zh_TW/foreman_discovery.edit.po +36 -36
  72. data/locale/zh_TW/foreman_discovery.po +35 -35
  73. data/test/factories/discovery_rule_related.rb +19 -2
  74. data/test/functional/api/v2/discovered_hosts_controller_test.rb +1 -0
  75. data/test/functional/api/v2/discovery_rules_controller_test.rb +13 -5
  76. data/test/functional/discovered_hosts_controller_test.rb +71 -3
  77. data/test/functional/discovery_rules_controller_test.rb +23 -6
  78. data/test/test_helper_discovery.rb +4 -0
  79. data/test/unit/discovered_extensions_test.rb +2 -0
  80. data/test/unit/fact_value_extensions_test.rb +11 -0
  81. metadata +9 -3
@@ -20,37 +20,54 @@ class DiscoveryRulesControllerTest < ActionController::TestCase
20
20
  assert_response :success
21
21
  end
22
22
 
23
- test "should create discovery rule" do
23
+ test "should create discovery rule without taxonomy" do
24
24
  assert_difference('DiscoveryRule.count') do
25
25
  post :create, {:discovery_rule => {
26
26
  :name => "foo",
27
- :search => "bar",
27
+ :search => "cpu_count = 42",
28
28
  :hostgroup_id => 1,
29
29
  :hostname => "",
30
30
  :priority => 1}}, set_session_user_default_manager
31
+ assert_empty(extract_form_errors(response))
31
32
  end
33
+ assert_redirected_to discovery_rules_path
34
+ end
32
35
 
36
+ test "should create discovery rule with taxonomy" do
37
+ assert_difference('DiscoveryRule.count') do
38
+ hostgroup = FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, :organizations => [Organization.first], :locations => [Location.first])
39
+ post :create, {:discovery_rule => {
40
+ :name => "foo",
41
+ :search => "cpu_count = 42",
42
+ :hostgroup_id => hostgroup.id,
43
+ :organization_ids => [Organization.first],
44
+ :location_ids => [Location.first.id],
45
+ :hostname => "",
46
+ :priority => 1}}, set_session_user_default_manager
47
+ assert_empty(extract_form_errors(response))
48
+ end
33
49
  assert_redirected_to discovery_rules_path
34
50
  end
35
51
 
36
52
  test "should get edit" do
37
53
  rule = FactoryGirl.create(:discovery_rule)
38
- get :edit, {:id => rule.to_param}, set_session_user_default_manager
54
+ get :edit, {:id => rule.id}, set_session_user_default_manager
39
55
  assert_response :success
40
56
  end
41
57
 
42
58
  test "should update discovery rule" do
43
59
  rule = FactoryGirl.create(:discovery_rule)
44
- put :update, {:id => rule.to_param, :discovery_rule => {}}, set_session_user_default_manager
60
+ put :update, {:id => rule.id, :discovery_rule => {:name => "new_name"}}, set_session_user_default_manager
61
+ assert_nil flash[:error]
45
62
  assert_redirected_to discovery_rules_path
46
63
  end
47
64
 
48
65
  test "should destroy discovery rule" do
49
66
  rule = FactoryGirl.create(:discovery_rule)
50
67
  assert_difference('DiscoveryRule.count', -1) do
51
- delete :destroy, {:id => rule.to_param}, set_session_user_default_manager
68
+ delete :destroy, {:id => rule.id}, set_session_user_default_manager
52
69
  end
53
-
70
+ assert_nil flash[:error]
54
71
  assert_redirected_to discovery_rules_path
55
72
  end
56
73
 
@@ -22,3 +22,7 @@ end
22
22
  def set_session_user_default_manager
23
23
  set_session_user_with_perms Foreman::Plugin.find('foreman_discovery').default_roles['Discovery Manager']
24
24
  end
25
+
26
+ def extract_form_errors(response)
27
+ response.body.scan(/error-message[^<]*</)
28
+ end
@@ -181,6 +181,8 @@ class FindDiscoveryRulesTest < ActiveSupport::TestCase
181
181
  assert managed_host = perform_auto_provision(host, r1)
182
182
  assert_empty managed_host.errors
183
183
  assert_equal hostgroup.environment, managed_host.environment
184
+ assert_equal hostgroup.puppet_proxy, managed_host.puppet_proxy
185
+ assert_equal hostgroup.puppet_ca_proxy, managed_host.puppet_ca_proxy
184
186
  end
185
187
 
186
188
  def setup_normal_renderer
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class FactValueExtensionsTest < ActiveSupport::TestCase
4
+ describe '.host' do
5
+ test 'returns discovered_host' do
6
+ discovered_host = FactoryGirl.create(:discovered_host, :with_facts, :fact_count => 1)
7
+ fact_value = discovered_host.fact_values.first
8
+ assert fact_value.discovered_host, fact_value.host
9
+ end
10
+ end
11
+ 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: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amos Benari
@@ -32,7 +32,7 @@ authors:
32
32
  autorequire:
33
33
  bindir: bin
34
34
  cert_chain: []
35
- date: 2016-07-29 00:00:00.000000000 Z
35
+ date: 2016-08-30 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: deface
@@ -62,6 +62,8 @@ files:
62
62
  - app/controllers/api/v2/discovery_rules_controller.rb
63
63
  - app/controllers/api/v2/fact_values_controller_extensions.rb
64
64
  - app/controllers/concerns/foreman/controller/discovered_extensions.rb
65
+ - app/controllers/concerns/foreman/controller/parameters/discovered_host.rb
66
+ - app/controllers/concerns/foreman/controller/parameters/discovery_rule.rb
65
67
  - app/controllers/discovered_hosts_controller.rb
66
68
  - app/controllers/discovery_rules_controller.rb
67
69
  - app/helpers/discovered_hosts_helper.rb
@@ -76,6 +78,7 @@ files:
76
78
  - app/models/host/discovered.rb
77
79
  - app/models/host/managed_extensions.rb
78
80
  - app/models/hostgroup_extensions.rb
81
+ - app/models/nic/managed_extensions.rb
79
82
  - app/models/setting/discovered.rb
80
83
  - app/overrides/subnet_form_with_discovery_proxy.rb
81
84
  - app/services/foreman_discovery/fact_parser.rb
@@ -99,6 +102,7 @@ files:
99
102
  - app/views/dashboard/_discovery_widget_host.html.erb
100
103
  - app/views/dashboard/_discovery_widget_host_list.html.erb
101
104
  - app/views/discovered_hosts/_discovered_host.html.erb
105
+ - app/views/discovered_hosts/_discovered_host_modal.html.erb
102
106
  - app/views/discovered_hosts/_discovered_hosts_list.html.erb
103
107
  - app/views/discovered_hosts/_selected_hosts.html.erb
104
108
  - app/views/discovered_hosts/index.html.erb
@@ -209,12 +213,13 @@ files:
209
213
  - test/unit/discovery_rule_test.rb
210
214
  - test/unit/discovery_taxonomy_extensions_test.rb
211
215
  - test/unit/fact_parser_test.rb
216
+ - test/unit/fact_value_extensions_test.rb
212
217
  - test/unit/facts.json
213
218
  - test/unit/host_discovered_test.rb
214
219
  - test/unit/setting_discovered_test.rb
215
220
  homepage: http://github.com/theforeman/foreman_discovery
216
221
  licenses:
217
- - GPL-3
222
+ - GPL-3.0
218
223
  metadata: {}
219
224
  post_install_message:
220
225
  rdoc_options: []
@@ -248,6 +253,7 @@ test_files:
248
253
  - test/unit/discovery_attribute_set_test.rb
249
254
  - test/unit/setting_discovered_test.rb
250
255
  - test/unit/facts.json
256
+ - test/unit/fact_value_extensions_test.rb
251
257
  - test/unit/discovered_mailer_test.rb
252
258
  - test/unit/discovery_taxonomy_extensions_test.rb
253
259
  - test/unit/discovery_rule_test.rb