foreman_discovery 10.0.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/controllers/api/v2/discovered_hosts_controller.rb +1 -1
  4. data/app/controllers/api/v2/discovery_rules_controller.rb +2 -1
  5. data/app/controllers/concerns/foreman/controller/parameters/discovered_host.rb +9 -2
  6. data/app/controllers/discovered_hosts_controller.rb +16 -15
  7. data/app/controllers/discovery_rules_controller.rb +1 -1
  8. data/app/models/host/discovered.rb +10 -4
  9. data/app/models/host/managed_extensions.rb +4 -1
  10. data/app/views/foreman_discovery/debian_kexec.erb +1 -1
  11. data/db/migrate/20141107091416_create_discovery_rules.rb +1 -1
  12. data/db/migrate/20141107091417_add_discovery_rule_to_host.rb +1 -1
  13. data/db/migrate/20141126165451_add_discovery_id_to_subnet.rb +1 -1
  14. data/db/migrate/20141223101707_create_discovery_attribute_sets.rb +1 -1
  15. data/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb +1 -1
  16. data/db/migrate/20150302112545_remove_duplicate_tokens_from_hosts.rb +1 -1
  17. data/db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb +1 -1
  18. data/db/migrate/20150331132115_remove_old_permissions.rb +1 -1
  19. data/db/migrate/20150505111345_remove_leftover_tokens.rb +1 -1
  20. data/db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb +1 -1
  21. data/db/migrate/20150714144500_review_discovery_permissions.rb +1 -1
  22. data/db/migrate/20151023144501_regenerate_red_hat_kexec.rb +1 -1
  23. data/db/migrate/20160719124942_add_missing_view_permissions.rb +1 -1
  24. data/db/migrate/20160805104605_rename_lock_template_setting.rb +1 -1
  25. data/db/migrate/20160818091421_add_permissions_from_default_roles.rb +1 -1
  26. data/db/migrate/20160925213030_change_discovery_widget_names.rb +1 -1
  27. data/db/migrate/20160927164411_define_explicit_length_for_discovery_rule_attributes.rb +1 -1
  28. data/db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb +4 -1
  29. data/lib/foreman_discovery/engine.rb +2 -1
  30. data/lib/foreman_discovery/version.rb +1 -1
  31. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  32. data/locale/ca/foreman_discovery.edit.po +47 -38
  33. data/locale/ca/foreman_discovery.po +18 -11
  34. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  35. data/locale/de/foreman_discovery.edit.po +50 -42
  36. data/locale/de/foreman_discovery.po +21 -15
  37. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  38. data/locale/en/foreman_discovery.edit.po +51 -43
  39. data/locale/en/foreman_discovery.po +7 -1
  40. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/en_GB/foreman_discovery.edit.po +43 -35
  42. data/locale/en_GB/foreman_discovery.po +14 -8
  43. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  44. data/locale/es/foreman_discovery.edit.po +208 -200
  45. data/locale/es/foreman_discovery.po +179 -173
  46. data/locale/foreman_discovery.pot +52 -44
  47. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  48. data/locale/fr/foreman_discovery.edit.po +54 -46
  49. data/locale/fr/foreman_discovery.po +25 -19
  50. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  51. data/locale/gl/foreman_discovery.edit.po +37 -29
  52. data/locale/gl/foreman_discovery.po +8 -2
  53. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  54. data/locale/it/foreman_discovery.edit.po +51 -43
  55. data/locale/it/foreman_discovery.po +22 -16
  56. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  57. data/locale/ja/foreman_discovery.edit.po +184 -176
  58. data/locale/ja/foreman_discovery.po +155 -151
  59. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  60. data/locale/ko/foreman_discovery.edit.po +57 -49
  61. data/locale/ko/foreman_discovery.po +28 -22
  62. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  63. data/locale/pt_BR/foreman_discovery.edit.po +206 -198
  64. data/locale/pt_BR/foreman_discovery.po +177 -171
  65. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  66. data/locale/ru/foreman_discovery.edit.po +57 -49
  67. data/locale/ru/foreman_discovery.po +28 -22
  68. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  69. data/locale/sv_SE/foreman_discovery.edit.po +37 -29
  70. data/locale/sv_SE/foreman_discovery.po +8 -2
  71. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  72. data/locale/zh_CN/foreman_discovery.edit.po +204 -196
  73. data/locale/zh_CN/foreman_discovery.po +177 -169
  74. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  75. data/locale/zh_TW/foreman_discovery.edit.po +47 -39
  76. data/locale/zh_TW/foreman_discovery.po +18 -12
  77. data/test/factories/discovery_host_related.rb +2 -2
  78. data/test/factories/discovery_rule_related.rb +1 -1
  79. data/test/functional/api/v2/discovered_hosts_controller_test.rb +28 -27
  80. data/test/functional/api/v2/discovery_rules_controller_test.rb +14 -14
  81. data/test/functional/api/v2/fact_value_extensions_test.rb +5 -2
  82. data/test/functional/discovered_hosts_controller_test.rb +47 -40
  83. data/test/functional/discovery_rules_controller_test.rb +14 -14
  84. data/test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb +2 -2
  85. data/test/integration/discovered_hosts_test.rb +151 -0
  86. data/test/test_helper_discovery.rb +53 -23
  87. data/test/test_plugin_helper.rb +3 -7
  88. data/test/unit/discovered_extensions_test.rb +40 -38
  89. data/test/unit/discovered_mailer_test.rb +1 -1
  90. data/test/unit/discovery_attribute_set_test.rb +4 -2
  91. data/test/unit/discovery_rule_test.rb +2 -2
  92. data/test/unit/discovery_taxonomy_extensions_test.rb +1 -1
  93. data/test/unit/fact_parser_test.rb +1 -1
  94. data/test/unit/host_discovered_test.rb +26 -23
  95. data/test/unit/managed_extensions_test.rb +1 -1
  96. data/test/unit/ui_notifications/destroy_host_test.rb +21 -17
  97. data/test/unit/ui_notifications/new_host_test.rb +11 -11
  98. metadata +8 -3
  99. data/config/as_deprecation_whitelist.yaml +0 -0
@@ -5,10 +5,10 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 9.1.0\n"
8
+ "Project-Id-Version: foreman_discovery 10.0.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "POT-Creation-Date: 2017-10-17 15:39+0200\n"
11
- "PO-Revision-Date: 2017-10-17 23:23+0000\n"
10
+ "POT-Creation-Date: 2017-12-11 10:28+0100\n"
11
+ "PO-Revision-Date: 2017-12-11 11:31+0000\n"
12
12
  "Last-Translator: Lukáš Zapletal\n"
13
13
  "Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/language/zh_TW/)\n"
14
14
  "MIME-Version: 1.0\n"
@@ -97,7 +97,7 @@ msgid "Execute rules against a discovered host"
97
97
  msgstr "針對於一部發現的主機執行規則"
98
98
 
99
99
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:123
100
- #: ../app/controllers/discovered_hosts_controller.rb:152
100
+ #: ../app/controllers/discovered_hosts_controller.rb:150
101
101
  msgid "Host %{host} was provisioned with rule %{rule}"
102
102
  msgstr "主機 %{host} 已透過規則 %{rule} 佈建"
103
103
 
@@ -106,7 +106,7 @@ msgid "Unable to provision %{host}: %{errors}"
106
106
  msgstr "無法供給 %{host}:%{errors}"
107
107
 
108
108
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:132
109
- #: ../app/controllers/discovered_hosts_controller.rb:159
109
+ #: ../app/controllers/discovered_hosts_controller.rb:157
110
110
  msgid "No rule found for host %s"
111
111
  msgstr "未找到主機 %s 的規則"
112
112
 
@@ -115,12 +115,12 @@ msgid "Execute rules against all currently discovered hosts"
115
115
  msgstr "針對於所有目前已發現的主機執行規則"
116
116
 
117
117
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:143
118
- #: ../app/controllers/discovered_hosts_controller.rb:165
118
+ #: ../app/controllers/discovered_hosts_controller.rb:163
119
119
  msgid "Errors during auto provisioning: %s"
120
120
  msgstr "進行自動佈建時發生了錯誤:%s"
121
121
 
122
122
  #: ../app/controllers/api/v2/discovered_hosts_controller.rb:146
123
- #: ../app/controllers/discovered_hosts_controller.rb:168
123
+ #: ../app/controllers/discovered_hosts_controller.rb:166
124
124
  msgid "No discovered hosts to provision"
125
125
  msgstr "未發現可佈建的主機"
126
126
 
@@ -183,15 +183,23 @@ msgstr "按照順序排序規則,數字較小的優先。必須大於零"
183
183
  msgid "flag is used for temporary shutdown of rules"
184
184
  msgstr "旗標可用來暫時性關閉規則"
185
185
 
186
- #: ../app/controllers/api/v2/discovery_rules_controller.rb:43
186
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:39
187
+ msgid "location ID for provisioned hosts"
188
+ msgstr ""
189
+
190
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:40
191
+ msgid "organization ID for provisioned hosts"
192
+ msgstr ""
193
+
194
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:44
187
195
  msgid "Create a discovery rule"
188
196
  msgstr "建立一項搜尋規則"
189
197
 
190
- #: ../app/controllers/api/v2/discovery_rules_controller.rb:51
198
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:52
191
199
  msgid "Update a rule"
192
200
  msgstr "更新規則"
193
201
 
194
- #: ../app/controllers/api/v2/discovery_rules_controller.rb:59
202
+ #: ../app/controllers/api/v2/discovery_rules_controller.rb:60
195
203
  msgid "Delete a rule"
196
204
  msgstr "刪除規則"
197
205
 
@@ -251,59 +259,59 @@ msgstr "重新啟動主機 %{hostname} 失敗,錯誤訊息為 %{error_message}
251
259
  msgid "Failed to reboot hosts with error %s"
252
260
  msgstr "重新啟動主機失敗,錯誤訊息為 %s"
253
261
 
254
- #: ../app/controllers/discovered_hosts_controller.rb:142
262
+ #: ../app/controllers/discovered_hosts_controller.rb:140
255
263
  msgid "Destroyed selected hosts"
256
264
  msgstr "刪除選擇的主機"
257
265
 
258
- #: ../app/controllers/discovered_hosts_controller.rb:144
266
+ #: ../app/controllers/discovered_hosts_controller.rb:142
259
267
  msgid "The following hosts were not deleted: %s"
260
268
  msgstr "下列主機尚未刪除:%s"
261
269
 
262
- #: ../app/controllers/discovered_hosts_controller.rb:156
270
+ #: ../app/controllers/discovered_hosts_controller.rb:154
263
271
  msgid "Failed to auto provision host %s: %s"
264
272
  msgstr "自動佈建主機 %s 失敗:%s"
265
273
 
266
- #: ../app/controllers/discovered_hosts_controller.rb:184
274
+ #: ../app/controllers/discovered_hosts_controller.rb:182
267
275
  msgid "Discovered hosts are provisioning now"
268
276
  msgstr "發現的主機現在正在佈建"
269
277
 
270
- #: ../app/controllers/discovered_hosts_controller.rb:213
278
+ #: ../app/controllers/discovered_hosts_controller.rb:214
271
279
  msgid "Highlights"
272
280
  msgstr ""
273
281
 
274
- #: ../app/controllers/discovered_hosts_controller.rb:213
282
+ #: ../app/controllers/discovered_hosts_controller.rb:214
275
283
  msgid "Storage"
276
284
  msgstr "儲存裝置"
277
285
 
278
- #: ../app/controllers/discovered_hosts_controller.rb:213
286
+ #: ../app/controllers/discovered_hosts_controller.rb:214
279
287
  msgid "Hardware"
280
- msgstr ""
288
+ msgstr "硬體"
281
289
 
282
- #: ../app/controllers/discovered_hosts_controller.rb:213
290
+ #: ../app/controllers/discovered_hosts_controller.rb:214
283
291
  msgid "Network"
284
- msgstr ""
292
+ msgstr "網路"
285
293
 
286
- #: ../app/controllers/discovered_hosts_controller.rb:213
294
+ #: ../app/controllers/discovered_hosts_controller.rb:214
287
295
  msgid "Software"
288
- msgstr ""
296
+ msgstr "軟體"
289
297
 
290
- #: ../app/controllers/discovered_hosts_controller.rb:213
298
+ #: ../app/controllers/discovered_hosts_controller.rb:214
291
299
  msgid "IPMI"
292
- msgstr ""
300
+ msgstr "IPMI"
293
301
 
294
- #: ../app/controllers/discovered_hosts_controller.rb:213
302
+ #: ../app/controllers/discovered_hosts_controller.rb:214
295
303
  msgid "Miscellaneous"
296
- msgstr ""
304
+ msgstr "雜項"
297
305
 
298
- #: ../app/controllers/discovered_hosts_controller.rb:290
306
+ #: ../app/controllers/discovered_hosts_controller.rb:291
299
307
  msgid "No hosts were found with that id or name"
300
308
  msgstr "沒有找到擁有此 ID 或名稱的主機"
301
309
 
302
- #: ../app/controllers/discovered_hosts_controller.rb:294
310
+ #: ../app/controllers/discovered_hosts_controller.rb:295
303
311
  msgid "No hosts selected"
304
312
  msgstr "未選擇主機"
305
313
 
306
- #: ../app/controllers/discovered_hosts_controller.rb:300
314
+ #: ../app/controllers/discovered_hosts_controller.rb:301
307
315
  msgid "Something went wrong while selecting hosts - %s"
308
316
  msgstr "選擇主機時發生了錯誤 - %s"
309
317
 
@@ -491,23 +499,23 @@ msgstr "無法透過 %{url} 在 %{name} 上執行 kexec:%{msg}"
491
499
  msgid "Invalid hostname: Could not normalize the hostname"
492
500
  msgstr ""
493
501
 
494
- #: ../app/models/host/managed_extensions.rb:20
502
+ #: ../app/models/host/managed_extensions.rb:23
495
503
  msgid "Reloading kernel on %s"
496
504
  msgstr "在 %s 上重新載入 kernel"
497
505
 
498
- #: ../app/models/host/managed_extensions.rb:22
506
+ #: ../app/models/host/managed_extensions.rb:25
499
507
  msgid "Rebooting %s"
500
508
  msgstr "重新啟動 %s"
501
509
 
502
- #: ../app/models/host/managed_extensions.rb:43
510
+ #: ../app/models/host/managed_extensions.rb:46
503
511
  msgid "Kexec template not associated with operating system"
504
512
  msgstr "kexec 範本並不與作業系統相關連"
505
513
 
506
- #: ../app/models/host/managed_extensions.rb:48
514
+ #: ../app/models/host/managed_extensions.rb:51
507
515
  msgid "Kernel kexec URL is invalid: '%s'"
508
516
  msgstr ""
509
517
 
510
- #: ../app/models/host/managed_extensions.rb:49
518
+ #: ../app/models/host/managed_extensions.rb:52
511
519
  msgid "Init RAM kexec URL is invalid: '%s'"
512
520
  msgstr ""
513
521
 
@@ -818,11 +826,11 @@ msgstr "發現的主機:%s"
818
826
 
819
827
  #: ../app/views/discovered_hosts/show.html.erb:34
820
828
  msgid "Interfaces"
821
- msgstr ""
829
+ msgstr "介面"
822
830
 
823
831
  #: ../app/views/discovered_hosts/show.html.erb:41
824
832
  msgid "Type"
825
- msgstr ""
833
+ msgstr "種類"
826
834
 
827
835
  #: ../app/views/discovered_hosts/show.html.erb:42
828
836
  msgid "Identifier"
@@ -912,7 +920,7 @@ msgstr "已佈建之主機的主機名稱"
912
920
 
913
921
  #: ../app/views/discovery_rules/_form.html.erb:26
914
922
  msgid "Hosts Limit"
915
- msgstr ""
923
+ msgstr "主機限制"
916
924
 
917
925
  #: ../app/views/discovery_rules/_form.html.erb:26
918
926
  msgid "Maximum hosts provisioned with this rule (0 = unlimited)"
@@ -978,7 +986,7 @@ msgstr "查詢"
978
986
 
979
987
  #: ../app/views/discovery_rules/index.html.erb:9
980
988
  msgid "Host Group"
981
- msgstr ""
989
+ msgstr "主機群組"
982
990
 
983
991
  #: ../app/views/discovery_rules/index.html.erb:10
984
992
  msgid "Hosts/Limit"
@@ -998,7 +1006,7 @@ msgstr ""
998
1006
 
999
1007
  #: ../db/seeds.d/80_discovery_ui_notification.rb:4
1000
1008
  msgid "Hosts"
1001
- msgstr ""
1009
+ msgstr "主機"
1002
1010
 
1003
1011
  #: ../db/seeds.d/80_discovery_ui_notification.rb:6
1004
1012
  msgid "One or more hosts have been discovered"
@@ -5,9 +5,9 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 9.1.0\n"
8
+ "Project-Id-Version: foreman_discovery 10.0.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "PO-Revision-Date: 2017-10-17 23:23+0000\n"
10
+ "PO-Revision-Date: 2017-12-11 11:31+0000\n"
11
11
  "Last-Translator: Lukáš Zapletal\n"
12
12
  "Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/lang"
13
13
  "uage/zh_TW/)\n"
@@ -261,7 +261,7 @@ msgid "Foreman discovered hosts summary"
261
261
  msgstr ""
262
262
 
263
263
  msgid "Hardware"
264
- msgstr ""
264
+ msgstr "硬體"
265
265
 
266
266
  msgid "Hardware facts"
267
267
  msgstr ""
@@ -279,7 +279,7 @@ msgid "Host %{host} was provisioned with rule %{rule}"
279
279
  msgstr "主機 %{host} 已透過規則 %{rule} 佈建"
280
280
 
281
281
  msgid "Host Group"
282
- msgstr ""
282
+ msgstr "主機群組"
283
283
 
284
284
  msgid "Host group location %s must also be associated to the discovery rule"
285
285
  msgid_plural "Host group locations %s must also be associated to the discovery rule"
@@ -307,10 +307,10 @@ msgid "Hostnames must not start with numbers. A good approach is to use unique i
307
307
  msgstr ""
308
308
 
309
309
  msgid "Hosts"
310
- msgstr ""
310
+ msgstr "主機"
311
311
 
312
312
  msgid "Hosts Limit"
313
- msgstr ""
313
+ msgstr "主機限制"
314
314
 
315
315
  msgid "Hosts/Limit"
316
316
  msgstr ""
@@ -325,7 +325,7 @@ msgid "IP address"
325
325
  msgstr "IP 位址"
326
326
 
327
327
  msgid "IPMI"
328
- msgstr ""
328
+ msgstr "IPMI"
329
329
 
330
330
  msgid "IPMI facts"
331
331
  msgstr ""
@@ -349,7 +349,7 @@ msgid "Interface fact"
349
349
  msgstr ""
350
350
 
351
351
  msgid "Interfaces"
352
- msgstr ""
352
+ msgstr "介面"
353
353
 
354
354
  msgid "Invalid facts, must be a Hash"
355
355
  msgstr "詳情無效,必須是雜湊"
@@ -412,7 +412,7 @@ msgid "Memory"
412
412
  msgstr "記憶體"
413
413
 
414
414
  msgid "Miscellaneous"
415
- msgstr ""
415
+ msgstr "雜項"
416
416
 
417
417
  msgid "Model"
418
418
  msgstr "型號"
@@ -427,7 +427,7 @@ msgid "Name"
427
427
  msgstr "名稱"
428
428
 
429
429
  msgid "Network"
430
- msgstr ""
430
+ msgstr "網路"
431
431
 
432
432
  msgid "Network facts"
433
433
  msgstr ""
@@ -583,7 +583,7 @@ msgid "Show a discovery rule"
583
583
  msgstr "顯示搜尋規則"
584
584
 
585
585
  msgid "Software"
586
- msgstr ""
586
+ msgstr "軟體"
587
587
 
588
588
  msgid "Software facts"
589
589
  msgstr ""
@@ -637,7 +637,7 @@ msgid "This page shows discovered bare-metal or virtual nodes waiting to be prov
637
637
  msgstr ""
638
638
 
639
639
  msgid "Type"
640
- msgstr ""
640
+ msgstr "種類"
641
641
 
642
642
  msgid "UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks"
643
643
  msgstr "用來追蹤協調流程任務狀態的 UUID,GET /api/orchestration/:UUID/tasks"
@@ -690,6 +690,9 @@ msgstr "包含主機詳情的雜湊,其中有最基本的詳情:discovery_bo
690
690
  msgid "items selected. Uncheck to Clear"
691
691
  msgstr "已選取項目。反選以清除"
692
692
 
693
+ msgid "location ID for provisioned hosts"
694
+ msgstr ""
695
+
693
696
  msgid "must start with a letter or ERB."
694
697
  msgstr "必須以字母或是 ERB 作為起始。"
695
698
 
@@ -702,6 +705,9 @@ msgstr "若是使用一個含有 DHCP 協定的子網路則不需要"
702
705
  msgid "number of entries per request"
703
706
  msgstr "每個請求的項目數量"
704
707
 
708
+ msgid "organization ID for provisioned hosts"
709
+ msgstr ""
710
+
705
711
  msgid "paginate results"
706
712
  msgstr "編頁結果"
707
713
 
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :discovered_host, class: 'Host::Discovered' do
3
3
  sequence(:name) { |n| "host#{n}" }
4
4
  sequence(:ip) { |n| IPAddr.new(n, Socket::AF_INET).to_s }
@@ -18,7 +18,7 @@ FactoryGirl.define do
18
18
 
19
19
  after(:create) do |discovered_host, evaluator|
20
20
  evaluator.fact_count.times do
21
- FactoryGirl.create(:fact_value, :host => discovered_host)
21
+ FactoryBot.create(:fact_value, :host => discovered_host)
22
22
  end
23
23
  end
24
24
  end
@@ -1,4 +1,4 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :discovery_rule do
3
3
  sequence(:name) { |n| "rule#{n}" }
4
4
  sequence(:priority) { |n| n }
@@ -12,7 +12,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
12
12
  setup do
13
13
  SETTINGS[:organizations_enabled] = true
14
14
  SETTINGS[:locations_enabled] = true
15
- FactoryGirl.create(:subnet, :network => "192.168.100.1", :mask => "255.255.255.0", :locations => [location_one], :organizations => [organization_one])
15
+ FactoryBot.create(:subnet, :network => "192.168.100.1", :mask => "255.255.255.0", :locations => [location_one], :organizations => [organization_one])
16
16
  @request.env['HTTP_REFERER'] = '/discovery_rules'
17
17
  @facts = {
18
18
  "interfaces" => "lo,eth0",
@@ -28,15 +28,15 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
28
28
  end
29
29
 
30
30
  def test_get_index
31
- get :index, { }
31
+ get :index, params: { }
32
32
  assert_response :success
33
33
  end
34
34
 
35
35
  def test_show_host
36
- FactoryGirl.create(:organization, :name => 'SomeOrg')
37
- FactoryGirl.create(:location, :name => 'SomeLoc')
36
+ FactoryBot.create(:organization, :name => 'SomeOrg')
37
+ FactoryBot.create(:location, :name => 'SomeLoc')
38
38
  host = discover_host_from_facts(@facts)
39
- get :show, { :id => host.id }
39
+ get :show, params: { :id => host.id }
40
40
  assert_response :success
41
41
  show_response = ActiveSupport::JSON.decode(@response.body)
42
42
  assert_equal "macaabbccddeeff", show_response["name"]
@@ -49,20 +49,21 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
49
49
 
50
50
  def test_delete_discovered_host
51
51
  host = discover_host_from_facts(@facts)
52
- delete :destroy, { :id => host.id }
52
+ delete :destroy, params: { :id => host.id }
53
53
  assert_response :success
54
54
  end
55
55
 
56
56
  def test_provision_host
57
- FactoryGirl.create(:organization, :name => 'SomeOrg')
58
- FactoryGirl.create(:location, :name => 'SomeLoc')
57
+ FactoryBot.create(:organization, :name => 'SomeOrg')
58
+ FactoryBot.create(:location, :name => 'SomeLoc')
59
59
  host = discover_host_from_facts(@facts)
60
60
  hostgroup = setup_hostgroup(host)
61
- put :update,
61
+ put :update, params: {
62
62
  id: host.id,
63
63
  discovered_host: {
64
64
  hostgroup_id: hostgroup.id
65
65
  }
66
+ }
66
67
 
67
68
  assert_match(/#{host.name}/, @response.body)
68
69
  assert_response :success
@@ -86,8 +87,8 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
86
87
  disable_orchestration
87
88
  facts = @facts.merge({"somefact" => "abc"})
88
89
  taxonomy = { :organizations => [organization_one], :locations => [location_one] }
89
- DiscoveryRule.create({:priority => 1, :name => 'rule', :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
90
- post :facts, { :facts => facts }
90
+ DiscoveryRule.create({:priority => 1, :name => 'rule', :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
91
+ post :facts, params: { :facts => facts }
91
92
 
92
93
  assert_response :success
93
94
  actual = JSON.parse(response.body)
@@ -103,8 +104,8 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
103
104
  facts = @facts.merge({"somefact" => "abc", "discovery_version" => "2.9.9"})
104
105
  host = discover_host_from_facts(facts)
105
106
  taxonomy = { :organizations => [host.organization], :locations => [host.location] }
106
- rule = FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
107
- post :auto_provision, { :id => host.id }
107
+ rule = FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
108
+ post :auto_provision, params: { :id => host.id }
108
109
  assert_match(/Host #{host.name} was provisioned with rule #{rule.name}/, @response.body)
109
110
  managed_host = Host.unscoped.find(host.id)
110
111
  assert managed_host.build
@@ -117,8 +118,8 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
117
118
  facts = @facts.merge({"somefact" => "abc", "discovery_kexec" => "kexec-tools 2.0.8 released 15 February 2015"})
118
119
  host = discover_host_from_facts(facts)
119
120
  taxonomy = { :organizations => [host.organization], :locations => [host.location] }
120
- rule = FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
121
- post :auto_provision, { :id => host.id }
121
+ rule = FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
122
+ post :auto_provision, params: { :id => host.id }
122
123
  assert_match(/Host #{host.name} was provisioned with rule #{rule.name}/, @response.body)
123
124
  managed_host = Host.unscoped.find(host.id)
124
125
  assert managed_host.build
@@ -129,9 +130,9 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
129
130
  disable_orchestration
130
131
  facts = @facts.merge({"somefact" => "abc"})
131
132
  host = discover_host_from_facts(facts)
132
- taxonomy = { :organizations => [FactoryGirl.create(:organization)], :locations => [FactoryGirl.create(:location)] }
133
- FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
134
- post :auto_provision, { :id => host.id }
133
+ taxonomy = { :organizations => [FactoryBot.create(:organization)], :locations => [FactoryBot.create(:location)] }
134
+ FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
135
+ post :auto_provision, params: { :id => host.id }
135
136
  show_response = ActiveSupport::JSON.decode(@response.body)
136
137
  assert_equal "No rule found for host #{host.name}", show_response["error"]["message"]
137
138
  end
@@ -142,8 +143,8 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
142
143
  facts = @facts.merge({"somefact" => "abc"})
143
144
  host = discover_host_from_facts(facts)
144
145
  taxonomy = { :locations => [host.location] }
145
- FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
146
- post :auto_provision, { :id => host.id }
146
+ FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
147
+ post :auto_provision, params: { :id => host.id }
147
148
  assert_match host.name, @response.body
148
149
  assert_response :success
149
150
  ensure
@@ -155,12 +156,12 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
155
156
  facts = @facts.merge({"somefact" => "abc"})
156
157
  host = discover_host_from_facts(facts)
157
158
  taxonomy = { :organizations => [host.organization], :locations => [host.location] }
158
- FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
159
- post :auto_provision, { :id => host.id }
159
+ FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
160
+ post :auto_provision, params: { :id => host.id }
160
161
  assert_response :success
161
162
  # test deletion of a managed host
162
163
  switch_controller(::Api::V2::HostsController) do
163
- delete :destroy, { :id => host.id }
164
+ delete :destroy, params: { :id => host.id }
164
165
  assert_match host.name, @response.body
165
166
  assert_response :success
166
167
  end
@@ -170,7 +171,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
170
171
  disable_orchestration
171
172
  facts = @facts.merge({"somefact" => "abc"})
172
173
  host = discover_host_from_facts(facts)
173
- post :auto_provision, { :id => host.id }
174
+ post :auto_provision, params: { :id => host.id }
174
175
  assert_response :not_found
175
176
  show_response = ActiveSupport::JSON.decode(@response.body)
176
177
  assert_equal "No rule found for host #{host.name}", show_response["error"]["message"]
@@ -181,8 +182,8 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
181
182
  facts = @facts.merge({"somefact" => "abc"})
182
183
  host = discover_host_from_facts(facts)
183
184
  taxonomy = { :organizations => [host.organization], :locations => [host.location] }
184
- FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
185
- post :auto_provision_all, {}
185
+ FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
186
+ post :auto_provision_all, params: {}
186
187
  assert_match(/1 discovered hosts were provisioned/, @response.body)
187
188
  managed_host = Host.unscoped.find(host.id)
188
189
  assert managed_host.build
@@ -193,7 +194,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
193
194
  disable_orchestration
194
195
  facts = @facts.merge({"somefact" => "abc"})
195
196
  discover_host_from_facts(facts)
196
- post :auto_provision_all, {}
197
+ post :auto_provision_all, params: {}
197
198
  assert_match(/0 discovered hosts were provisioned/, @response.body)
198
199
  assert_response :success
199
200
  end