foreman_discovery 14.0.1 → 15.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/app/controllers/api/v2/discovery_rules_controller.rb +2 -2
- data/app/controllers/concerns/foreman/controller/discovered_extensions.rb +2 -6
- data/app/controllers/discovered_hosts_controller.rb +4 -8
- data/app/helpers/discovered_hosts_helper.rb +3 -3
- data/app/helpers/discovery_rules_helper.rb +3 -3
- data/app/models/discovery_rule.rb +9 -13
- data/app/models/host/discovered.rb +6 -10
- data/app/models/host/managed_extensions.rb +6 -6
- data/app/models/setting/discovered.rb +2 -16
- data/app/services/foreman_discovery/import_hooks/subnet_and_taxonomy.rb +4 -4
- data/app/views/api/v2/discovered_hosts/main.json.rabl +2 -7
- data/app/views/api/v2/discovery_rules/main.json.rabl +4 -8
- data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +8 -17
- data/app/views/discovered_hosts/_selected_hosts.html.erb +2 -10
- data/app/views/discovered_hosts/multiple_destroy.html.erb +1 -1
- data/app/views/discovered_hosts/select_multiple_location.html.erb +1 -1
- data/app/views/discovered_hosts/select_multiple_organization.html.erb +1 -1
- data/app/views/foreman_discovery/debian_kexec.erb +1 -1
- data/app/views/foreman_discovery/redhat_kexec.erb +5 -2
- data/db/seeds.d/50_discovery_templates.rb +2 -2
- data/lib/foreman_discovery/engine.rb +3 -3
- 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 +92 -98
- data/locale/ca/foreman_discovery.po +2 -8
- data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/de/foreman_discovery.edit.po +111 -116
- data/locale/de/foreman_discovery.po +21 -26
- data/locale/en/foreman_discovery.edit.po +92 -100
- data/locale/en/foreman_discovery.po +0 -6
- data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en_GB/foreman_discovery.edit.po +92 -98
- data/locale/en_GB/foreman_discovery.po +2 -8
- data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/es/foreman_discovery.edit.po +106 -112
- data/locale/es/foreman_discovery.po +16 -22
- data/locale/foreman_discovery.pot +103 -109
- data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/fr/foreman_discovery.edit.po +107 -113
- data/locale/fr/foreman_discovery.po +17 -23
- data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/gl/foreman_discovery.edit.po +92 -98
- data/locale/gl/foreman_discovery.po +2 -8
- data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/it/foreman_discovery.edit.po +92 -98
- data/locale/it/foreman_discovery.po +2 -8
- data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ja/foreman_discovery.edit.po +106 -112
- data/locale/ja/foreman_discovery.po +16 -22
- data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ko/foreman_discovery.edit.po +92 -98
- data/locale/ko/foreman_discovery.po +2 -8
- data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/pt_BR/foreman_discovery.edit.po +106 -112
- data/locale/pt_BR/foreman_discovery.po +16 -22
- data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ru/foreman_discovery.edit.po +92 -98
- data/locale/ru/foreman_discovery.po +2 -8
- data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/sv_SE/foreman_discovery.edit.po +92 -98
- data/locale/sv_SE/foreman_discovery.po +2 -8
- data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_CN/foreman_discovery.edit.po +106 -112
- data/locale/zh_CN/foreman_discovery.po +16 -22
- data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_TW/foreman_discovery.edit.po +92 -98
- data/locale/zh_TW/foreman_discovery.po +2 -8
- data/test/factories/discovery_rule_related.rb +2 -2
- data/test/facts/asswweb061.json +2967 -0
- data/test/facts/qemu_noip.json +2 -0
- data/test/functional/api/v2/discovered_hosts_controller_test.rb +0 -16
- data/test/functional/discovered_hosts_controller_test.rb +19 -21
- data/test/test_helper_discovery.rb +1 -1
- data/test/unit/discovery_rule_test.rb +0 -2
- data/test/unit/host_discovered_test.rb +72 -16
- data/test/unit/managed_extensions_test.rb +2 -2
- data/test/unit/ui_notifications/destroy_host_test.rb +9 -0
- metadata +7 -2
@@ -0,0 +1,2 @@
|
|
1
|
+
{"os::release":null,"os":null,"processors":null,"discovery_proxy_type":"proxy","discovery_proxy_uri":"https://svrhqsrhs002v.bcnet.bou.or.ug:9090","discovery_dns":"172.16.2.12","discovery_gateway":"172.16.6.254","discovery_netmask":"255.255.255.0","discovery_ip":"172.16.6.177","discovery_ip_cidr":"172.16.6.177/24","discovery_kexec":"kexec-tools 2.0.15","nmprimary_ip6_route":"dst = ff00::/8, nh = ::, mt = 256, table=255","nmprimary_ip6_address":"fe80::21a:4aff:fe16:182/64","nmprimary_ip4_dns":"172.16.2.12","nmprimary_ip4_route":"dst = 172.16.6.0/24, nh = 0.0.0.0, mt = 100","nmprimary_ip4_gateway":"172.16.6.254","nmprimary_ip4_address":"172.16.6.177/24","nmprimary_general_vpn":"no","nmprimary_general_default6":"no","nmprimary_general_default":"yes","nmprimary_general_state":"activated","nmprimary_general_devices":"eth0","nmprimary_general_uuid":"7eef0138-2e0d-11e9-bf6e-001a4a160182","nmprimary_general_name":"primary","nmprimary_proxy_browser-only":"no","nmprimary_proxy_method":"none","nmprimary_vlan_flags":"1","nmprimary_vlan_id":"0","nmprimary_ipv6_dhcp-send-hostname":"yes","nmprimary_ipv6_addr-gen-mode":"eui64","nmprimary_ipv6_ip6-privacy":"-1","nmprimary_ipv6_may-fail":"yes","nmprimary_ipv6_never-default":"no","nmprimary_ipv6_ignore-auto-dns":"no","nmprimary_ipv6_ignore-auto-routes":"no","nmprimary_ipv6_route-table":"0","nmprimary_ipv6_route-metric":"-1","nmprimary_ipv6_dns-priority":"0","nmprimary_ipv6_method":"ignore","nmprimary_ipv4_may-fail":"yes","nmprimary_ipv4_never-default":"no","nmprimary_ipv4_dhcp-send-hostname":"no","nmprimary_ipv4_ignore-auto-dns":"no","nmprimary_ipv4_ignore-auto-routes":"no","nmprimary_ipv4_route-table":"0","nmprimary_ipv4_route-metric":"-1","nmprimary_ipv4_gateway":"172.16.6.254","nmprimary_ipv4_addresses":"172.16.6.177/24","nmprimary_ipv4_dns-priority":"0","nmprimary_ipv4_dns":"172.16.2.12","nmprimary_ipv4_method":"manual","nmprimary_802-3-ethernet_wake-on-lan":"default","nmprimary_802-3-ethernet_mtu":"auto","nmprimary_802-3-ethernet_mac-address":"00:1A:4A:16:01:82","nmprimary_802-3-ethernet_auto-negotiate":"no","nmprimary_802-3-ethernet_speed":"0","nmprimary_connection_lldp":"default","nmprimary_connection_metered":"unknown","nmprimary_connection_autoconnect-slaves":"-1","nmprimary_connection_read-only":"no","nmprimary_connection_auth-retries":"-1","nmprimary_connection_autoconnect-retries":"-1","nmprimary_connection_autoconnect-priority":"1","nmprimary_connection_autoconnect":"yes","nmprimary_connection_type":"802-3-ethernet","nmprimary_connection_uuid":"7eef0138-2e0d-11e9-bf6e-001a4a160182","nmprimary_connection_id":"primary","link_eth0":"true","discovery_bootip":"172.16.6.177","discovery_bootif":"00:1a:4a:16:01:82","discovery_release":"20180918.78a7ee2","discovery_version":"3.5.3","ipaddress":"172.16.6.177","macaddress":"00:1a:4a:16:01:82","processorcount":"2","processor1":"Intel Core Processor (Haswell, no TSX)","processor0":"Intel Core Processor (Haswell, no TSX)","facterversion":"2.4.1","netmask":"255.255.255.0","os::release::full":"7.5","os::release::minor":"5","os::release::major":"7","os::family":"RedHat","os::name":"RedHat","architecture":"x86_64","is_virtual":"true","virtual":"kvm","processors::physicalcount":"2","processors::count":"2","processors::models":"[\"Intel Core Processor (Haswell, no TSX)\", \"Intel Core Processor (Haswell, no TSX)\"]","network_eth0":"172.16.6.0","fqdn":"fdi","type":"Other","uuid":"8DC0DD71-F164-47BA-B0C6-F2EA8D322476","serialnumber":"30303038-3337-584D-5136-32343036324C","productname":"RHEV Hypervisor","manufacturer":"Red Hat","bios_release_date":"04/01/2014","bios_version":"1.11.0-2.el7","bios_vendor":"SeaBIOS","blockdevices":"sda,sr0","blockdevice_sr0_model":"QEMU DVD-ROM","blockdevice_sr0_vendor":"QEMU","blockdevice_sr0_size":"251658240","blockdevice_sda_model":"QEMU HARDDISK","blockdevice_sda_vendor":"QEMU","blockdevice_sda_size":"75161927680","physicalprocessorcount":"2","uniqueid":"10acb106","memorysize_mb":"7981.07","memorysize":"7.79 GB","hostname":"fdi","id":"root","ps":"ps -ef","hardwareisa":"x86_64","gid":"root","mtu_eth0":"1500","netmask_eth0":"255.255.255.0","macaddress_eth0":"00:1a:4a:16:01:82","ipaddress_eth0":"172.16.6.177","interfaces":"eth0,lo","hardwaremodel":"x86_64","lib":"/usr/share/fdi/facts:/opt/extension/facts"}
|
2
|
+
|
@@ -12,8 +12,6 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
setup do
|
15
|
-
SETTINGS[:organizations_enabled] = true
|
16
|
-
SETTINGS[:locations_enabled] = true
|
17
15
|
FactoryBot.create(:subnet, :network => "192.168.100.1", :mask => "255.255.255.0", :locations => [location_one], :organizations => [organization_one])
|
18
16
|
@request.env['HTTP_REFERER'] = '/discovery_rules'
|
19
17
|
@facts = {
|
@@ -159,20 +157,6 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
159
157
|
assert_equal "No rule found for host #{host.name}", show_response["error"]["message"]
|
160
158
|
end
|
161
159
|
|
162
|
-
def test_auto_provision_with_wrong_disabled_org_sucess
|
163
|
-
disable_orchestration
|
164
|
-
SETTINGS[:organizations_enabled] = false
|
165
|
-
facts = @facts.merge({"somefact" => "abc"})
|
166
|
-
host = discover_host_from_facts(facts)
|
167
|
-
taxonomy = { :locations => [host.location] }
|
168
|
-
FactoryBot.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryBot.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
169
|
-
post :auto_provision, params: { :id => host.id }
|
170
|
-
assert_match host.name, @response.body
|
171
|
-
assert_response :success
|
172
|
-
ensure
|
173
|
-
SETTINGS[:organizations_enabled] = true
|
174
|
-
end
|
175
|
-
|
176
160
|
def test_auto_provision_success_and_delete
|
177
161
|
disable_orchestration
|
178
162
|
facts = @facts.merge({"somefact" => "abc"})
|
@@ -84,27 +84,25 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_edit_form_quick_submit
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
:
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
assert_match(/Successfully/, flash[:success])
|
107
|
-
end
|
87
|
+
domain = FactoryBot.create(:domain)
|
88
|
+
hostgroup = FactoryBot.create(:hostgroup, :with_subnet, :with_environment, :with_rootpass, :with_os, :domain => domain)
|
89
|
+
new_ip = hostgroup.subnet.ipaddr
|
90
|
+
host = discover_host_from_facts(@facts.merge({
|
91
|
+
'ipaddress' => new_ip,
|
92
|
+
'ipaddress_eth0' => new_ip
|
93
|
+
}))
|
94
|
+
get :edit, params: {
|
95
|
+
:id => host.id,
|
96
|
+
:quick_submit => true,
|
97
|
+
:host => {
|
98
|
+
:hostgroup_id => hostgroup.id
|
99
|
+
} }, session: set_session_user_default_manager
|
100
|
+
|
101
|
+
managed_host = Host.find(host.id)
|
102
|
+
assert managed_host.build
|
103
|
+
assert_redirected_to host_url(managed_host)
|
104
|
+
assert_equal hostgroup.id, managed_host.hostgroup_id
|
105
|
+
assert_match(/Successfully/, flash[:success])
|
108
106
|
end
|
109
107
|
|
110
108
|
def test_edit_form_submit_parameters
|
@@ -150,7 +150,6 @@ class DiscoveryRuleTest < ActiveSupport::TestCase
|
|
150
150
|
end
|
151
151
|
|
152
152
|
test "should enforce hostgroup organizations" do
|
153
|
-
skip unless SETTINGS[:organizations_enabled]
|
154
153
|
rule = DiscoveryRule.new :name => "myrule",
|
155
154
|
:search => "cpu_count > 1",
|
156
155
|
:hostgroup_id => @hostgroup.id
|
@@ -159,7 +158,6 @@ class DiscoveryRuleTest < ActiveSupport::TestCase
|
|
159
158
|
end
|
160
159
|
|
161
160
|
test "should enforce hostgroup organizations and locations" do
|
162
|
-
skip unless (SETTINGS[:organizations_enabled] && SETTINGS[:locations_enabled])
|
163
161
|
loc = FactoryBot.create(:location, :name => "hgloc")
|
164
162
|
@hostgroup.locations << loc
|
165
163
|
@hostgroup.save!
|
@@ -27,7 +27,7 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
27
27
|
|
28
28
|
test "should import facts from yaml with random based generator as Host::Discovered" do
|
29
29
|
Setting[:discovery_naming] = "Random-name"
|
30
|
-
|
30
|
+
NameGenerator.any_instance.stubs(:register).returns(1305)
|
31
31
|
host = discover_host_from_facts(@facts)
|
32
32
|
assert_equal "velma-startin", host.name
|
33
33
|
end
|
@@ -62,17 +62,82 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
62
62
|
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
63
63
|
host = discover_host_from_facts(@facts)
|
64
64
|
assert_equal subnet, host.primary_interface.subnet
|
65
|
+
assert_equal org, host.organization
|
66
|
+
assert_equal loc, host.location
|
65
67
|
end
|
66
68
|
|
67
|
-
test "should
|
68
|
-
org = FactoryBot.create(:organization
|
69
|
-
loc = FactoryBot.create(:location
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
test "should detect taxonomy as 'first' organization (e.g. randomly)" do
|
70
|
+
org = FactoryBot.create(:organization)
|
71
|
+
loc = FactoryBot.create(:location)
|
72
|
+
org2 = FactoryBot.create(:organization)
|
73
|
+
loc2 = FactoryBot.create(:location)
|
74
|
+
Setting['discovery_organization'] = nil
|
75
|
+
Setting['discovery_location'] = nil
|
76
|
+
subnet = FactoryBot.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org, org2], :locations => [loc, loc2])
|
73
77
|
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
74
78
|
host = discover_host_from_facts(@facts)
|
75
79
|
assert_equal subnet, host.primary_interface.subnet
|
80
|
+
assert host.organization
|
81
|
+
assert host.location
|
82
|
+
end
|
83
|
+
|
84
|
+
test "discovery_organization must not be overriden by organization_fact from core" do
|
85
|
+
begin
|
86
|
+
org = FactoryBot.create(:organization, :name => "subnet_org", :title => "subnet_org")
|
87
|
+
loc = FactoryBot.create(:location, :name => "subnet_loc", :title => "subnet_loc")
|
88
|
+
bad_org = FactoryBot.create(:organization, :name => "bad_org", :title => "bad_org")
|
89
|
+
bad_loc = FactoryBot.create(:location, :name => "bad_loc", :title => "bad_loc")
|
90
|
+
Setting['organization_fact'] = "test_org"
|
91
|
+
Setting['location_fact'] = "test_loc"
|
92
|
+
Setting['discovery_organization'] = org.name
|
93
|
+
Setting['discovery_location'] = loc.name
|
94
|
+
subnet = FactoryBot.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org], :locations => [loc])
|
95
|
+
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
96
|
+
host = discover_host_from_facts(@facts.merge("test_org" => bad_org.title, "test_loc" => bad_loc.title))
|
97
|
+
assert_equal subnet, host.primary_interface.subnet
|
98
|
+
assert_equal org, host.organization
|
99
|
+
assert_equal loc, host.location
|
100
|
+
ensure
|
101
|
+
Setting['organization_fact'] = nil
|
102
|
+
Setting['location_fact'] = nil
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
test "discovery_organization must not be overriden by foreman_organization from core" do
|
107
|
+
org = FactoryBot.create(:organization, :name => "subnet_org", :title => "subnet_org")
|
108
|
+
loc = FactoryBot.create(:location, :name => "subnet_loc", :title => "subnet_loc")
|
109
|
+
bad_org = FactoryBot.create(:organization, :name => "bad_org", :title => "bad_org")
|
110
|
+
bad_loc = FactoryBot.create(:location, :name => "bad_loc", :title => "bad_loc")
|
111
|
+
Setting['discovery_organization'] = org.name
|
112
|
+
Setting['discovery_location'] = loc.name
|
113
|
+
subnet = FactoryBot.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org, bad_org], :locations => [loc, bad_loc])
|
114
|
+
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
115
|
+
host = discover_host_from_facts(@facts.merge("foreman_organization" => bad_org.title, "foreman_location" => bad_loc.title))
|
116
|
+
assert_equal subnet, host.primary_interface.subnet
|
117
|
+
assert_equal org, host.organization
|
118
|
+
assert_equal loc, host.location
|
119
|
+
end
|
120
|
+
|
121
|
+
test "discovery_organization must not be overriden by default_organization from core" do
|
122
|
+
begin
|
123
|
+
org = FactoryBot.create(:organization, :name => "subnet_org", :title => "subnet_org")
|
124
|
+
loc = FactoryBot.create(:location, :name => "subnet_loc", :title => "subnet_loc")
|
125
|
+
bad_org = FactoryBot.create(:organization, :name => "bad_org", :title => "bad_org")
|
126
|
+
bad_loc = FactoryBot.create(:location, :name => "bad_loc", :title => "bad_loc")
|
127
|
+
Setting['default_organization'] = bad_org.title
|
128
|
+
Setting['default_location'] = bad_loc.title
|
129
|
+
Setting['discovery_organization'] = org.name
|
130
|
+
Setting['discovery_location'] = loc.name
|
131
|
+
subnet = FactoryBot.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org, bad_org], :locations => [loc, bad_loc])
|
132
|
+
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
133
|
+
host = discover_host_from_facts(@facts)
|
134
|
+
assert_equal subnet, host.primary_interface.subnet
|
135
|
+
assert_equal org, host.organization
|
136
|
+
assert_equal loc, host.location
|
137
|
+
ensure
|
138
|
+
Setting['default_organization'] = nil
|
139
|
+
Setting['default_location'] = nil
|
140
|
+
end
|
76
141
|
end
|
77
142
|
|
78
143
|
test "should set nested org and loc" do
|
@@ -371,15 +436,6 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
371
436
|
@host.organization = @org
|
372
437
|
assert_equal recipients, @host.notification_recipients_ids.sort
|
373
438
|
end
|
374
|
-
|
375
|
-
test 'finds only admin users if organizations are disabled' do
|
376
|
-
begin
|
377
|
-
SETTINGS[:organizations_enabled] = false
|
378
|
-
assert_equal @admins.sort, @host.notification_recipients_ids.sort
|
379
|
-
ensure
|
380
|
-
SETTINGS[:organizations_enabled] = true
|
381
|
-
end
|
382
|
-
end
|
383
439
|
end
|
384
440
|
|
385
441
|
test "primary interface isn't touched with no LLDP facts" do
|
@@ -65,7 +65,7 @@ class ManagedExtensionsTest < ActiveSupport::TestCase
|
|
65
65
|
end
|
66
66
|
|
67
67
|
test "setKexec calls renderer" do
|
68
|
-
Host::Discovered.any_instance.expects(:
|
68
|
+
Host::Discovered.any_instance.expects(:render_template).with() { |json| JSON.parse(json) }.once
|
69
69
|
Foreman::Renderer.expects(:render).returns({})
|
70
70
|
@host.setKexec
|
71
71
|
end
|
@@ -88,7 +88,7 @@ class ManagedExtensionsTest < ActiveSupport::TestCase
|
|
88
88
|
|
89
89
|
test "kexec template is correctly rendered" do
|
90
90
|
expected = {
|
91
|
-
"append" => "ks=http://foreman.some.host.fqdn/unattended/provision&static=yes inst.ks.sendmac ip=::::::none nameserver= ksdevice=bootif BOOTIF= nomodeset nomodeset",
|
91
|
+
"append" => "ks=http://foreman.some.host.fqdn/unattended/provision&static=yes inst.ks.sendmac ip=::::::none nameserver= ksdevice=bootif BOOTIF= nomodeset nokaslr nomodeset",
|
92
92
|
"extra" => []
|
93
93
|
}
|
94
94
|
assert @host.operatingsystem.respond_to?(:pxe_type)
|
@@ -41,6 +41,15 @@ class DestroyHostNotificationTest < ActiveSupport::TestCase
|
|
41
41
|
assert_equal 0, blueprint.notifications.count
|
42
42
|
end
|
43
43
|
|
44
|
+
test 'discovered host type must not update notifications on plain save' do
|
45
|
+
host = FactoryBot.create(:discovered_host)
|
46
|
+
ForemanDiscovery::UINotifications::NewHost.deliver!(host)
|
47
|
+
assert_equal 1, blueprint.notifications.count
|
48
|
+
host.name = "triggerchange"
|
49
|
+
assert host.save!
|
50
|
+
assert_equal 1, blueprint.notifications.count
|
51
|
+
end
|
52
|
+
|
44
53
|
test 'type change should not removing notifications for discovered hosts' do
|
45
54
|
host1 = FactoryBot.create(:discovered_host)
|
46
55
|
ForemanDiscovery::UINotifications::NewHost.deliver!(host1)
|
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:
|
4
|
+
version: 15.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditi Puntambekar
|
@@ -28,6 +28,7 @@ authors:
|
|
28
28
|
- Ido Kanner
|
29
29
|
- imriz
|
30
30
|
- Imri Zvik
|
31
|
+
- Ivan Nečas
|
31
32
|
- Joseph Mitchell Magen
|
32
33
|
- June Zhang
|
33
34
|
- kgaikwad
|
@@ -67,7 +68,7 @@ authors:
|
|
67
68
|
autorequire:
|
68
69
|
bindir: bin
|
69
70
|
cert_chain: []
|
70
|
-
date: 2019-
|
71
|
+
date: 2019-05-13 00:00:00.000000000 Z
|
71
72
|
dependencies: []
|
72
73
|
description: MaaS Discovery Plugin engine for Foreman
|
73
74
|
email: gsutclif@redhat.com
|
@@ -233,12 +234,14 @@ files:
|
|
233
234
|
- locale/zh_TW/foreman_discovery.po
|
234
235
|
- test/factories/discovery_host_related.rb
|
235
236
|
- test/factories/discovery_rule_related.rb
|
237
|
+
- test/facts/asswweb061.json
|
236
238
|
- test/facts/default.json
|
237
239
|
- test/facts/dell_npars.json
|
238
240
|
- test/facts/dell_vlan.json
|
239
241
|
- test/facts/facts_with_lldp.json
|
240
242
|
- test/facts/facts_with_lldp_bond_candidate.json
|
241
243
|
- test/facts/pxeless-vlan.json
|
244
|
+
- test/facts/qemu_noip.json
|
242
245
|
- test/facts/regular_host.json
|
243
246
|
- test/facts/rhel-dl380-1kdisks.json
|
244
247
|
- test/facts/rhel-r730.json
|
@@ -300,7 +303,9 @@ test_files:
|
|
300
303
|
- test/integration/discovered_hosts_test.rb
|
301
304
|
- test/facts/facts_with_lldp.json
|
302
305
|
- test/facts/dell_vlan.json
|
306
|
+
- test/facts/asswweb061.json
|
303
307
|
- test/facts/rhel-r730.json
|
308
|
+
- test/facts/qemu_noip.json
|
304
309
|
- test/facts/regular_host.json
|
305
310
|
- test/facts/vmware_local.json
|
306
311
|
- test/facts/pxeless-vlan.json
|