foreman_discovery 7.0.1 → 8.0.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/discovered_hosts_controller.rb +2 -2
- data/app/controllers/discovered_hosts_controller.rb +2 -5
- data/app/models/host/discovered.rb +18 -10
- data/app/models/setting/discovered.rb +4 -2
- data/app/services/foreman_discovery/host_converter.rb +6 -1
- data/app/views/api/v2/discovered_hosts/main.json.rabl +4 -0
- data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +3 -3
- data/app/views/discovery_rules/_form.html.erb +3 -5
- data/app/views/discovery_rules/index.html.erb +1 -1
- data/db/migrate/20160805104605_rename_lock_template_setting.rb +14 -0
- data/db/migrate/20160925213030_change_discovery_widget_names.rb +11 -0
- data/db/migrate/20160927164411_define_explicit_length_for_discovery_rule_attributes.rb +7 -0
- data/db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb +17 -0
- data/lib/foreman_discovery/engine.rb +10 -6
- 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 +120 -163
- data/locale/ca/foreman_discovery.po +36 -12
- data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/de/foreman_discovery.edit.po +123 -163
- data/locale/de/foreman_discovery.po +38 -14
- data/locale/en/foreman_discovery.edit.po +73 -49
- data/locale/en/foreman_discovery.po +23 -5
- data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en_GB/foreman_discovery.edit.po +130 -165
- data/locale/en_GB/foreman_discovery.po +39 -15
- data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/es/foreman_discovery.edit.po +120 -163
- data/locale/es/foreman_discovery.po +37 -13
- data/locale/foreman_discovery.pot +79 -50
- data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/fr/foreman_discovery.edit.po +128 -164
- data/locale/fr/foreman_discovery.po +39 -15
- data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/gl/foreman_discovery.edit.po +116 -163
- data/locale/gl/foreman_discovery.po +36 -12
- data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/it/foreman_discovery.edit.po +120 -163
- data/locale/it/foreman_discovery.po +37 -13
- data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ja/foreman_discovery.edit.po +122 -163
- data/locale/ja/foreman_discovery.po +37 -13
- data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ko/foreman_discovery.edit.po +120 -162
- data/locale/ko/foreman_discovery.po +37 -13
- data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/pt_BR/foreman_discovery.edit.po +120 -163
- data/locale/pt_BR/foreman_discovery.po +39 -15
- data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ru/foreman_discovery.edit.po +123 -164
- data/locale/ru/foreman_discovery.po +37 -13
- data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/sv_SE/foreman_discovery.edit.po +116 -163
- data/locale/sv_SE/foreman_discovery.po +36 -12
- data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_CN/foreman_discovery.edit.po +122 -163
- data/locale/zh_CN/foreman_discovery.po +37 -13
- data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_TW/foreman_discovery.edit.po +122 -163
- data/locale/zh_TW/foreman_discovery.po +37 -13
- data/test/functional/api/v2/discovered_hosts_controller_test.rb +54 -27
- data/test/functional/api/v2/discovery_rules_controller_test.rb +1 -9
- data/test/functional/discovered_hosts_controller_test.rb +35 -17
- data/test/test_helper_discovery.rb +17 -0
- data/test/unit/discovered_extensions_test.rb +1 -9
- data/test/unit/discovery_rule_test.rb +51 -0
- data/test/unit/discovery_taxonomy_extensions_test.rb +1 -8
- data/test/unit/host_discovered_test.rb +16 -50
- metadata +7 -19
- data/app/models/concerns/discovery_subnet.rb +0 -7
- data/app/overrides/subnet_form_with_discovery_proxy.rb +0 -9
@@ -2,30 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class HostDiscoveredTest < ActiveSupport::TestCase
|
4
4
|
setup do
|
5
|
-
|
6
|
-
:name => 'discovery_fact',
|
7
|
-
:value => 'discovery_bootif',
|
8
|
-
:category => 'Setting::Discovered')
|
9
|
-
FactoryGirl.create(:setting,
|
10
|
-
:name => 'discovery_hostname',
|
11
|
-
:value => 'discovery_bootif',
|
12
|
-
:category => 'Setting::Discovered')
|
13
|
-
FactoryGirl.create(:setting,
|
14
|
-
:name => 'discovery_prefix',
|
15
|
-
:value => 'mac',
|
16
|
-
:category => 'Setting::Discovered')
|
17
|
-
FactoryGirl.create(:setting,
|
18
|
-
:name => 'discovery_lock',
|
19
|
-
:value => 'false',
|
20
|
-
:category => 'Setting::Discovered')
|
21
|
-
FactoryGirl.create(:setting,
|
22
|
-
:name => 'discovery_lock_template',
|
23
|
-
:value => 'pxelinux_discovery',
|
24
|
-
:category => 'Setting::Discovered')
|
25
|
-
FactoryGirl.create(:setting,
|
26
|
-
:name => 'discovery_clean_facts',
|
27
|
-
:value => false,
|
28
|
-
:category => 'Setting::Discovered')
|
5
|
+
set_default_settings
|
29
6
|
end
|
30
7
|
|
31
8
|
test "should be able to create Host::Discovered objects" do
|
@@ -41,7 +18,7 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
41
18
|
|
42
19
|
test "should setup subnet" do
|
43
20
|
raw = parse_json_fixture('/facts.json')
|
44
|
-
subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '
|
21
|
+
subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [Organization.first], :locations => [Location.first])
|
45
22
|
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
46
23
|
host = Host::Discovered.import_host(raw['facts'])
|
47
24
|
assert_equal subnet, host.primary_interface.subnet
|
@@ -50,16 +27,10 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
50
27
|
test "should setup subnet with org and loc" do
|
51
28
|
org = FactoryGirl.create(:organization, :name => "subnet_org")
|
52
29
|
loc = FactoryGirl.create(:location, :name => "subnet_loc")
|
53
|
-
|
54
|
-
|
55
|
-
:value => org.name,
|
56
|
-
:category => 'Setting::Discovered')
|
57
|
-
FactoryGirl.create(:setting,
|
58
|
-
:name => 'discovery_location',
|
59
|
-
:value => loc.name,
|
60
|
-
:category => 'Setting::Discovered')
|
30
|
+
Setting['discovery_organization'] = org.name
|
31
|
+
Setting['discovery_location'] = loc.name
|
61
32
|
raw = parse_json_fixture('/facts.json')
|
62
|
-
subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '
|
33
|
+
subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org], :locations => [loc])
|
63
34
|
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
64
35
|
host = Host::Discovered.import_host(raw['facts'])
|
65
36
|
assert_equal subnet, host.primary_interface.subnet
|
@@ -70,16 +41,10 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
70
41
|
org = FactoryGirl.create(:organization, :name => "suborg", :parent_id => org_parent.id)
|
71
42
|
loc_parent = FactoryGirl.create(:location, :name => "loc")
|
72
43
|
loc = FactoryGirl.create(:location, :name => "subloc", :parent_id => loc_parent.id)
|
73
|
-
|
74
|
-
|
75
|
-
:value => org.name,
|
76
|
-
:category => 'Setting::Discovered')
|
77
|
-
FactoryGirl.create(:setting,
|
78
|
-
:name => 'discovery_location',
|
79
|
-
:value => loc.name,
|
80
|
-
:category => 'Setting::Discovered')
|
44
|
+
Setting['discovery_organization'] = org.name
|
45
|
+
Setting['discovery_location'] = loc.name
|
81
46
|
raw = parse_json_fixture('/facts.json')
|
82
|
-
subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '
|
47
|
+
subnet = FactoryGirl.create(:subnet_ipv4, :name => 'Subnet99', :network => '10.35.27.0', :organizations => [org], :locations => [loc])
|
83
48
|
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
84
49
|
host = Host::Discovered.import_host(raw['facts'])
|
85
50
|
assert_equal org, host.organization
|
@@ -114,7 +79,6 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
114
79
|
test "should lock host into discovery via PXE configuration" do
|
115
80
|
Host::Discovered.delete('mace41f13cc3658')
|
116
81
|
Setting[:discovery_lock] = "true"
|
117
|
-
Setting[:discovery_lock_template] = 'discovery_lock_template'
|
118
82
|
raw = parse_json_fixture('/facts.json')
|
119
83
|
subnet = FactoryGirl.create(:subnet,
|
120
84
|
:tftp,
|
@@ -125,12 +89,14 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
125
89
|
:locations => [Location.first]
|
126
90
|
)
|
127
91
|
Subnet.expects(:subnet_for).with('10.35.27.3').returns(subnet)
|
128
|
-
ProxyAPI::TFTP.any_instance.expects(:set).with('e4:1f:13:cc:36:58', anything).returns(true)
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
92
|
+
ProxyAPI::TFTP.any_instance.expects(:set).with(anything, 'e4:1f:13:cc:36:58', anything).returns(true).times(3)
|
93
|
+
TemplateKind::PXE.each do |kind|
|
94
|
+
ProvisioningTemplate.where(:name => "#{kind.downcase}_discovery").first_or_create(
|
95
|
+
:template_kind_id => template_kinds(kind.downcase.to_sym),
|
96
|
+
:snippet => true,
|
97
|
+
:template => "test"
|
98
|
+
)
|
99
|
+
end
|
134
100
|
assert Host::Discovered.import_host(raw['facts'])
|
135
101
|
assert Host::Discovered.find_by_name('mace41f13cc3658')
|
136
102
|
refute Host::Managed.find_by_name('mace41f13cc3658')
|
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: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amos Benari
|
@@ -32,22 +32,8 @@ authors:
|
|
32
32
|
autorequire:
|
33
33
|
bindir: bin
|
34
34
|
cert_chain: []
|
35
|
-
date:
|
36
|
-
dependencies:
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: deface
|
39
|
-
requirement: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '2.0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '2.0'
|
35
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
36
|
+
dependencies: []
|
51
37
|
description: MaaS Discovery Plugin engine for Foreman
|
52
38
|
email: gsutclif@redhat.com
|
53
39
|
executables: []
|
@@ -71,7 +57,6 @@ files:
|
|
71
57
|
- app/helpers/discovery_rules_helper.rb
|
72
58
|
- app/lib/facter_utils.rb
|
73
59
|
- app/mailers/discovered_mailer.rb
|
74
|
-
- app/models/concerns/discovery_subnet.rb
|
75
60
|
- app/models/concerns/discovery_taxonomy_extensions.rb
|
76
61
|
- app/models/concerns/fact_value_extensions.rb
|
77
62
|
- app/models/discovery_attribute_set.rb
|
@@ -81,7 +66,6 @@ files:
|
|
81
66
|
- app/models/hostgroup_extensions.rb
|
82
67
|
- app/models/nic/managed_extensions.rb
|
83
68
|
- app/models/setting/discovered.rb
|
84
|
-
- app/overrides/subnet_form_with_discovery_proxy.rb
|
85
69
|
- app/services/foreman_discovery/fact_parser.rb
|
86
70
|
- app/services/foreman_discovery/host_converter.rb
|
87
71
|
- app/services/foreman_discovery/node_api/inventory.rb
|
@@ -136,7 +120,11 @@ files:
|
|
136
120
|
- db/migrate/20150714144500_review_discovery_permissions.rb
|
137
121
|
- db/migrate/20151023144501_regenerate_red_hat_kexec.rb
|
138
122
|
- db/migrate/20160719124942_add_missing_view_permissions.rb
|
123
|
+
- db/migrate/20160805104605_rename_lock_template_setting.rb
|
139
124
|
- db/migrate/20160818091421_add_permissions_from_default_roles.rb
|
125
|
+
- db/migrate/20160925213030_change_discovery_widget_names.rb
|
126
|
+
- db/migrate/20160927164411_define_explicit_length_for_discovery_rule_attributes.rb
|
127
|
+
- db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb
|
140
128
|
- db/seeds.d/50_discovery_templates.rb
|
141
129
|
- db/seeds.d/60_discovery_proxy_feature.rb
|
142
130
|
- db/seeds.d/70_discovery_mail_notification.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
selector_text = " <%= select_f f, :discovery_id, SmartProxy.with_features('Discovery'), :id, :name,
|
2
|
-
{:include_blank => _('None')},
|
3
|
-
:label => _('Discovery Proxy'),
|
4
|
-
:help_inline => _('Discovery Proxy to use within this subnet for managing connection to discovered hosts') %>"
|
5
|
-
|
6
|
-
Deface::Override.new(:virtual_path => "subnets/_form",
|
7
|
-
:name => "add_discovery_proxy_to_subnet",
|
8
|
-
:insert_bottom => 'div#proxies',
|
9
|
-
:text => selector_text)
|