foreman_discovery 3.0.0 → 4.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 +1 -1
- data/app/controllers/api/v2/discovered_hosts_controller.rb +31 -11
- data/app/controllers/api/v2/discovery_rules_controller.rb +8 -16
- data/app/controllers/concerns/foreman/controller/discovered_extensions.rb +47 -2
- data/app/controllers/discovered_hosts_controller.rb +30 -55
- data/app/controllers/discovery_rules_controller.rb +2 -4
- data/app/helpers/discovered_hosts_helper.rb +27 -5
- data/app/lib/facter_utils.rb +18 -0
- data/app/lib/puppet_fact_parser_extensions.rb +18 -32
- data/app/models/discovery_rule.rb +33 -2
- data/app/models/host/discovered.rb +47 -61
- data/app/models/host/managed_extensions.rb +12 -3
- data/app/models/setting/discovered.rb +18 -6
- data/app/services/foreman_discovery/host_converter.rb +22 -0
- data/app/views/api/v2/discovered_hosts/main.json.rabl +1 -1
- data/app/views/api/v2/discovery_rules/main.json.rabl +6 -1
- data/app/views/api/v2/discovery_rules/show.json.rabl +4 -0
- data/app/views/dashboard/_discovery_widget.html.erb +6 -4
- data/app/views/dashboard/_discovery_widget_host.html.erb +4 -0
- data/app/views/dashboard/_discovery_widget_host_list.html.erb +2 -3
- data/app/views/discovered_hosts/_discovered_host.html.erb +3 -5
- data/app/views/discovered_hosts/_discovered_hosts_list.html.erb +7 -7
- data/app/views/discovered_hosts/index.html.erb +1 -0
- data/app/views/discovery_rules/_form.html.erb +51 -32
- data/config/routes.rb +4 -4
- data/db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb +8 -0
- data/db/migrate/20150331132115_remove_old_permissions.rb +16 -0
- data/db/migrate/20150505111345_remove_leftover_tokens.rb +13 -0
- data/db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb +10 -0
- data/db/migrate/20150714144500_review_discovery_permissions.rb +17 -0
- data/lib/foreman_discovery/engine.rb +46 -16
- data/lib/foreman_discovery/version.rb +1 -1
- data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/de/foreman_discovery.po +74 -72
- data/locale/de/foreman_discovery.pox +40 -0
- data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en_GB/foreman_discovery.po +90 -88
- data/locale/en_GB/foreman_discovery.pox +0 -0
- data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/es/foreman_discovery.po +3 -3
- data/locale/es/foreman_discovery.pox +41 -0
- data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/fr/foreman_discovery.po +3 -3
- data/locale/fr/foreman_discovery.pox +69 -0
- data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/gl/foreman_discovery.po +3 -3
- data/locale/gl/foreman_discovery.pox +21 -0
- data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/it/foreman_discovery.po +3 -3
- data/locale/it/foreman_discovery.pox +0 -0
- data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ja/foreman_discovery.po +67 -66
- data/locale/ja/foreman_discovery.pox +29 -0
- data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ko/foreman_discovery.po +3 -3
- data/locale/ko/foreman_discovery.pox +189 -0
- data/locale/messages.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/pt_BR/foreman_discovery.po +7 -7
- data/locale/pt_BR/foreman_discovery.pox +0 -0
- data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ru/foreman_discovery.po +98 -96
- data/locale/ru/foreman_discovery.pox +0 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/sv_SE/foreman_discovery.po +3 -3
- data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_CN/foreman_discovery.po +3 -3
- data/locale/zh_CN/foreman_discovery.pox +33 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_TW/foreman_discovery.po +3 -3
- data/locale/zh_TW/foreman_discovery.pox +23 -0
- data/test/functional/api/v2/discovered_hosts_controller_test.rb +45 -7
- data/test/functional/discovered_hosts_controller_test.rb +52 -11
- data/test/unit/discovered_extensions_test.rb +40 -17
- data/test/unit/discovery_rule_test.rb +59 -0
- data/test/unit/host_discovered_test.rb +69 -6
- data/test/unit/puppet_fact_parser_extensions_test.rb +55 -40
- metadata +103 -81
- data/app/services/host_converter.rb +0 -30
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_discovery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Sutcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - <
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - <
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
description: 'MaaS Discovery Plugin engine for Foreman '
|
28
28
|
email: gsutclif@redhat.com
|
29
29
|
executables: []
|
@@ -32,114 +32,135 @@ extra_rdoc_files:
|
|
32
32
|
- LICENSE
|
33
33
|
- README.md
|
34
34
|
files:
|
35
|
-
- LICENSE
|
36
|
-
- README.md
|
37
|
-
- app/controllers/api/v2/discovered_hosts_controller.rb
|
38
|
-
- app/controllers/api/v2/discovery_rules_controller.rb
|
39
|
-
- app/controllers/concerns/foreman/controller/discovered_extensions.rb
|
40
|
-
- app/controllers/discovered_hosts_controller.rb
|
41
35
|
- app/controllers/discovery_rules_controller.rb
|
42
|
-
- app/
|
43
|
-
- app/
|
36
|
+
- app/controllers/discovered_hosts_controller.rb
|
37
|
+
- app/controllers/concerns/foreman/controller/discovered_extensions.rb
|
38
|
+
- app/controllers/api/v2/discovery_rules_controller.rb
|
39
|
+
- app/controllers/api/v2/discovered_hosts_controller.rb
|
44
40
|
- app/lib/puppet_fact_parser_extensions.rb
|
45
|
-
- app/
|
46
|
-
- app/
|
47
|
-
- app/
|
41
|
+
- app/lib/facter_utils.rb
|
42
|
+
- app/services/foreman_discovery/host_converter.rb
|
43
|
+
- app/helpers/discovery_rules_helper.rb
|
44
|
+
- app/helpers/discovered_hosts_helper.rb
|
45
|
+
- app/overrides/subnet_form_with_discovery_proxy.rb
|
46
|
+
- app/models/setting/discovered.rb
|
47
|
+
- app/models/hostgroup_extensions.rb
|
48
48
|
- app/models/host/discovered.rb
|
49
49
|
- app/models/host/managed_extensions.rb
|
50
|
-
- app/models/
|
51
|
-
- app/models/
|
52
|
-
- app/
|
53
|
-
- app/services/host_converter.rb
|
54
|
-
- app/views/api/v2/discovered_hosts/auto_provision.json.rabl
|
55
|
-
- app/views/api/v2/discovered_hosts/auto_provision_all.json.rabl
|
56
|
-
- app/views/api/v2/discovered_hosts/base.json.rabl
|
57
|
-
- app/views/api/v2/discovered_hosts/index.json.rabl
|
58
|
-
- app/views/api/v2/discovered_hosts/main.json.rabl
|
59
|
-
- app/views/api/v2/discovered_hosts/show.json.rabl
|
60
|
-
- app/views/api/v2/discovered_hosts/update.json.rabl
|
61
|
-
- app/views/api/v2/discovery_rules/base.json.rabl
|
62
|
-
- app/views/api/v2/discovery_rules/index.json.rabl
|
63
|
-
- app/views/api/v2/discovery_rules/main.json.rabl
|
64
|
-
- app/views/api/v2/discovery_rules/show.json.rabl
|
65
|
-
- app/views/dashboard/_discovery_widget.html.erb
|
50
|
+
- app/models/discovery_rule.rb
|
51
|
+
- app/models/concerns/discovery_subnet.rb
|
52
|
+
- app/models/discovery_attribute_set.rb
|
66
53
|
- app/views/dashboard/_discovery_widget_host_list.html.erb
|
54
|
+
- app/views/dashboard/_discovery_widget.html.erb
|
55
|
+
- app/views/dashboard/_discovery_widget_host.html.erb
|
56
|
+
- app/views/discovery_rules/new.html.erb
|
57
|
+
- app/views/discovery_rules/edit.html.erb
|
58
|
+
- app/views/discovery_rules/index.html.erb
|
59
|
+
- app/views/discovery_rules/_form.html.erb
|
67
60
|
- app/views/discovered_hosts/_discovered_host.html.erb
|
68
|
-
- app/views/discovered_hosts/_discovered_hosts_list.html.erb
|
69
61
|
- app/views/discovered_hosts/_selected_hosts.html.erb
|
70
|
-
- app/views/discovered_hosts/index.html.erb
|
71
62
|
- app/views/discovered_hosts/multiple_destroy.html.erb
|
72
|
-
- app/views/discovered_hosts/
|
63
|
+
- app/views/discovered_hosts/index.html.erb
|
73
64
|
- app/views/discovered_hosts/select_multiple_organization.html.erb
|
65
|
+
- app/views/discovered_hosts/_discovered_hosts_list.html.erb
|
74
66
|
- app/views/discovered_hosts/show.html.erb
|
75
|
-
- app/views/
|
76
|
-
- app/views/discovery_rules/
|
77
|
-
- app/views/discovery_rules/
|
78
|
-
- app/views/discovery_rules/
|
79
|
-
-
|
67
|
+
- app/views/discovered_hosts/select_multiple_location.html.erb
|
68
|
+
- app/views/api/v2/discovery_rules/index.json.rabl
|
69
|
+
- app/views/api/v2/discovery_rules/base.json.rabl
|
70
|
+
- app/views/api/v2/discovery_rules/main.json.rabl
|
71
|
+
- app/views/api/v2/discovery_rules/show.json.rabl
|
72
|
+
- app/views/api/v2/discovered_hosts/index.json.rabl
|
73
|
+
- app/views/api/v2/discovered_hosts/update.json.rabl
|
74
|
+
- app/views/api/v2/discovered_hosts/auto_provision_all.json.rabl
|
75
|
+
- app/views/api/v2/discovered_hosts/base.json.rabl
|
76
|
+
- app/views/api/v2/discovered_hosts/main.json.rabl
|
77
|
+
- app/views/api/v2/discovered_hosts/auto_provision.json.rabl
|
78
|
+
- app/views/api/v2/discovered_hosts/show.json.rabl
|
79
|
+
- extra/build_iso.sh
|
80
|
+
- extra/wait_for_network.sh
|
81
|
+
- extra/disk_facts.rb
|
82
|
+
- extra/discover_host
|
83
|
+
- extra/foreman_startup.rb
|
84
|
+
- extra/discovery_init.sh.example
|
85
|
+
- extra/ovirt-node-build/build_image.sh
|
86
|
+
- extra/ovirt-node-build/Vagrantfile
|
80
87
|
- config/routes.rb
|
88
|
+
- config/initializers/discovery_setup.rb
|
89
|
+
- db/migrate/20150310153859_remove_discovery_attribute_sets_from_managed_hosts.rb
|
81
90
|
- db/migrate/20141107091416_create_discovery_rules.rb
|
91
|
+
- db/migrate/20150505111345_remove_leftover_tokens.rb
|
82
92
|
- db/migrate/20141107091417_add_discovery_rule_to_host.rb
|
93
|
+
- db/migrate/20150302112545_remove_duplicate_tokens_from_hosts.rb
|
94
|
+
- db/migrate/20150331132115_remove_old_permissions.rb
|
83
95
|
- db/migrate/20141126165451_add_discovery_id_to_subnet.rb
|
84
96
|
- db/migrate/20141223101707_create_discovery_attribute_sets.rb
|
85
97
|
- db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb
|
86
|
-
- db/migrate/
|
98
|
+
- db/migrate/20150512150432_remove_old_discovery_reader_permissions.rb
|
99
|
+
- db/migrate/20150714144500_review_discovery_permissions.rb
|
87
100
|
- db/seeds.d/60_discovery_proxy_feature.rb
|
88
|
-
- extra/build_iso.sh
|
89
|
-
- extra/discover_host
|
90
|
-
- extra/discovery_init.sh.example
|
91
|
-
- extra/disk_facts.rb
|
92
|
-
- extra/foreman_startup.rb
|
93
|
-
- extra/ovirt-node-build/Vagrantfile
|
94
|
-
- extra/ovirt-node-build/build_image.sh
|
95
|
-
- extra/wait_for_network.sh
|
96
101
|
- lib/discovery.rake
|
97
102
|
- lib/foreman_discovery.rb
|
98
|
-
- lib/foreman_discovery/engine.rb
|
99
103
|
- lib/foreman_discovery/proxy_operations.rb
|
100
104
|
- lib/foreman_discovery/version.rb
|
105
|
+
- lib/foreman_discovery/engine.rb
|
106
|
+
- locale/foreman_discovery.pot
|
101
107
|
- locale/Makefile
|
102
|
-
- locale/
|
108
|
+
- locale/ru/foreman_discovery.po
|
109
|
+
- locale/ru/foreman_discovery.pox
|
110
|
+
- locale/ru/LC_MESSAGES/foreman_discovery.mo
|
103
111
|
- locale/de/foreman_discovery.po
|
104
|
-
- locale/
|
112
|
+
- locale/de/foreman_discovery.pox
|
113
|
+
- locale/de/LC_MESSAGES/foreman_discovery.mo
|
114
|
+
- locale/pt_BR/foreman_discovery.po
|
115
|
+
- locale/pt_BR/foreman_discovery.pox
|
116
|
+
- locale/pt_BR/LC_MESSAGES/foreman_discovery.mo
|
105
117
|
- locale/en_GB/foreman_discovery.po
|
106
|
-
- locale/
|
118
|
+
- locale/en_GB/foreman_discovery.pox
|
119
|
+
- locale/en_GB/LC_MESSAGES/foreman_discovery.mo
|
120
|
+
- locale/zh_TW/foreman_discovery.po
|
121
|
+
- locale/zh_TW/foreman_discovery.pox
|
122
|
+
- locale/zh_TW/LC_MESSAGES/foreman_discovery.mo
|
107
123
|
- locale/es/foreman_discovery.po
|
108
|
-
- locale/foreman_discovery.
|
109
|
-
- locale/
|
124
|
+
- locale/es/foreman_discovery.pox
|
125
|
+
- locale/es/LC_MESSAGES/foreman_discovery.mo
|
110
126
|
- locale/fr/foreman_discovery.po
|
111
|
-
- locale/
|
112
|
-
- locale/
|
113
|
-
- locale/it/LC_MESSAGES/foreman_discovery.mo
|
127
|
+
- locale/fr/foreman_discovery.pox
|
128
|
+
- locale/fr/LC_MESSAGES/foreman_discovery.mo
|
114
129
|
- locale/it/foreman_discovery.po
|
115
|
-
- locale/
|
130
|
+
- locale/it/foreman_discovery.pox
|
131
|
+
- locale/it/LC_MESSAGES/foreman_discovery.mo
|
132
|
+
- locale/messages.mo
|
116
133
|
- locale/ja/foreman_discovery.po
|
117
|
-
- locale/
|
134
|
+
- locale/ja/foreman_discovery.pox
|
135
|
+
- locale/ja/LC_MESSAGES/foreman_discovery.mo
|
118
136
|
- locale/ko/foreman_discovery.po
|
119
|
-
- locale/
|
120
|
-
- locale/
|
121
|
-
- locale/ru/LC_MESSAGES/foreman_discovery.mo
|
122
|
-
- locale/ru/foreman_discovery.po
|
123
|
-
- locale/sv_SE/LC_MESSAGES/foreman_discovery.mo
|
124
|
-
- locale/sv_SE/foreman_discovery.po
|
125
|
-
- locale/zanata.xml
|
126
|
-
- locale/zh_CN/LC_MESSAGES/foreman_discovery.mo
|
137
|
+
- locale/ko/foreman_discovery.pox
|
138
|
+
- locale/ko/LC_MESSAGES/foreman_discovery.mo
|
127
139
|
- locale/zh_CN/foreman_discovery.po
|
128
|
-
- locale/
|
129
|
-
- locale/
|
130
|
-
-
|
131
|
-
-
|
140
|
+
- locale/zh_CN/foreman_discovery.pox
|
141
|
+
- locale/zh_CN/LC_MESSAGES/foreman_discovery.mo
|
142
|
+
- locale/zanata.xml
|
143
|
+
- locale/gl/foreman_discovery.po
|
144
|
+
- locale/gl/foreman_discovery.pox
|
145
|
+
- locale/gl/LC_MESSAGES/foreman_discovery.mo
|
146
|
+
- locale/sv_SE/foreman_discovery.po
|
147
|
+
- locale/sv_SE/LC_MESSAGES/foreman_discovery.mo
|
148
|
+
- LICENSE
|
149
|
+
- README.md
|
150
|
+
- test/functional/discovery_rules_controller_test.rb
|
132
151
|
- test/functional/api/v2/discovery_rules_controller_test.rb
|
152
|
+
- test/functional/api/v2/discovered_hosts_controller_test.rb
|
133
153
|
- test/functional/discovered_hosts_controller_test.rb
|
134
|
-
- test/
|
135
|
-
- test/test_helper.rb
|
136
|
-
- test/test_plugin_helper.rb
|
154
|
+
- test/factories/discovery_rule_related.rb
|
137
155
|
- test/unit/discovered_extensions_test.rb
|
138
156
|
- test/unit/discovery_attribute_set_test.rb
|
157
|
+
- test/unit/setting_discovered_test.rb
|
139
158
|
- test/unit/facts.json
|
140
|
-
- test/unit/host_discovered_test.rb
|
141
159
|
- test/unit/puppet_fact_parser_extensions_test.rb
|
142
|
-
- test/unit/
|
160
|
+
- test/unit/discovery_rule_test.rb
|
161
|
+
- test/unit/host_discovered_test.rb
|
162
|
+
- test/test_plugin_helper.rb
|
163
|
+
- test/test_helper.rb
|
143
164
|
homepage: http://github.com/theforeman/foreman_discovery
|
144
165
|
licenses:
|
145
166
|
- GPL-3
|
@@ -150,17 +171,17 @@ require_paths:
|
|
150
171
|
- lib
|
151
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
152
173
|
requirements:
|
153
|
-
- -
|
174
|
+
- - '>='
|
154
175
|
- !ruby/object:Gem::Version
|
155
176
|
version: '0'
|
156
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
178
|
requirements:
|
158
|
-
- -
|
179
|
+
- - '>='
|
159
180
|
- !ruby/object:Gem::Version
|
160
181
|
version: '0'
|
161
182
|
requirements: []
|
162
183
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.0.14
|
164
185
|
signing_key:
|
165
186
|
specification_version: 4
|
166
187
|
summary: MaaS Discovery Plugin for Foreman
|
@@ -175,6 +196,7 @@ test_files:
|
|
175
196
|
- test/unit/setting_discovered_test.rb
|
176
197
|
- test/unit/facts.json
|
177
198
|
- test/unit/puppet_fact_parser_extensions_test.rb
|
199
|
+
- test/unit/discovery_rule_test.rb
|
178
200
|
- test/unit/host_discovered_test.rb
|
179
201
|
- test/test_plugin_helper.rb
|
180
202
|
- test/test_helper.rb
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class ForemanDiscovery::HostConverter
|
2
|
-
|
3
|
-
# must be called from SQL transaction
|
4
|
-
def self.to_managed(original_host, set_managed = true, set_build = true)
|
5
|
-
if ActiveRecord::Base.connection.open_transactions <= 0
|
6
|
-
raise "This method must be executed with explicit transaction"
|
7
|
-
end
|
8
|
-
host = original_host.becomes(::Host::Managed)
|
9
|
-
host.type = 'Host::Managed'
|
10
|
-
# the following flags can be skipped when parameters are set to false
|
11
|
-
if set_managed
|
12
|
-
host.managed = set_managed
|
13
|
-
host.primary_interface.managed = set_managed
|
14
|
-
end
|
15
|
-
host.build = set_build if set_build
|
16
|
-
# this gets rolled back when anything in the transaction fails
|
17
|
-
delete_discovery_attribute_set(host.id)
|
18
|
-
host
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
# discovery_attribute_set should be deleted only after a host has been successfully provisioned
|
24
|
-
# (after discovered host becomes managed host)
|
25
|
-
# after this happens the host is a manged host so non of the callbacks in discovered hosts are relevant anymore
|
26
|
-
# for this reason the orphaned discovery_attribute_set needs to be searched for and deleted
|
27
|
-
def self.delete_discovery_attribute_set(host_id)
|
28
|
-
DiscoveryAttributeSet.destroy_all(:host_id => host_id)
|
29
|
-
end
|
30
|
-
end
|