foreman_discovery 17.0.4 → 18.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/discovered_hosts_controller.rb +10 -3
  3. data/app/controllers/discovery_rules_controller.rb +1 -1
  4. data/app/helpers/discovered_hosts_helper.rb +3 -2
  5. data/app/models/discovery_fact_name.rb +9 -0
  6. data/app/services/discovery_fact_importer.rb +5 -0
  7. data/app/services/foreman_discovery/host_converter.rb +3 -3
  8. data/app/views/discovered_hosts/welcome.html.erb +1 -2
  9. data/app/views/discovery_rules/welcome.html.erb +1 -2
  10. data/lib/foreman_discovery/engine.rb +3 -1
  11. data/lib/foreman_discovery/version.rb +1 -1
  12. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  13. data/locale/ca/foreman_discovery.po +13 -7
  14. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  15. data/locale/de/foreman_discovery.po +11 -5
  16. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  17. data/locale/en/foreman_discovery.po +7 -1
  18. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  19. data/locale/en_GB/foreman_discovery.po +8 -2
  20. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  21. data/locale/es/foreman_discovery.po +11 -5
  22. data/locale/foreman_discovery.pot +38 -30
  23. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  24. data/locale/fr/foreman_discovery.po +57 -51
  25. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  26. data/locale/gl/foreman_discovery.po +11 -5
  27. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  28. data/locale/it/foreman_discovery.po +11 -5
  29. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  30. data/locale/ja/foreman_discovery.po +43 -37
  31. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  32. data/locale/ko/foreman_discovery.po +11 -5
  33. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  34. data/locale/pt_BR/foreman_discovery.po +11 -5
  35. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  36. data/locale/ru/foreman_discovery.po +15 -9
  37. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  38. data/locale/sv_SE/foreman_discovery.po +11 -5
  39. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  40. data/locale/zh_CN/foreman_discovery.po +59 -53
  41. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  42. data/locale/zh_TW/foreman_discovery.po +11 -5
  43. data/package.json +1 -1
  44. data/test/functional/api/v2/fact_value_extensions_test.rb +1 -4
  45. data/test/functional/discovered_hosts_controller_test.rb +6 -5
  46. data/test/integration/discovered_hosts_test.rb +10 -4
  47. data/test/test_helper_discovery.rb +35 -27
  48. data/test/test_plugin_helper.rb +7 -0
  49. data/test/unit/discovered_extensions_test.rb +36 -16
  50. data/test/unit/discovery_attribute_set_test.rb +2 -8
  51. data/test/unit/fact_parser_test.rb +1 -4
  52. metadata +9 -12
  53. data/test/functional/api/v2/settings_controller_test.rb +0 -22
  54. data/test/models/setting_test.rb +0 -11
  55. data/test/unit/setting_discovered_test.rb +0 -9
@@ -5,9 +5,9 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 16.3.4\n"
8
+ "Project-Id-Version: foreman_discovery 17.1.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "PO-Revision-Date: 2021-01-25 08:35+0000\n"
10
+ "PO-Revision-Date: 2021-05-18 15:01+0000\n"
11
11
  "Last-Translator: Amit Upadhye <aupadhye@redhat.com>\n"
12
12
  "Language-Team: Chinese (China) (http://www.transifex.com/foreman/foreman/langu"
13
13
  "age/zh_CN/)\n"
@@ -36,10 +36,10 @@ msgid "Actions"
36
36
  msgstr "操作"
37
37
 
38
38
  msgid "Assign Location"
39
- msgstr "指定位置"
39
+ msgstr "分配位置"
40
40
 
41
41
  msgid "Assign Organization"
42
- msgstr "指定組織"
42
+ msgstr "分配机构"
43
43
 
44
44
  msgid "Associated Hosts"
45
45
  msgstr "关联主机"
@@ -78,10 +78,10 @@ msgid "Clean all reported facts during provisioning (except discovery facts)"
78
78
  msgstr "置备期间清除所有报告的详情(发现详情除外)"
79
79
 
80
80
  msgid "Clone"
81
- msgstr ""
81
+ msgstr "克隆"
82
82
 
83
83
  msgid "Clone %s"
84
- msgstr ""
84
+ msgstr "克隆 %s"
85
85
 
86
86
  msgid "Collapse All"
87
87
  msgstr "全部折叠"
@@ -129,10 +129,10 @@ msgid "Delete rule '%s'?"
129
129
  msgstr "删除规则 '%s'?"
130
130
 
131
131
  msgid "Destroyed selected hosts"
132
- msgstr "刪除選擇的主機"
132
+ msgstr "销毁选定的主机"
133
133
 
134
134
  msgid "Details"
135
- msgstr "细节"
135
+ msgstr "详情"
136
136
 
137
137
  msgid "Disable"
138
138
  msgstr "禁用"
@@ -148,13 +148,13 @@ msgid "Discovered Hosts"
148
148
  msgstr "发现主机"
149
149
 
150
150
  msgid "Discovered Rules"
151
- msgstr ""
151
+ msgstr "发现规则"
152
152
 
153
153
  msgid "Discovered host '%{host}' has all NICs filtered out, filter: %{filter}"
154
154
  msgstr "发现的主机 '%{host}' 的所有 NIC 都被过滤掉,过滤:%{filter}"
155
155
 
156
156
  msgid "Discovered host reported from unknown subnet, communication will not be proxied."
157
- msgstr ""
157
+ msgstr "从未知子网报告发现的主机,通信数据将不会被代理。"
158
158
 
159
159
  msgid "Discovered host: %s"
160
160
  msgstr "发现的主机:%s"
@@ -169,7 +169,7 @@ msgid "Discovered hosts from Foreman server at %{foreman_url}"
169
169
  msgstr "来自 %{foreman_url} Foreman 服务器的发现主机"
170
170
 
171
171
  msgid "Discovered hosts reported from unknown subnet are %s, communication will not be proxied."
172
- msgstr ""
172
+ msgstr "从未知子网报告发现的主机为 %s,通信数据将不会被代理。"
173
173
 
174
174
  msgid "Discovered hosts summary"
175
175
  msgstr "发现主机摘要"
@@ -199,28 +199,28 @@ msgid "Discovery organization"
199
199
  msgstr "发现机构"
200
200
 
201
201
  msgid "DiscoveryRule|Enabled"
202
- msgstr "发现规则|已启用"
202
+ msgstr "DiscoveryRule|Enabled"
203
203
 
204
204
  msgid "DiscoveryRule|Name"
205
- msgstr "发现规则|名称"
205
+ msgstr "DiscoveryRule|Name"
206
206
 
207
207
  msgid "DiscoveryRule|Priority"
208
208
  msgstr "发现规则|优先级"
209
209
 
210
210
  msgid "DiscoveryRule|Query"
211
- msgstr "发现规则|查询"
211
+ msgstr "DiscoveryRule|Query"
212
212
 
213
213
  msgid "Disk Count"
214
214
  msgstr "磁盘计数"
215
215
 
216
216
  msgid "Disk count"
217
- msgstr "磁碟計數"
217
+ msgstr "磁盘计数"
218
218
 
219
219
  msgid "Disks Size"
220
220
  msgstr "磁盘大小"
221
221
 
222
222
  msgid "Disks size"
223
- msgstr "磁碟大小"
223
+ msgstr "磁盘大小"
224
224
 
225
225
  msgid "Do not allow to discover existing managed host matching MAC of a provisioning NIC (errors out early)"
226
226
  msgstr "不允许发现匹配一个置备 NIC 的 MAC 的已存在的管理的主机(早期出现错误)"
@@ -238,7 +238,7 @@ msgid "Enable rule '%s'?"
238
238
  msgstr "启用规则 '%s'?"
239
239
 
240
240
  msgid "Error message goes here"
241
- msgstr ""
241
+ msgstr "错误信息到这里"
242
242
 
243
243
  msgid "Error on existing NIC"
244
244
  msgstr "已存在的 NIC 上的错误"
@@ -319,16 +319,16 @@ msgid "Highlights"
319
319
  msgstr "亮点"
320
320
 
321
321
  msgid "Host"
322
- msgstr "主办"
322
+ msgstr "主机"
323
323
 
324
324
  msgid "Host %s has been dicovered"
325
- msgstr ""
325
+ msgstr "主机 %s 已被发现。"
326
326
 
327
327
  msgid "Host %{host} was provisioned with rule %{rule}"
328
328
  msgstr "主机 %{host} 被置备,带有规则 %{rule}"
329
329
 
330
330
  msgid "Host Group"
331
- msgstr "主機群組"
331
+ msgstr "主机组"
332
332
 
333
333
  msgid "Host group location %s must also be associated to the discovery rule"
334
334
  msgid_plural "Host group locations %s must also be associated to the discovery rule"
@@ -342,7 +342,7 @@ msgid "Host of type %s can not be rebooted"
342
342
  msgstr "%s 类型的主机不能重启"
343
343
 
344
344
  msgid "Host's owner type"
345
- msgstr "主机拥有者类型"
345
+ msgstr "主机所有者类型"
346
346
 
347
347
  msgid "Host's parameters (array or indexed hash)"
348
348
  msgstr "主机参数(阵列或索引哈希)"
@@ -363,7 +363,7 @@ msgid "Hosts"
363
363
  msgstr "主机"
364
364
 
365
365
  msgid "Hosts Limit"
366
- msgstr "主機限制"
366
+ msgstr "主机限制"
367
367
 
368
368
  msgid "Hosts/Limit"
369
369
  msgstr "主机/限制"
@@ -372,10 +372,10 @@ msgid "ID of Discovery Proxy to use within this subnet for managing connection t
372
372
  msgstr "本子网内用于管理到发现主机的连接的发现代理服务器 ID"
373
373
 
374
374
  msgid "IP Address"
375
- msgstr "IP地址"
375
+ msgstr "IP 地址"
376
376
 
377
377
  msgid "IP address"
378
- msgstr "IP 位址"
378
+ msgstr "IP 地址"
379
379
 
380
380
  msgid "IPAM must be configured for subnet '%s'"
381
381
  msgstr "必须为子网 '%s' 配置 IPAM"
@@ -432,10 +432,10 @@ msgid "Kexec template not associated with operating system"
432
432
  msgstr "Kexec 模板未与操作系统关联"
433
433
 
434
434
  msgid "Last Facts Upload"
435
- msgstr "最后详情上传"
435
+ msgstr "最后事实上传"
436
436
 
437
437
  msgid "List all discovered hosts"
438
- msgstr "列出所有发现主机"
438
+ msgstr "列出所有发现的主机"
439
439
 
440
440
  msgid "List all discovery rules"
441
441
  msgstr "列出所有发现规则"
@@ -444,7 +444,7 @@ msgid "List all fact values of a given discovered host"
444
444
  msgstr "列出给定发现主机的所有系统信息值"
445
445
 
446
446
  msgid "List of facts to use for the hostname (separated by comma, first wins)"
447
- msgstr "用于主机名的详情列表(用逗号隔开,首个 wins)"
447
+ msgstr "用于主机名的详情列表(用逗号隔开,第一个有最高优先级)"
448
448
 
449
449
  msgid "Location"
450
450
  msgstr "位置"
@@ -465,7 +465,7 @@ msgid "Locked PXELinux template name"
465
465
  msgstr "锁定的 PXELinux 模板名称"
466
466
 
467
467
  msgid "MAC address"
468
- msgstr "MAC 位址"
468
+ msgstr "MAC 地址"
469
469
 
470
470
  msgid "MAC-based name"
471
471
  msgstr "基于 MAC 的名称"
@@ -474,7 +474,7 @@ msgid "Maximum hosts provisioned with this rule (0 = unlimited)"
474
474
  msgstr "按照此规则置备的最大主机数(0 = 没有限制)"
475
475
 
476
476
  msgid "Memory"
477
- msgstr "记忆"
477
+ msgstr "内存"
478
478
 
479
479
  msgid "Miscellaneous"
480
480
  msgstr "杂项"
@@ -483,13 +483,13 @@ msgid "Model"
483
483
  msgstr "模型"
484
484
 
485
485
  msgid "N/A"
486
- msgstr "N / A"
486
+ msgstr "不适用"
487
487
 
488
488
  msgid "Name"
489
489
  msgstr "名称"
490
490
 
491
491
  msgid "Name of the parameter"
492
- msgstr "參數名稱"
492
+ msgstr "参数名"
493
493
 
494
494
  msgid "Network"
495
495
  msgstr "网络"
@@ -501,7 +501,7 @@ msgid "New Discovery Rule"
501
501
  msgstr "新建发现规则"
502
502
 
503
503
  msgid "New hosts"
504
- msgstr ""
504
+ msgstr "新主机"
505
505
 
506
506
  msgid "New in the last 24 hours"
507
507
  msgstr "在最近 24 小时之内新建"
@@ -522,10 +522,10 @@ msgid "No hostgroup associated with rule '%s'"
522
522
  msgstr "没有与规则 '%s' 关联的主机组"
523
523
 
524
524
  msgid "No hosts selected"
525
- msgstr "未選擇主機"
525
+ msgstr "未选择主机"
526
526
 
527
527
  msgid "No hosts were found with that id or name"
528
- msgstr "沒有找到擁有此 ID 或名稱的主機"
528
+ msgstr "找不到具有该 ID 或名称的主机"
529
529
 
530
530
  msgid "No new discovered hosts for this period"
531
531
  msgstr "此时间段内没有新发现主机"
@@ -558,7 +558,13 @@ msgid "Parameter value"
558
558
  msgstr "参数值"
559
559
 
560
560
  msgid "Please Confirm"
561
- msgstr "請確認"
561
+ msgstr "请确认"
562
+
563
+ msgid "Prefer IPv6"
564
+ msgstr ""
565
+
566
+ msgid "Prefer IPv6 to IPv4 when calling discovered nodes"
567
+ msgstr ""
562
568
 
563
569
  msgid "Primary"
564
570
  msgstr "主"
@@ -594,7 +600,7 @@ msgid "Rebuild DNS for %s"
594
600
  msgstr "为 %s 重建 DNS"
595
601
 
596
602
  msgid "Refresh facts"
597
- msgstr "刷新詳情"
603
+ msgstr "刷新详情"
598
604
 
599
605
  msgid "Refreshing the facts of a discovered host"
600
606
  msgstr "刷新发现主机的详情"
@@ -636,16 +642,16 @@ msgid "Rule priority (lower integer means higher priority)"
636
642
  msgstr "规则优先级(整数越小,优先级越高)"
637
643
 
638
644
  msgid "Select Action"
639
- msgstr "選擇動作"
645
+ msgstr "选择操作"
640
646
 
641
647
  msgid "Select all items in this page"
642
- msgstr "選擇這頁中的所有項目"
648
+ msgstr "选择这个页中的所有项"
643
649
 
644
650
  msgid "Select location"
645
- msgstr "選擇位置"
651
+ msgstr "选择位置"
646
652
 
647
653
  msgid "Select organization"
648
- msgstr "選擇組織"
654
+ msgstr "选择机构"
649
655
 
650
656
  msgid "Show a discovered host"
651
657
  msgstr "显示一个发现主机"
@@ -690,10 +696,10 @@ msgid "Target host group for this rule with all properties set"
690
696
  msgstr "此规则的目标主机组所有属性已设置"
691
697
 
692
698
  msgid "The default location to place discovered hosts in"
693
- msgstr "放置已發現之主機的預設位置"
699
+ msgstr "放置发现主机的默认位置"
694
700
 
695
701
  msgid "The default organization to place discovered hosts in"
696
- msgstr "放置已發現之主機的預設組織"
702
+ msgstr "放置发现主机的默认机构"
697
703
 
698
704
  msgid "The default prefix to use for the host name, must start with a letter"
699
705
  msgstr "使用的主机名默认前缀必须以字母开头"
@@ -702,10 +708,10 @@ msgid "The following hosts were not deleted: %s"
702
708
  msgstr "以下主机没有删除:%s"
703
709
 
704
710
  msgid "This might take a while, as all hosts, facts and reports will be destroyed as well"
705
- msgstr "這可能會花上一段時間,因為所有主機、詳情與報告皆會被刪除"
711
+ msgstr "这可能需要一段时间,因为所有主机,事实和报告也将被销毁。"
706
712
 
707
713
  msgid "Type"
708
- msgstr "類型"
714
+ msgstr "类型"
709
715
 
710
716
  msgid "Type of name generator"
711
717
  msgstr "名称生成器类型"
@@ -714,7 +720,7 @@ msgid "Type of value"
714
720
  msgstr "值类型"
715
721
 
716
722
  msgid "UUID to track orchestration tasks status, GET /api/orchestration/:UUID/tasks"
717
- msgstr "用來追蹤協調流程任務狀態的 UUID,GET /api/orchestration/:UUID/tasks"
723
+ msgstr "用于跟踪编配任务状态的 UUID,GET /api/orchestration/:UUID/tasks"
718
724
 
719
725
  msgid "Unable to find a discovery rule, no host provided (check permissions)"
720
726
  msgstr "无法找到发现规则,未提供主机(检查许可)"
@@ -738,7 +744,7 @@ msgid "Update a rule"
738
744
  msgstr "更新规则"
739
745
 
740
746
  msgid "Upload facts for a host, creating the host if required"
741
- msgstr "上傳主機的詳情,並視需求建立主機"
747
+ msgstr "上载主机的事实,并根据需要创建主机"
742
748
 
743
749
  msgid "When creating hostname patterns, make sure the resulting host names are unique."
744
750
  msgstr "创建主机名模式时,确保生成的主机名是唯一的。"
@@ -765,7 +771,7 @@ msgid "hash containing facts for the host with minimum set of facts: discovery_b
765
771
  msgstr "hash 包含具备最小详情集合的主机的详情:discovery_bootif、macaddress_eth0、ipaddress、ipaddress_eth0、interfaces: eth0(主接口名为 eth0 的示例)"
766
772
 
767
773
  msgid "items selected. Uncheck to Clear"
768
- msgstr "已選取項目。反選以清除"
774
+ msgstr "选择的项。取消选中以清除"
769
775
 
770
776
  msgid "location ID for provisioned hosts"
771
777
  msgstr "预配主机的位置 ID"
@@ -780,16 +786,16 @@ msgid "not required if it's a virtual machine"
780
786
  msgstr "如果是虚拟机,则不需要"
781
787
 
782
788
  msgid "not required if using a subnet with DHCP proxy"
783
- msgstr "若是使用一個含有 DHCP 協定的子網路則不需要"
789
+ msgstr "如果使用带有 DHCP 代理的子网则不需要"
784
790
 
785
791
  msgid "number of entries per request"
786
- msgstr "每個請求的項目數量"
792
+ msgstr "每个请求的条目数"
787
793
 
788
794
  msgid "organization ID for provisioned hosts"
789
795
  msgstr "预配主机的组织 ID"
790
796
 
791
797
  msgid "paginate results"
792
- msgstr "編頁結果"
798
+ msgstr "分页结果"
793
799
 
794
800
  msgid "puts the rules in order, low numbers go first. Must be greater then zero"
795
801
  msgstr "按顺序排列规则,低数值优先。必须大于 0"
@@ -804,16 +810,16 @@ msgid "required if host is managed and custom partition has not been defined"
804
810
  msgstr "如果已管理主机,且未定义自定义分区,则需填写。"
805
811
 
806
812
  msgid "required if host is managed and value is not inherited from host group"
807
- msgstr "若主機是個受管理的主機,並且值不是由主機群組所繼承的話便需要"
813
+ msgstr "如果主机是受管的,值没有从主机组继承时需要"
808
814
 
809
815
  msgid "required if not imaged based provisioning and host is managed and value is not inherited from host group"
810
- msgstr "若不是基於映像檔的佈建,而主機受管理並且值並非由主機群組所繼承的話便需要"
816
+ msgstr "如果不是基于置备镜像,主机是受管的,值没有从主机组继承时需要"
811
817
 
812
818
  msgid "required if value is not inherited from host group or default password in settings"
813
819
  msgstr "如果数值不是从主机组或设置中的默认密码继承,则需要。"
814
820
 
815
821
  msgid "sort results"
816
- msgstr "排序結果"
822
+ msgstr "排序结果"
817
823
 
818
824
  msgid "the hostgroup that is used to auto provision a host"
819
825
  msgstr "用于自动置备主机的主机组"
@@ -5,10 +5,10 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 16.3.4\n"
8
+ "Project-Id-Version: foreman_discovery 17.1.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
- "PO-Revision-Date: 2021-01-25 08:35+0000\n"
11
- "Last-Translator: Transifex Bot <>\n"
10
+ "PO-Revision-Date: 2021-05-03 08:29+0000\n"
11
+ "Last-Translator: 0868a4d1af5275b3f70b0a6dac4c99a4\n"
12
12
  "Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/lang"
13
13
  "uage/zh_TW/)\n"
14
14
  "MIME-Version: 1.0\n"
@@ -78,10 +78,10 @@ msgid "Clean all reported facts during provisioning (except discovery facts)"
78
78
  msgstr ""
79
79
 
80
80
  msgid "Clone"
81
- msgstr ""
81
+ msgstr "複製"
82
82
 
83
83
  msgid "Clone %s"
84
- msgstr ""
84
+ msgstr "複製 %s"
85
85
 
86
86
  msgid "Collapse All"
87
87
  msgstr "全部收回"
@@ -563,6 +563,12 @@ msgstr "參數值"
563
563
  msgid "Please Confirm"
564
564
  msgstr "請確認"
565
565
 
566
+ msgid "Prefer IPv6"
567
+ msgstr ""
568
+
569
+ msgid "Prefer IPv6 to IPv4 when calling discovered nodes"
570
+ msgstr ""
571
+
566
572
  msgid "Primary"
567
573
  msgstr "主要"
568
574
 
data/package.json CHANGED
@@ -27,7 +27,7 @@
27
27
  "@babel/core": "^7.7.0",
28
28
  "@theforeman/builder": "^6.0.0",
29
29
  "@theforeman/eslint-plugin-foreman": "^6.0.0",
30
- "@theforeman/stories": "^6.0.0",
30
+ "@theforeman/stories": "^7.0.0",
31
31
  "@theforeman/test": "^8.0.0",
32
32
  "@theforeman/vendor-dev": "^6.0.0",
33
33
  "babel-eslint": "^10.0.3",
@@ -19,10 +19,7 @@ module Api
19
19
  "memorysize_mb" => "42000.42",
20
20
  "discovery_version" => "3.0.0",
21
21
  }
22
- FactoryBot.create(:setting,
23
- :name => 'discovery_hostname',
24
- :value => 'discovery_bootif',
25
- :category => 'Setting::Discovered')
22
+ Setting['discovery_hostname'] = 'discovery_bootif'
26
23
  end
27
24
 
28
25
 
@@ -28,10 +28,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
28
28
  end
29
29
 
30
30
  def test_index_with_custom_column
31
- FactoryBot.create(:setting,
32
- :name => 'discovery_fact_column',
33
- :value => "bios_vendor",
34
- :category => 'Setting::Discovered')
31
+ Setting['discovery_fact_column'] = "bios_vendor"
35
32
  facts = @facts.merge({"bios_vendor" => "QEMU"})
36
33
  discover_host_from_facts(facts)
37
34
  get :index, params: {}, session: set_session_user_default_reader
@@ -85,7 +82,11 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
85
82
 
86
83
  def test_edit_form_quick_submit
87
84
  domain = FactoryBot.create(:domain)
88
- hostgroup = FactoryBot.create(:hostgroup, :with_subnet, :with_environment, :with_rootpass, :with_os, :domain => domain)
85
+ if defined? ForemanPuppet
86
+ hostgroup = FactoryBot.create(:hostgroup, :with_subnet, :with_puppet_enc, :with_rootpass, :with_os, :domain => domain)
87
+ else
88
+ hostgroup = FactoryBot.create(:hostgroup, :with_subnet, :with_rootpass, :with_os, :domain => domain)
89
+ end
89
90
  new_ip = hostgroup.subnet.ipaddr.to_s
90
91
  host = discover_host_from_facts(@facts.merge({
91
92
  'ipaddress' => new_ip,
@@ -161,9 +161,11 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
161
161
  let(:hostgroup_environment) { FactoryBot.create(:environment) }
162
162
  let(:hostgroup_domain) { FactoryBot.create(:domain) }
163
163
  let(:hostgroup) do
164
- FactoryBot.create(:hostgroup, :with_os,
165
- environment: hostgroup_environment,
166
- domain: hostgroup_domain)
164
+ if defined?(ForemanPuppet)
165
+ FactoryBot.create(:hostgroup, :with_os, environment: hostgroup_environment, domain: hostgroup_domain)
166
+ else
167
+ FactoryBot.create(:hostgroup, :with_os, domain: hostgroup_domain)
168
+ end
167
169
  end
168
170
 
169
171
  setup do
@@ -174,10 +176,14 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
174
176
  end
175
177
 
176
178
  it 'sets inherited attributes' do
177
- %i[environment architecture operatingsystem].each do |attribute|
179
+ %i[architecture operatingsystem].each do |attribute|
178
180
  assert_selected "#host_#{attribute}_id", hostgroup.send(attribute).id
179
181
  end
180
182
 
183
+ if defined? ForemanPuppet
184
+ assert_selected "#host_puppet_attributes_environment_id", hostgroup.send(:environment).id
185
+ end
186
+
181
187
  page.find('a[href="#network"]').click
182
188
  page.find_button('Edit').click
183
189
  assert_selected '#host_interfaces_attributes_0_domain_id',
@@ -52,40 +52,46 @@ def extract_form_errors(response)
52
52
  end
53
53
 
54
54
  def set_default_settings
55
- FactoryBot.create(:setting, :name => 'discovery_fact', :value => 'discovery_bootif', :category => 'Setting::Discovered')
56
- FactoryBot.create(:setting, :name => 'discovery_hostname', :value => 'discovery_bootif', :category => 'Setting::Discovered')
57
- FactoryBot.create(:setting, :name => 'discovery_auto', :value => true, :category => 'Setting::Discovered')
58
- FactoryBot.create(:setting, :name => 'discovery_reboot', :value => true, :category => 'Setting::Discovered')
59
- FactoryBot.create(:setting, :name => 'discovery_organization', :value => "Organization 1", :category => 'Setting::Discovered')
60
- FactoryBot.create(:setting, :name => 'discovery_location', :value => "Location 1", :category => 'Setting::Discovered')
61
- FactoryBot.create(:setting, :name => 'discovery_prefix', :value => 'mac', :category => 'Setting::Discovered')
62
- FactoryBot.create(:setting, :name => 'discovery_clean_facts', :value => false, :category => 'Setting::Discovered')
63
- FactoryBot.create(:setting, :name => 'discovery_lock', :value => false, :category => 'Setting::Discovered')
64
- FactoryBot.create(:setting, :name => 'discovery_pxelinux_lock_template', :value => 'pxelinux_discovery', :category => 'Setting::Discovered')
65
- FactoryBot.create(:setting, :name => 'discovery_pxegrub_lock_template', :value => 'pxegrub_discovery', :category => 'Setting::Discovered')
66
- FactoryBot.create(:setting, :name => 'discovery_pxegrub2_lock_template', :value => 'pxegrub2_discovery', :category => 'Setting::Discovered')
67
- FactoryBot.create(:setting, :name => 'discovery_always_rebuild_dns', :value => true, :category => 'Setting::Discovered')
68
- FactoryBot.create(:setting, :name => 'discovery_error_on_existing', :value => false, :category => 'Setting::Discovered')
69
- FactoryBot.create(:setting, :name => 'discovery_naming', :value => 'Fact', :category => 'Setting::Discovered')
70
- FactoryBot.create(:setting, :name => 'discovery_auto_bond', :value => false, :category => 'Setting::Discovered')
55
+ Setting['discovery_fact'] = 'discovery_bootif'
56
+ Setting['discovery_hostname'] = 'discovery_bootif'
57
+ Setting['discovery_auto'] = true
58
+ Setting['discovery_reboot'] = true
59
+ Setting['discovery_organization'] = "Organization 1"
60
+ Setting['discovery_location'] = "Location 1"
61
+ Setting['discovery_prefix'] = 'mac'
62
+ Setting['discovery_clean_facts'] = false
63
+ Setting['discovery_lock'] = false
64
+ Setting['discovery_pxelinux_lock_template'] = 'pxelinux_discovery'
65
+ Setting['discovery_pxegrub_lock_template'] = 'pxegrub_discovery'
66
+ Setting['discovery_pxegrub2_lock_template'] = 'pxegrub2_discovery'
67
+ Setting['discovery_always_rebuild_dns'] = true
68
+ Setting['discovery_error_on_existing'] = false
69
+ Setting['discovery_naming'] = 'Fact'
70
+ Setting['discovery_auto_bond'] = false
71
71
  end
72
72
 
73
73
  def setup_hostgroup(host)
74
74
  domain = FactoryBot.create(:domain)
75
75
  subnet = FactoryBot.create(:subnet_ipv4, :network => "192.168.100.0")
76
- environment = FactoryBot.create(:environment, :organizations => [host.organization], :locations => [host.location])
77
76
  medium = FactoryBot.create(:medium, :organizations => [host.organization], :locations => [host.location])
78
77
  os = FactoryBot.create(:operatingsystem, :with_ptables, :with_archs, :media => [medium])
79
- hostgroup = FactoryBot.create(
80
- :hostgroup, :with_rootpass, :with_puppet_orchestration,
78
+ args = {
81
79
  :operatingsystem => os,
82
80
  :architecture => os.architectures.first,
83
81
  :ptable => os.ptables.first,
84
82
  :medium => os.media.first,
85
- :environment => environment,
86
83
  :subnet => subnet,
87
84
  :domain => domain,
88
- :organizations => [host.organization], :locations => [host.location])
85
+ :organizations => [host.organization],
86
+ :locations => [host.location]
87
+ }
88
+ if defined?(ForemanPuppet)
89
+ environment = FactoryBot.create(:environment, :organizations => [host.organization], :locations => [host.location])
90
+ args[:environment] = environment
91
+ hostgroup = FactoryBot.create(:hostgroup, :with_rootpass, :with_puppet_enc, **args)
92
+ else
93
+ hostgroup = FactoryBot.create(:hostgroup, :with_rootpass, **args)
94
+ end
89
95
  domain.subnets << hostgroup.subnet
90
96
  hostgroup.medium.organizations |= [host.organization]
91
97
  hostgroup.medium.locations |= [host.location]
@@ -95,12 +101,14 @@ def setup_hostgroup(host)
95
101
  hostgroup.domain.locations |= [host.location]
96
102
  hostgroup.subnet.organizations |= [host.organization]
97
103
  hostgroup.subnet.locations |= [host.location]
98
- hostgroup.environment.organizations |= [host.organization]
99
- hostgroup.environment.locations |= [host.location]
100
- hostgroup.puppet_proxy.organizations |= [host.organization]
101
- hostgroup.puppet_proxy.locations |= [host.location]
102
- hostgroup.puppet_ca_proxy.organizations |= [host.organization]
103
- hostgroup.puppet_ca_proxy.locations |= [host.location]
104
+ if defined?(ForemanPuppet)
105
+ hostgroup.environment.organizations |= [host.organization]
106
+ hostgroup.environment.locations |= [host.location]
107
+ hostgroup.puppet_proxy.organizations |= [host.organization]
108
+ hostgroup.puppet_proxy.locations |= [host.location]
109
+ hostgroup.puppet_ca_proxy.organizations |= [host.organization]
110
+ hostgroup.puppet_ca_proxy.locations |= [host.location]
111
+ end
104
112
  hostgroup
105
113
  end
106
114
 
@@ -4,4 +4,11 @@ require_relative './test_helper_discovery'
4
4
 
5
5
  # Add plugin to FactoryBot's paths
6
6
  FactoryBot.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
7
+
8
+ # Add dependencies
9
+ if defined? ForemanPuppet
10
+ FactoryBot.definition_file_paths << File.join("#{ForemanPuppet::Engine.root}/test", 'factories')
11
+ end
12
+
13
+ # And reload
7
14
  FactoryBot.reload