foreman_discovery 15.0.1 → 16.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/discovery_rules_controller.rb +1 -1
- data/app/controllers/concerns/foreman/controller/discovered_extensions.rb +4 -0
- data/app/controllers/discovered_hosts_controller.rb +1 -0
- data/app/controllers/discovery_rules_controller.rb +1 -1
- data/app/models/discovery_rule.rb +1 -1
- data/app/models/host/discovered.rb +37 -15
- data/app/models/host/managed_extensions.rb +1 -1
- data/app/models/setting/discovered.rb +26 -33
- data/app/services/foreman_discovery/fact_parser.rb +1 -1
- data/app/services/foreman_discovery/host_converter.rb +30 -2
- data/app/services/foreman_discovery/import_hooks/subnet_and_taxonomy.rb +6 -14
- data/app/services/foreman_discovery/subnet_suggestion.rb +26 -0
- data/app/views/discovered_hosts/_discovered_host_modal.html.erb +19 -17
- data/app/views/foreman_discovery/debian_kexec.erb +1 -1
- data/config/routes.rb +2 -0
- data/db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb +1 -1
- data/db/migrate/20151023144501_regenerate_red_hat_kexec.rb +1 -1
- data/db/migrate/20180412124505_add_priority_score_to_discovery_rules.rb +1 -1
- data/extra/discover-host +21 -7
- data/lib/foreman_discovery/engine.rb +4 -4
- data/lib/foreman_discovery/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ca/foreman_discovery.edit.po +238 -139
- data/locale/ca/foreman_discovery.po +28 -8
- data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/de/foreman_discovery.edit.po +240 -140
- data/locale/de/foreman_discovery.po +31 -11
- data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en/foreman_discovery.edit.po +109 -83
- data/locale/en/foreman_discovery.po +24 -4
- data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en_GB/foreman_discovery.edit.po +241 -142
- data/locale/en_GB/foreman_discovery.po +31 -11
- data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/es/foreman_discovery.edit.po +240 -141
- data/locale/es/foreman_discovery.po +30 -10
- data/locale/foreman_discovery.pot +110 -84
- data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/fr/foreman_discovery.edit.po +237 -137
- data/locale/fr/foreman_discovery.po +28 -8
- data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/gl/foreman_discovery.edit.po +236 -137
- data/locale/gl/foreman_discovery.po +26 -6
- data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/it/foreman_discovery.edit.po +236 -137
- data/locale/it/foreman_discovery.po +26 -6
- data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ja/foreman_discovery.edit.po +238 -142
- data/locale/ja/foreman_discovery.po +29 -9
- data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ko/foreman_discovery.edit.po +236 -139
- data/locale/ko/foreman_discovery.po +28 -8
- data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/pt_BR/foreman_discovery.edit.po +239 -140
- data/locale/pt_BR/foreman_discovery.po +29 -9
- data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ru/foreman_discovery.edit.po +242 -143
- data/locale/ru/foreman_discovery.po +29 -9
- data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/sv_SE/foreman_discovery.edit.po +237 -138
- data/locale/sv_SE/foreman_discovery.po +27 -7
- data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_CN/foreman_discovery.edit.po +237 -141
- data/locale/zh_CN/foreman_discovery.po +28 -8
- data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_TW/foreman_discovery.edit.po +235 -139
- data/locale/zh_TW/foreman_discovery.po +26 -6
- data/test/facts/bond0-eth0-eth1-active-passive.json +128 -0
- data/test/facts/facts_with_lldp_bond_candidate.json +2 -9
- data/test/functional/api/v2/discovered_hosts_controller_test.rb +1 -0
- data/test/functional/discovered_hosts_controller_test.rb +4 -4
- data/test/integration/discovered_hosts_test.rb +6 -11
- data/test/test_helper_discovery.rb +12 -0
- data/test/unit/discovered_extensions_test.rb +53 -0
- data/test/unit/discovery_attribute_set_test.rb +13 -10
- data/test/unit/discovery_rule_test.rb +1 -0
- data/test/unit/host_discovered_test.rb +32 -13
- data/test/unit/managed_extensions_test.rb +1 -0
- metadata +8 -2
@@ -5,10 +5,10 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery
|
8
|
+
"Project-Id-Version: foreman_discovery 16.0.1\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"PO-Revision-Date:
|
11
|
-
"Last-Translator:
|
10
|
+
"PO-Revision-Date: 2020-05-26 17:21+0000\n"
|
11
|
+
"Last-Translator: Transifex Bot <>\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"
|
@@ -32,6 +32,9 @@ msgstr ""
|
|
32
32
|
msgid "A summary of discovered hosts"
|
33
33
|
msgstr ""
|
34
34
|
|
35
|
+
msgid "Action with sub plans"
|
36
|
+
msgstr ""
|
37
|
+
|
35
38
|
msgid "Actions"
|
36
39
|
msgstr "動作"
|
37
40
|
|
@@ -134,6 +137,11 @@ msgstr "停用"
|
|
134
137
|
msgid "Disable rule '%s'?"
|
135
138
|
msgstr ""
|
136
139
|
|
140
|
+
msgid "Discovered Host"
|
141
|
+
msgid_plural "Discovered Hosts"
|
142
|
+
msgstr[0] ""
|
143
|
+
msgstr[1] ""
|
144
|
+
|
137
145
|
msgid "Discovered Hosts"
|
138
146
|
msgstr ""
|
139
147
|
|
@@ -345,6 +353,9 @@ msgstr "IP 位址"
|
|
345
353
|
msgid "IP address"
|
346
354
|
msgstr "IP 位址"
|
347
355
|
|
356
|
+
msgid "IPAM must be configured for subnet '%s'"
|
357
|
+
msgstr ""
|
358
|
+
|
348
359
|
msgid "IPMI"
|
349
360
|
msgstr "IPMI"
|
350
361
|
|
@@ -360,6 +371,12 @@ msgstr ""
|
|
360
371
|
msgid "Image API returned HTTP/%{code} with '%{body}"
|
361
372
|
msgstr ""
|
362
373
|
|
374
|
+
msgid "Import Puppet classes"
|
375
|
+
msgstr ""
|
376
|
+
|
377
|
+
msgid "Import facts"
|
378
|
+
msgstr ""
|
379
|
+
|
363
380
|
msgid "In addition to @host attribute function rand for random integers is available. Examples:"
|
364
381
|
msgstr ""
|
365
382
|
|
@@ -576,6 +593,9 @@ msgstr ""
|
|
576
593
|
msgid "Reloading kernel on %s"
|
577
594
|
msgstr ""
|
578
595
|
|
596
|
+
msgid "Remote action:"
|
597
|
+
msgstr ""
|
598
|
+
|
579
599
|
msgid "Reported in the last 7 days"
|
580
600
|
msgstr ""
|
581
601
|
|
@@ -675,13 +695,13 @@ msgstr ""
|
|
675
695
|
msgid "Unable to find primary NIC with %{mac} specified via '%{fact}', NIC filter: %{filter}"
|
676
696
|
msgstr ""
|
677
697
|
|
678
|
-
msgid "Unable to perform kexec on %{name}
|
698
|
+
msgid "Unable to perform kexec on %{name} (%{url}): %{msg}"
|
679
699
|
msgstr ""
|
680
700
|
|
681
|
-
msgid "Unable to
|
701
|
+
msgid "Unable to perform reboot on %{name} (%{url}): %{msg}"
|
682
702
|
msgstr ""
|
683
703
|
|
684
|
-
msgid "Unable to
|
704
|
+
msgid "Unable to provision %{host}: %{errors}"
|
685
705
|
msgstr ""
|
686
706
|
|
687
707
|
msgid "Update a rule"
|
@@ -0,0 +1,128 @@
|
|
1
|
+
{
|
2
|
+
"uptime_seconds": 206,
|
3
|
+
"architecture": "x86_64",
|
4
|
+
"virtual": "kvm",
|
5
|
+
"is_virtual": true,
|
6
|
+
"kernel": "Linux",
|
7
|
+
"blockdevice_vda_size": 6442450944,
|
8
|
+
"blockdevice_vda_vendor": "0x1af4",
|
9
|
+
"blockdevices": "vda",
|
10
|
+
"dhcp_servers": {
|
11
|
+
"system": "192.168.122.1",
|
12
|
+
"bond0": "192.168.122.1"
|
13
|
+
},
|
14
|
+
"domain": "nat.lan",
|
15
|
+
"hardwaremodel": "x86_64",
|
16
|
+
"operatingsystem": "CentOS",
|
17
|
+
"os": {
|
18
|
+
"name": "CentOS",
|
19
|
+
"family": "RedHat",
|
20
|
+
"release": {
|
21
|
+
"major": "7",
|
22
|
+
"minor": "6",
|
23
|
+
"full": "7.6.1810"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"facterversion": "2.4.1",
|
27
|
+
"filesystems": "xfs",
|
28
|
+
"fqdn": "localhost.nat.lan",
|
29
|
+
"gid": "root",
|
30
|
+
"hardwareisa": "x86_64",
|
31
|
+
"hostname": "localhost",
|
32
|
+
"id": "root",
|
33
|
+
"interfaces": "bond0,eth0,eth1,lo",
|
34
|
+
"ipaddress_bond0": "192.168.122.7",
|
35
|
+
"macaddress_bond0": "52:54:00:fd:1e:62",
|
36
|
+
"netmask_bond0": "255.255.255.0",
|
37
|
+
"mtu_bond0": 1500,
|
38
|
+
"macaddress_eth0": "52:54:00:FD:1E:62",
|
39
|
+
"mtu_eth0": 1500,
|
40
|
+
"macaddress_eth1": "52:54:00:7C:84:DA",
|
41
|
+
"mtu_eth1": 1500,
|
42
|
+
"ipaddress_lo": "127.0.0.1",
|
43
|
+
"netmask_lo": "255.0.0.0",
|
44
|
+
"mtu_lo": 65536,
|
45
|
+
"ipaddress": "192.168.122.7",
|
46
|
+
"kernelmajversion": "3.10",
|
47
|
+
"kernelrelease": "3.10.0-957.el7.x86_64",
|
48
|
+
"kernelversion": "3.10.0",
|
49
|
+
"rubyplatform": "x86_64-linux",
|
50
|
+
"macaddress": "52:54:00:fd:1e:62",
|
51
|
+
"bios_vendor": "SeaBIOS",
|
52
|
+
"bios_version": "1.12.0-2.fc30",
|
53
|
+
"bios_release_date": "04/01/2014",
|
54
|
+
"manufacturer": "QEMU",
|
55
|
+
"productname": "Standard PC (Q35 + ICH9, 2009)",
|
56
|
+
"serialnumber": "Not Specified",
|
57
|
+
"uuid": "d1e61ef9-663e-4195-b256-f64b9f8cc8ae",
|
58
|
+
"type": "Other",
|
59
|
+
"memorysize": "8.41 GB",
|
60
|
+
"memoryfree": "8.20 GB",
|
61
|
+
"swapsize": "615.00 MB",
|
62
|
+
"swapfree": "615.00 MB",
|
63
|
+
"swapsize_mb": "615.00",
|
64
|
+
"swapfree_mb": "615.00",
|
65
|
+
"memorysize_mb": "8615.46",
|
66
|
+
"memoryfree_mb": "8395.15",
|
67
|
+
"netmask": "255.255.255.0",
|
68
|
+
"network_bond0": "192.168.122.0",
|
69
|
+
"network_lo": "127.0.0.0",
|
70
|
+
"uptime_hours": 0,
|
71
|
+
"operatingsystemmajrelease": "7",
|
72
|
+
"rubysitedir": "/usr/local/share/ruby/site_ruby/",
|
73
|
+
"operatingsystemrelease": "7.6.1810",
|
74
|
+
"osfamily": "RedHat",
|
75
|
+
"partitions": {
|
76
|
+
"vda1": {
|
77
|
+
"size": "2048"
|
78
|
+
},
|
79
|
+
"vda2": {
|
80
|
+
"uuid": "1f259325-5eb4-4334-81f3-699ace4a28ff",
|
81
|
+
"size": "2097152",
|
82
|
+
"mount": "/boot",
|
83
|
+
"filesystem": "xfs"
|
84
|
+
},
|
85
|
+
"vda3": {
|
86
|
+
"uuid": "6639b5c4-1ba1-41d6-a4a0-6253eeaaae05",
|
87
|
+
"size": "1259520",
|
88
|
+
"filesystem": "swap"
|
89
|
+
},
|
90
|
+
"vda4": {
|
91
|
+
"uuid": "09aced65-5b86-4efe-9da0-c86a3311e1b8",
|
92
|
+
"size": "9220096",
|
93
|
+
"mount": "/",
|
94
|
+
"filesystem": "xfs"
|
95
|
+
}
|
96
|
+
},
|
97
|
+
"path": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin",
|
98
|
+
"rubyversion": "2.0.0",
|
99
|
+
"physicalprocessorcount": 2,
|
100
|
+
"processors": {
|
101
|
+
"models": [
|
102
|
+
"AMD EPYC Processor (with IBPB)",
|
103
|
+
"AMD EPYC Processor (with IBPB)"
|
104
|
+
],
|
105
|
+
"count": 2,
|
106
|
+
"physicalcount": 2
|
107
|
+
},
|
108
|
+
"processor0": "AMD EPYC Processor (with IBPB)",
|
109
|
+
"processor1": "AMD EPYC Processor (with IBPB)",
|
110
|
+
"processorcount": 2,
|
111
|
+
"ps": "ps -ef",
|
112
|
+
"selinux": true,
|
113
|
+
"selinux_enforced": true,
|
114
|
+
"selinux_policyversion": "31",
|
115
|
+
"selinux_current_mode": "enforcing",
|
116
|
+
"selinux_config_mode": "enforcing",
|
117
|
+
"selinux_config_policy": "unknown",
|
118
|
+
"system_uptime": {
|
119
|
+
"seconds": 206,
|
120
|
+
"hours": 0,
|
121
|
+
"days": 0,
|
122
|
+
"uptime": "0:03 hours"
|
123
|
+
},
|
124
|
+
"timezone": "EDT",
|
125
|
+
"uniqueid": "007f0100",
|
126
|
+
"uptime": "0:03 hours",
|
127
|
+
"uptime_days": 0
|
128
|
+
}
|
@@ -6,14 +6,11 @@
|
|
6
6
|
"kernelmajversion": "2.6",
|
7
7
|
"kernelversion": "2.6.32",
|
8
8
|
"macaddress_vnet0": "FE:54:00:1E:45:13",
|
9
|
-
"macaddress_br181": "E4:1F:13:CC:36:58",
|
10
9
|
"macaddress_usb0": "E6:1F:13:D0:43:A3",
|
11
10
|
"macaddress_vnet1": "FE:54:00:45:E5:3E",
|
12
11
|
"rubysitedir": "/usr/lib/ruby/site_ruby/1.8",
|
13
|
-
"macaddress_br182": "E4:1F:13:CC:36:58",
|
14
12
|
"processor4": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
15
13
|
"macaddress_vnet2": "FE:54:00:93:F5:56",
|
16
|
-
"macaddress_br183": "E4:1F:13:CC:36:58",
|
17
14
|
"ps": "ps -ef",
|
18
15
|
"processor5": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
19
16
|
"macaddress_vnet10": "FE:54:00:7D:F8:24",
|
@@ -28,16 +25,15 @@
|
|
28
25
|
"macaddress_vnet4": "FE:54:00:62:53:67",
|
29
26
|
"hostname": "h02",
|
30
27
|
"osfamily": "RedHat",
|
31
|
-
"gateway_if": "
|
28
|
+
"gateway_if": "eth0",
|
32
29
|
"lsbrelease": ":core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch",
|
33
30
|
"kernelrelease": "2.6.32-131.12.1.el6.x86_64",
|
34
31
|
"kernel": "Linux",
|
35
32
|
"facterversion": "1.6.2",
|
36
33
|
"uptime_seconds": "13651752",
|
37
34
|
"macaddress_vnet5": "FE:54:00:01:B9:9C",
|
38
|
-
"interfaces": "
|
35
|
+
"interfaces": "eth0,eth0_181,eth0_182,eth0_183,eth1,lo,usb0,vnet0,vnet1,vnet2,vnet3,vnet4,vnet5,vnet7,vnet10",
|
39
36
|
"macaddress_vnet7": "FE:54:00:D8:F9:38",
|
40
|
-
"netmask_br180": "255.255.255.192",
|
41
37
|
"macaddress_eth0": "E4:1F:13:CC:36:58",
|
42
38
|
"is_virtual": "false",
|
43
39
|
"macaddress": "E4:1F:13:CC:36:58",
|
@@ -47,7 +43,6 @@
|
|
47
43
|
"macaddress_eth1": "E4:1F:13:CC:36:5A",
|
48
44
|
"timezone": "GMT",
|
49
45
|
"fqdn": "a.server.b.domain",
|
50
|
-
"ipaddress_br180": "10.35.27.2",
|
51
46
|
"ipaddress_eth0": "10.35.27.3",
|
52
47
|
"ipaddress_eth1": "10.35.27.4",
|
53
48
|
"puppetversion": "2.6.12",
|
@@ -69,12 +64,10 @@
|
|
69
64
|
"network_lo": "127.0.0.0",
|
70
65
|
"gateway": "10.35.27.62",
|
71
66
|
"lsbdistid": "RedHatEnterpriseServer",
|
72
|
-
"network_br180": "10.35.27.0",
|
73
67
|
"lsbdistdescription": "Red Hat Enterprise Linux Server release 6.2 (Santiago)",
|
74
68
|
"swapsize": "17.70 GB",
|
75
69
|
"processor0": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
76
70
|
"processor1": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
77
|
-
"macaddress_br180": "E4:1F:13:CC:36:58",
|
78
71
|
"selinux": "false",
|
79
72
|
"domain": "server.b.domain",
|
80
73
|
"architecture": "x86_64",
|
@@ -25,6 +25,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
25
25
|
}
|
26
26
|
set_default_settings
|
27
27
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.stubs(:reboot).returns(true)
|
28
|
+
::ForemanDiscovery::HostConverter.stubs(:unused_ip_for_host)
|
28
29
|
end
|
29
30
|
|
30
31
|
def test_get_index
|
@@ -183,7 +183,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
183
183
|
def test_reboot_failure
|
184
184
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
185
185
|
host = discover_host_from_facts(@facts)
|
186
|
-
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
|
186
|
+
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).twice.returns(false)
|
187
187
|
post :reboot, params: { :id => host.id }, session: set_session_user_default_manager
|
188
188
|
assert_redirected_to discovered_hosts_url
|
189
189
|
assert_equal "Failed to reboot host #{host.name}", flash[:error]
|
@@ -195,7 +195,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
195
195
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
|
196
196
|
post :reboot, params: { :id => host.id }, session: set_session_user_default_manager
|
197
197
|
assert_redirected_to discovered_hosts_url
|
198
|
-
assert_match(/ERF50-
|
198
|
+
assert_match(/ERF50-9494/, flash[:error])
|
199
199
|
end
|
200
200
|
|
201
201
|
def test_auto_provision_success
|
@@ -271,7 +271,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
271
271
|
def test_multiple_reboot_failure
|
272
272
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
273
273
|
host = discover_host_from_facts(@facts)
|
274
|
-
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
|
274
|
+
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).twice.returns(false)
|
275
275
|
post :submit_multiple_reboot, params: {:host_ids => host.id}, session: set_session_user(User.current)
|
276
276
|
assert_redirected_to discovered_hosts_url
|
277
277
|
assert_equal "Errors during reboot: #{host.name}: failed to reboot", flash[:error]
|
@@ -284,7 +284,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
284
284
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
|
285
285
|
post :submit_multiple_reboot, params: {:host_ids => host.id}, session: set_session_user(User.current)
|
286
286
|
assert_redirected_to discovered_hosts_url
|
287
|
-
assert_match(/ERF50-
|
287
|
+
assert_match(/ERF50-9494/, flash[:error])
|
288
288
|
assert_nil flash[:success]
|
289
289
|
end
|
290
290
|
|
@@ -9,6 +9,8 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
|
|
9
9
|
assert discovered_notification_blueprint
|
10
10
|
discovered_host.save!
|
11
11
|
visit discovered_hosts_path
|
12
|
+
page.evaluate_script("document.getElementById('fixedPropertiesSelector-#{discovered_host.id}').classList.remove('fade')")
|
13
|
+
::ForemanDiscovery::HostConverter.stubs(:unused_ip_for_host)
|
12
14
|
end
|
13
15
|
|
14
16
|
teardown do
|
@@ -64,15 +66,14 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
|
|
64
66
|
|
65
67
|
test 'and forwards to editing it' do
|
66
68
|
create_host
|
67
|
-
|
68
|
-
current_path
|
69
|
+
assert_current_path edit_discovered_host_path(id: discovered_host), ignore_query: true
|
69
70
|
end
|
70
71
|
|
71
72
|
context 'with a Hostgroup selected' do
|
72
73
|
let(:discovery_hostgroup) { Hostgroup.first }
|
73
74
|
|
74
75
|
test 'it passes it on' do
|
75
|
-
|
76
|
+
select2(discovery_hostgroup.name, from: 'host_hostgroup_id')
|
76
77
|
create_host
|
77
78
|
assert_param discovery_hostgroup.id.to_s,
|
78
79
|
'host.hostgroup_id'
|
@@ -83,7 +84,7 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
|
|
83
84
|
let(:discovery_location) { Location.first }
|
84
85
|
|
85
86
|
test 'it passes it on' do
|
86
|
-
|
87
|
+
select2(discovery_location.name, from: 'host_location_id')
|
87
88
|
create_host
|
88
89
|
assert_param discovery_location.id.to_s,
|
89
90
|
'host.location_id'
|
@@ -94,7 +95,7 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
|
|
94
95
|
let(:discovery_organization) { Organization.first }
|
95
96
|
|
96
97
|
test 'it passes it on' do
|
97
|
-
|
98
|
+
select2(discovery_organization.name, from: 'host_organization_id')
|
98
99
|
create_host
|
99
100
|
assert_param discovery_organization.id.to_s,
|
100
101
|
'host.organization_id'
|
@@ -147,12 +148,6 @@ class DiscoveredHostsTest < IntegrationTestWithJavascript
|
|
147
148
|
page.find("#host_ids_#{id}").click
|
148
149
|
end
|
149
150
|
|
150
|
-
def select_from(element_id, id)
|
151
|
-
page.find_by_id(element_id, visible: false)
|
152
|
-
.find("option[value='#{id}']", visible: false)
|
153
|
-
.select_option
|
154
|
-
end
|
155
|
-
|
156
151
|
def create_host
|
157
152
|
page.find("#fixedPropertiesSelector-#{discovered_host.id}")
|
158
153
|
.find_button('Create Host').click
|
@@ -133,6 +133,18 @@ def facts_simple_network100_42
|
|
133
133
|
}
|
134
134
|
end
|
135
135
|
|
136
|
+
def facts_network_2001_db8
|
137
|
+
{
|
138
|
+
"interfaces" => "lo,eth0,eth1",
|
139
|
+
"ipaddress6" => "2001:db8::1",
|
140
|
+
"ipaddress6_eth0" => "2001:db8::1",
|
141
|
+
"ipaddress6_eth1" => "2001:db9::1",
|
142
|
+
"macaddress_eth0" => "AA:BB:CC:DD:EE:FA",
|
143
|
+
"macaddress_eth1" => "AA:BB:CC:DD:EE:FB",
|
144
|
+
"discovery_bootif" => "AA:BB:CC:DD:EE:FA",
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
136
148
|
def discover_host_from_facts(facts)
|
137
149
|
User.as_anonymous_admin do
|
138
150
|
Host::Discovered.import_host(facts)
|
@@ -7,7 +7,9 @@ class DiscoveredExtensionsTest < ActiveSupport::TestCase
|
|
7
7
|
|
8
8
|
setup do
|
9
9
|
@facts = facts_simple_network100_42
|
10
|
+
@facts_ipv6 = facts_network_2001_db8
|
10
11
|
set_default_settings
|
12
|
+
::ForemanDiscovery::HostConverter.stubs(:unused_ip_for_host)
|
11
13
|
end
|
12
14
|
|
13
15
|
test "no rule is found for empty rule set" do
|
@@ -179,6 +181,57 @@ class DiscoveredExtensionsTest < ActiveSupport::TestCase
|
|
179
181
|
assert_equal hostgroup.puppet_ca_proxy, managed_host.puppet_ca_proxy
|
180
182
|
end
|
181
183
|
|
184
|
+
class StubIPAM
|
185
|
+
def suggest_ip
|
186
|
+
"192.168.101.13"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
test "subnet is changed and unused_ip called" do
|
191
|
+
::ForemanDiscovery::HostConverter.unstub(:unused_ip_for_host)
|
192
|
+
facts = @facts.merge({"somefact" => "abc"})
|
193
|
+
domain = FactoryBot.create(:domain)
|
194
|
+
subnet = FactoryBot.create(:subnet_ipv4, :tftp, :dhcp, :name => 'subnet_100', :network => '192.168.100.0', :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
|
195
|
+
subnet2 = FactoryBot.create(:subnet_ipv4, :tftp, :dhcp, :name => 'subnet_101', :network => '192.168.101.0', :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
|
196
|
+
host = discover_host_from_facts(facts)
|
197
|
+
assert_equal subnet, host.subnet
|
198
|
+
hostgroup = FactoryBot.create(:hostgroup, :with_environment, :with_rootpass, :with_puppet_orchestration, :with_os, :pxe_loader => "PXELinux BIOS", :subnet => subnet2, :domain => domain)
|
199
|
+
r1 = FactoryBot.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc", :organizations => [host.organization], :locations => [host.location], :hostgroup => hostgroup)
|
200
|
+
Subnet.any_instance.expects(:unused_ip).with(host.mac).returns(StubIPAM.new)
|
201
|
+
host.primary_interface.stubs(:queue_tftp)
|
202
|
+
host.primary_interface.stubs(:queue_dhcp)
|
203
|
+
managed_host = perform_auto_provision(host, r1)
|
204
|
+
assert_empty host.errors
|
205
|
+
assert managed_host
|
206
|
+
assert_empty managed_host.errors
|
207
|
+
refute_nil hostgroup.subnet
|
208
|
+
refute_nil managed_host.subnet
|
209
|
+
assert_equal hostgroup.subnet, managed_host.subnet
|
210
|
+
assert_equal "192.168.101.13", managed_host.ip
|
211
|
+
end
|
212
|
+
|
213
|
+
test "subnet6 is changed and unused_ip called" do
|
214
|
+
::ForemanDiscovery::HostConverter.unstub(:unused_ip_for_host)
|
215
|
+
facts = @facts_ipv6.merge({"somefact" => "abc"})
|
216
|
+
domain = FactoryBot.create(:domain)
|
217
|
+
subnet = FactoryBot.create(:subnet_ipv6, :tftp, :dhcp, :network => "2001:db8::/32", :mask => "ffff:ffff::", :name => "ipv6_discovered", :ipam => IPAM::MODES[:eui64], :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
|
218
|
+
subnet2 = FactoryBot.create(:subnet_ipv6, :tftp, :dhcp, :network => "2001:db9::/32", :mask => "ffff:ffff::", :name => "ipv6_provision", :ipam => IPAM::MODES[:eui64], :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
|
219
|
+
host = discover_host_from_facts(facts)
|
220
|
+
assert_equal subnet, host.subnet6
|
221
|
+
hostgroup = FactoryBot.create(:hostgroup, :with_environment, :with_rootpass, :with_puppet_orchestration, :with_os, :pxe_loader => "PXELinux BIOS", :subnet6 => subnet2, :domain => domain)
|
222
|
+
r1 = FactoryBot.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc", :organizations => [host.organization], :locations => [host.location], :hostgroup => hostgroup)
|
223
|
+
host.primary_interface.stubs(:queue_tftp)
|
224
|
+
host.primary_interface.stubs(:queue_dhcp)
|
225
|
+
managed_host = perform_auto_provision(host, r1)
|
226
|
+
assert_empty host.errors
|
227
|
+
assert managed_host
|
228
|
+
assert_empty managed_host.errors
|
229
|
+
refute_nil hostgroup.subnet6
|
230
|
+
refute_nil managed_host.subnet6
|
231
|
+
assert_equal hostgroup.subnet6, managed_host.subnet6
|
232
|
+
assert_equal "2001:db9::a8bb:ccff:fedd:eefa", managed_host.ip6
|
233
|
+
end
|
234
|
+
|
182
235
|
test "attributes from hostgroup are copied after auto provisioning for host without subnet detected" do
|
183
236
|
facts = @facts.merge({"somefact" => "abc"})
|
184
237
|
host = discover_host_from_facts(facts)
|