foreman_salt 13.2.2 → 14.1.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 +2 -2
- data/Rakefile +2 -2
- data/app/controllers/foreman_salt/api/v2/jobs_controller.rb +9 -9
- data/app/controllers/foreman_salt/api/v2/salt_autosign_controller.rb +41 -10
- data/app/controllers/foreman_salt/api/v2/salt_environments_controller.rb +6 -6
- data/app/controllers/foreman_salt/api/v2/salt_hostgroups_controller.rb +42 -0
- data/app/controllers/foreman_salt/api/v2/salt_keys_controller.rb +14 -14
- data/app/controllers/foreman_salt/api/v2/salt_minions_controller.rb +8 -8
- data/app/controllers/foreman_salt/api/v2/salt_states_controller.rb +24 -26
- data/app/controllers/foreman_salt/api/v2/salt_variables_controller.rb +22 -21
- data/app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb +3 -3
- data/app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb +4 -4
- data/app/controllers/foreman_salt/concerns/salt_environment_parameters.rb +1 -1
- data/app/controllers/foreman_salt/concerns/salt_hostgroup_parameters.rb +25 -0
- data/app/controllers/foreman_salt/concerns/salt_module_parameters.rb +1 -1
- data/app/controllers/foreman_salt/concerns/salt_override_value.rb +4 -4
- data/app/controllers/foreman_salt/concerns/salt_variable_parameters.rb +5 -5
- data/app/controllers/foreman_salt/minions_controller.rb +9 -9
- data/app/controllers/foreman_salt/salt_autosign_controller.rb +8 -8
- data/app/controllers/foreman_salt/salt_environments_controller.rb +4 -4
- data/app/controllers/foreman_salt/salt_keys_controller.rb +11 -11
- data/app/controllers/foreman_salt/salt_modules_controller.rb +10 -11
- data/app/controllers/foreman_salt/salt_variables_controller.rb +5 -4
- data/app/controllers/foreman_salt/state_importer.rb +12 -13
- data/app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb +16 -10
- data/app/helpers/concerns/foreman_salt/smart_proxies_helper_extensions.rb +2 -2
- data/app/helpers/foreman_salt/salt_keys_helper.rb +2 -1
- data/app/helpers/foreman_salt/salt_modules_helper.rb +11 -11
- data/app/helpers/foreman_salt/salt_reports_helper.rb +0 -1
- data/app/lib/actions/foreman_salt/report_import.rb +2 -2
- data/app/lib/proxy_api/salt.rb +29 -15
- data/app/models/foreman_salt/concerns/host_managed_extensions.rb +83 -33
- data/app/models/foreman_salt/concerns/hostgroup_extensions.rb +14 -11
- data/app/models/foreman_salt/host_salt_module.rb +1 -1
- data/app/models/foreman_salt/salt_environment.rb +8 -8
- data/app/models/foreman_salt/salt_module.rb +15 -13
- data/app/models/foreman_salt/salt_module_environment.rb +1 -1
- data/app/models/foreman_salt/salt_provider.rb +7 -4
- data/app/models/foreman_salt/salt_status.rb +12 -0
- data/app/models/foreman_salt/salt_variable.rb +8 -8
- data/app/models/setting/salt.rb +12 -10
- data/app/overrides/salt_environment_host_selector.rb +4 -4
- data/app/overrides/salt_environment_hostgroup_selector.rb +4 -4
- data/app/overrides/salt_modules_selector.rb +16 -16
- data/app/overrides/salt_proxy_selector.rb +11 -9
- data/app/services/foreman_salt/report_importer.rb +26 -26
- data/app/services/foreman_salt/smart_proxies/salt_keys.rb +47 -45
- data/app/views/foreman_salt/api/v2/salt_autosign/create.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_environments/create.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_environments/show.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_hostgroups/base.json.rabl +7 -0
- data/app/views/foreman_salt/api/v2/salt_hostgroups/show.json.rabl +3 -0
- data/app/views/foreman_salt/api/v2/salt_hostgroups/update.json.rabl +3 -0
- data/app/views/foreman_salt/api/v2/salt_keys/update.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_minions/show.json.rabl +3 -4
- data/app/views/foreman_salt/api/v2/salt_states/create.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_states/show.json.rabl +0 -1
- data/app/views/foreman_salt/api/v2/salt_variables/create.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_variables/destroy.json.rabl +1 -1
- data/app/views/foreman_salt/api/v2/salt_variables/show.json.rabl +8 -8
- data/config/api_routes.rb +31 -0
- data/config/routes.rb +16 -43
- data/db/migrate/20140817210214_create_salt_modules.rb +4 -4
- data/db/migrate/20140829210214_add_salt_modules_to_hostgroups.rb +1 -1
- data/db/migrate/20140920232200_create_salt_environments.rb +3 -3
- data/db/migrate/20150220122707_fix_incorrect_report_metrics.rb +6 -2
- data/db/migrate/20210312150333_add_salt_autosign_to_host.rb +6 -0
- data/db/migrate/20211108211312_add_missing_permissions.rb +9 -0
- data/db/seeds.d/75-salt_seeds.rb +1 -1
- data/db/seeds.d/76-job_templates.rb +3 -3
- data/lib/foreman_salt/engine.rb +24 -18
- data/lib/foreman_salt/extensions.rb +8 -11
- data/lib/foreman_salt/plugin.rb +120 -114
- data/lib/foreman_salt/version.rb +1 -1
- data/lib/foreman_salt.rb +1 -1
- data/lib/tasks/foreman_salt_tasks.rake +3 -5
- data/locale/action_names.rb +4 -4
- data/locale/ca/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ca/foreman_salt.po +541 -0
- data/locale/cs_CZ/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/cs_CZ/foreman_salt.po +541 -0
- data/locale/de/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/de/foreman_salt.po +0 -18
- data/locale/en/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/en/foreman_salt.po +0 -18
- data/locale/en_GB/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/en_GB/foreman_salt.po +541 -0
- data/locale/es/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/es/foreman_salt.po +541 -0
- data/locale/foreman_salt.pot +22 -46
- data/locale/fr/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/fr/foreman_salt.po +541 -0
- data/locale/gl/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/gl/foreman_salt.po +541 -0
- data/locale/it/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/it/foreman_salt.po +541 -0
- data/locale/ja/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ja/foreman_salt.po +541 -0
- data/locale/ko/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ko/foreman_salt.po +541 -0
- data/locale/nl_NL/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/nl_NL/foreman_salt.po +541 -0
- data/locale/pl/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/pl/foreman_salt.po +542 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/pt_BR/foreman_salt.po +541 -0
- data/locale/ru/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/ru/foreman_salt.po +542 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/sv_SE/foreman_salt.po +541 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/zh_CN/foreman_salt.po +541 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_salt.mo +0 -0
- data/locale/zh_TW/foreman_salt.po +541 -0
- data/test/factories/foreman_salt_factories.rb +5 -5
- data/test/functional/api/v2/salt_autosign_controller_test.rb +26 -18
- data/test/functional/api/v2/salt_environments_controller_test.rb +29 -23
- data/test/functional/api/v2/salt_hostgroups_controller_test.rb +76 -0
- data/test/functional/api/v2/salt_keys_controller_test.rb +25 -19
- data/test/functional/api/v2/salt_states_controller_test.rb +72 -66
- data/test/functional/api/v2/salt_variables_controller_test.rb +4 -4
- data/test/functional/hosts_controller_test.rb +26 -26
- data/test/functional/minions_controller_test.rb +22 -22
- data/test/functional/salt_modules_controller_test.rb +3 -3
- data/test/functional/salt_variables_controller_test.rb +5 -5
- data/test/integration/hosts_js_test.rb +11 -11
- data/test/integration/salt_autosign_test.rb +7 -7
- data/test/integration/salt_environment_test.rb +2 -2
- data/test/integration/salt_keys_test.rb +9 -10
- data/test/integration/salt_module_test.rb +9 -9
- data/test/integration/salt_variable_test.rb +2 -2
- data/test/test_plugin_helper.rb +1 -1
- data/test/unit/grains_importer_test.rb +12 -12
- data/test/unit/host_extensions_test.rb +59 -15
- data/test/unit/hostgroup_extensions_test.rb +13 -13
- data/test/unit/report_importer_test.rb +9 -9
- data/test/unit/salt_keys_test.rb +2 -2
- data/test/unit/salt_modules_test.rb +2 -2
- data/test/unit/salt_variables_test.rb +10 -10
- metadata +56 -22
- data/app/models/foreman_salt/fact_name.rb +0 -14
- data/app/services/foreman_salt/fact_importer.rb +0 -15
- data/app/services/foreman_salt/fact_parser.rb +0 -114
- data/test/unit/grains_centos.json +0 -113
- data/test/unit/salt_fact_importer_test.rb +0 -24
- data/test/unit/salt_fact_parser_test.rb +0 -44
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 14.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Benjamin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -25,47 +25,47 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: foreman_remote_execution
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: foreman-tasks
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0.8'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
56
|
+
name: theforeman-rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.0.6
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.0.6
|
69
69
|
description: Foreman Plug-in for Salt
|
70
70
|
email:
|
71
71
|
- stephen@redhat.com
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- app/controllers/foreman_salt/api/v2/jobs_controller.rb
|
83
83
|
- app/controllers/foreman_salt/api/v2/salt_autosign_controller.rb
|
84
84
|
- app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
|
85
|
+
- app/controllers/foreman_salt/api/v2/salt_hostgroups_controller.rb
|
85
86
|
- app/controllers/foreman_salt/api/v2/salt_keys_controller.rb
|
86
87
|
- app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
|
87
88
|
- app/controllers/foreman_salt/api/v2/salt_states_controller.rb
|
@@ -90,6 +91,7 @@ files:
|
|
90
91
|
- app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb
|
91
92
|
- app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb
|
92
93
|
- app/controllers/foreman_salt/concerns/salt_environment_parameters.rb
|
94
|
+
- app/controllers/foreman_salt/concerns/salt_hostgroup_parameters.rb
|
93
95
|
- app/controllers/foreman_salt/concerns/salt_module_parameters.rb
|
94
96
|
- app/controllers/foreman_salt/concerns/salt_override_value.rb
|
95
97
|
- app/controllers/foreman_salt/concerns/salt_variable_parameters.rb
|
@@ -110,21 +112,19 @@ files:
|
|
110
112
|
- app/lib/proxy_api/salt.rb
|
111
113
|
- app/models/foreman_salt/concerns/host_managed_extensions.rb
|
112
114
|
- app/models/foreman_salt/concerns/hostgroup_extensions.rb
|
113
|
-
- app/models/foreman_salt/fact_name.rb
|
114
115
|
- app/models/foreman_salt/host_salt_module.rb
|
115
116
|
- app/models/foreman_salt/hostgroup_salt_module.rb
|
116
117
|
- app/models/foreman_salt/salt_environment.rb
|
117
118
|
- app/models/foreman_salt/salt_module.rb
|
118
119
|
- app/models/foreman_salt/salt_module_environment.rb
|
119
120
|
- app/models/foreman_salt/salt_provider.rb
|
121
|
+
- app/models/foreman_salt/salt_status.rb
|
120
122
|
- app/models/foreman_salt/salt_variable.rb
|
121
123
|
- app/models/setting/salt.rb
|
122
124
|
- app/overrides/salt_environment_host_selector.rb
|
123
125
|
- app/overrides/salt_environment_hostgroup_selector.rb
|
124
126
|
- app/overrides/salt_modules_selector.rb
|
125
127
|
- app/overrides/salt_proxy_selector.rb
|
126
|
-
- app/services/foreman_salt/fact_importer.rb
|
127
|
-
- app/services/foreman_salt/fact_parser.rb
|
128
128
|
- app/services/foreman_salt/report_importer.rb
|
129
129
|
- app/services/foreman_salt/smart_proxies/salt_keys.rb
|
130
130
|
- app/views/foreman_salt/api/v2/salt_autosign/base.json.rabl
|
@@ -136,6 +136,9 @@ files:
|
|
136
136
|
- app/views/foreman_salt/api/v2/salt_environments/index.json.rabl
|
137
137
|
- app/views/foreman_salt/api/v2/salt_environments/main.json.rabl
|
138
138
|
- app/views/foreman_salt/api/v2/salt_environments/show.json.rabl
|
139
|
+
- app/views/foreman_salt/api/v2/salt_hostgroups/base.json.rabl
|
140
|
+
- app/views/foreman_salt/api/v2/salt_hostgroups/show.json.rabl
|
141
|
+
- app/views/foreman_salt/api/v2/salt_hostgroups/update.json.rabl
|
139
142
|
- app/views/foreman_salt/api/v2/salt_keys/base.json.rabl
|
140
143
|
- app/views/foreman_salt/api/v2/salt_keys/index.json.rabl
|
141
144
|
- app/views/foreman_salt/api/v2/salt_keys/main.json.rabl
|
@@ -179,6 +182,7 @@ files:
|
|
179
182
|
- app/views/foreman_salt/salt_variables/new.html.erb
|
180
183
|
- app/views/hosts/select_multiple_salt_environment.html.erb
|
181
184
|
- app/views/hosts/select_multiple_salt_master.html.erb
|
185
|
+
- config/api_routes.rb
|
182
186
|
- config/routes.rb
|
183
187
|
- db/migrate/20140813081913_add_salt_proxy_to_host_and_host_group.rb
|
184
188
|
- db/migrate/20140817210214_create_salt_modules.rb
|
@@ -190,6 +194,8 @@ files:
|
|
190
194
|
- db/migrate/20150509101505_add_primary_keys.rb
|
191
195
|
- db/migrate/20161103104146_add_index_to_join_tables.rb
|
192
196
|
- db/migrate/20190515112233_add_salt_module_id_to_lookup_keys.rb
|
197
|
+
- db/migrate/20210312150333_add_salt_autosign_to_host.rb
|
198
|
+
- db/migrate/20211108211312_add_missing_permissions.rb
|
193
199
|
- db/seeds.d/75-salt_seeds.rb
|
194
200
|
- db/seeds.d/76-job_templates.rb
|
195
201
|
- lib/foreman_salt.rb
|
@@ -200,6 +206,10 @@ files:
|
|
200
206
|
- lib/tasks/foreman_salt_tasks.rake
|
201
207
|
- locale/Makefile
|
202
208
|
- locale/action_names.rb
|
209
|
+
- locale/ca/LC_MESSAGES/foreman_salt.mo
|
210
|
+
- locale/ca/foreman_salt.po
|
211
|
+
- locale/cs_CZ/LC_MESSAGES/foreman_salt.mo
|
212
|
+
- locale/cs_CZ/foreman_salt.po
|
203
213
|
- locale/de/LC_MESSAGES/foreman_salt.mo
|
204
214
|
- locale/de/foreman_salt.edit.po
|
205
215
|
- locale/de/foreman_salt.po
|
@@ -208,10 +218,39 @@ files:
|
|
208
218
|
- locale/en/foreman_salt.edit.po
|
209
219
|
- locale/en/foreman_salt.po
|
210
220
|
- locale/en/foreman_salt.po.time_stamp
|
221
|
+
- locale/en_GB/LC_MESSAGES/foreman_salt.mo
|
222
|
+
- locale/en_GB/foreman_salt.po
|
223
|
+
- locale/es/LC_MESSAGES/foreman_salt.mo
|
224
|
+
- locale/es/foreman_salt.po
|
211
225
|
- locale/foreman_salt.pot
|
226
|
+
- locale/fr/LC_MESSAGES/foreman_salt.mo
|
227
|
+
- locale/fr/foreman_salt.po
|
228
|
+
- locale/gl/LC_MESSAGES/foreman_salt.mo
|
229
|
+
- locale/gl/foreman_salt.po
|
230
|
+
- locale/it/LC_MESSAGES/foreman_salt.mo
|
231
|
+
- locale/it/foreman_salt.po
|
232
|
+
- locale/ja/LC_MESSAGES/foreman_salt.mo
|
233
|
+
- locale/ja/foreman_salt.po
|
234
|
+
- locale/ko/LC_MESSAGES/foreman_salt.mo
|
235
|
+
- locale/ko/foreman_salt.po
|
236
|
+
- locale/nl_NL/LC_MESSAGES/foreman_salt.mo
|
237
|
+
- locale/nl_NL/foreman_salt.po
|
238
|
+
- locale/pl/LC_MESSAGES/foreman_salt.mo
|
239
|
+
- locale/pl/foreman_salt.po
|
240
|
+
- locale/pt_BR/LC_MESSAGES/foreman_salt.mo
|
241
|
+
- locale/pt_BR/foreman_salt.po
|
242
|
+
- locale/ru/LC_MESSAGES/foreman_salt.mo
|
243
|
+
- locale/ru/foreman_salt.po
|
244
|
+
- locale/sv_SE/LC_MESSAGES/foreman_salt.mo
|
245
|
+
- locale/sv_SE/foreman_salt.po
|
246
|
+
- locale/zh_CN/LC_MESSAGES/foreman_salt.mo
|
247
|
+
- locale/zh_CN/foreman_salt.po
|
248
|
+
- locale/zh_TW/LC_MESSAGES/foreman_salt.mo
|
249
|
+
- locale/zh_TW/foreman_salt.po
|
212
250
|
- test/factories/foreman_salt_factories.rb
|
213
251
|
- test/functional/api/v2/salt_autosign_controller_test.rb
|
214
252
|
- test/functional/api/v2/salt_environments_controller_test.rb
|
253
|
+
- test/functional/api/v2/salt_hostgroups_controller_test.rb
|
215
254
|
- test/functional/api/v2/salt_keys_controller_test.rb
|
216
255
|
- test/functional/api/v2/salt_states_controller_test.rb
|
217
256
|
- test/functional/api/v2/salt_variables_controller_test.rb
|
@@ -226,15 +265,12 @@ files:
|
|
226
265
|
- test/integration/salt_module_test.rb
|
227
266
|
- test/integration/salt_variable_test.rb
|
228
267
|
- test/test_plugin_helper.rb
|
229
|
-
- test/unit/grains_centos.json
|
230
268
|
- test/unit/grains_importer_test.rb
|
231
269
|
- test/unit/highstate.json
|
232
270
|
- test/unit/highstate_pchanges.json
|
233
271
|
- test/unit/host_extensions_test.rb
|
234
272
|
- test/unit/hostgroup_extensions_test.rb
|
235
273
|
- test/unit/report_importer_test.rb
|
236
|
-
- test/unit/salt_fact_importer_test.rb
|
237
|
-
- test/unit/salt_fact_parser_test.rb
|
238
274
|
- test/unit/salt_keys_test.rb
|
239
275
|
- test/unit/salt_modules_test.rb
|
240
276
|
- test/unit/salt_variables_test.rb
|
@@ -274,10 +310,7 @@ test_files:
|
|
274
310
|
- test/unit/highstate_pchanges.json
|
275
311
|
- test/unit/hostgroup_extensions_test.rb
|
276
312
|
- test/unit/highstate.json
|
277
|
-
- test/unit/salt_fact_parser_test.rb
|
278
313
|
- test/unit/salt_modules_test.rb
|
279
|
-
- test/unit/grains_centos.json
|
280
|
-
- test/unit/salt_fact_importer_test.rb
|
281
314
|
- test/unit/report_importer_test.rb
|
282
315
|
- test/unit/salt_variables_test.rb
|
283
316
|
- test/unit/salt_keys_test.rb
|
@@ -289,6 +322,7 @@ test_files:
|
|
289
322
|
- test/functional/api/v2/salt_variables_controller_test.rb
|
290
323
|
- test/functional/api/v2/salt_states_controller_test.rb
|
291
324
|
- test/functional/api/v2/salt_environments_controller_test.rb
|
325
|
+
- test/functional/api/v2/salt_hostgroups_controller_test.rb
|
292
326
|
- test/functional/api/v2/salt_keys_controller_test.rb
|
293
327
|
- test/functional/salt_modules_controller_test.rb
|
294
328
|
- test/functional/hosts_controller_test.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module ForemanSalt
|
2
|
-
# Define the class that fact names that come from Salt should have
|
3
|
-
# It allows us to filter facts by origin, and also to display the origin
|
4
|
-
# in the fact values table (/fact_values)
|
5
|
-
class FactName < ::FactName
|
6
|
-
def origin
|
7
|
-
'Salt'
|
8
|
-
end
|
9
|
-
|
10
|
-
def icon_path
|
11
|
-
'foreman_salt/Salt'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
module ForemanSalt
|
2
|
-
class FactParser < ::FactParser
|
3
|
-
attr_reader :facts
|
4
|
-
|
5
|
-
def operatingsystem
|
6
|
-
os = Operatingsystem.where(os_hash).first_or_initialize
|
7
|
-
if os.new_record?
|
8
|
-
os.deduce_family
|
9
|
-
os.release_name = facts[:lsb_distrib_codename]
|
10
|
-
os.save
|
11
|
-
end
|
12
|
-
os if os.persisted?
|
13
|
-
end
|
14
|
-
|
15
|
-
def architecture
|
16
|
-
name = facts[:osarch]
|
17
|
-
name = 'x86_64' if name == 'amd64'
|
18
|
-
Architecture.where(:name => name).first_or_create unless name.blank?
|
19
|
-
end
|
20
|
-
|
21
|
-
def environment
|
22
|
-
# Don't touch the Puppet environment field
|
23
|
-
end
|
24
|
-
|
25
|
-
def model
|
26
|
-
name = facts[:productname]
|
27
|
-
Model.where(:name => name.strip).first_or_create unless name.blank?
|
28
|
-
end
|
29
|
-
|
30
|
-
def domain
|
31
|
-
name = facts[:domain]
|
32
|
-
Domain.where(:name => name).first_or_create unless name.blank?
|
33
|
-
end
|
34
|
-
|
35
|
-
def ip
|
36
|
-
ip = facts.find { |fact, value| fact =~ /^fqdn_ip4/ && value && value != '127.0.0.1' }
|
37
|
-
ip[1] if ip
|
38
|
-
end
|
39
|
-
|
40
|
-
def primary_interface
|
41
|
-
interface = interfaces.find { |_, value| value[:ipaddress] == ip }
|
42
|
-
interface[0] if interface
|
43
|
-
end
|
44
|
-
|
45
|
-
def mac
|
46
|
-
interface = interfaces.find { |_, value| value[:ipaddress] == ip }
|
47
|
-
interface[1][:macaddress] if interface
|
48
|
-
end
|
49
|
-
|
50
|
-
def ipmi_interface
|
51
|
-
nil
|
52
|
-
end
|
53
|
-
|
54
|
-
def interfaces
|
55
|
-
interfaces = {}
|
56
|
-
|
57
|
-
facts.each do |fact, value|
|
58
|
-
next unless value && fact.to_s =~ /^ip_interfaces/
|
59
|
-
|
60
|
-
(_, interface_name) = fact.split(FactName::SEPARATOR)
|
61
|
-
|
62
|
-
next if (IPAddr.new('fe80::/10').include?(value) rescue false)
|
63
|
-
|
64
|
-
if !interface_name.blank? && interface_name != 'lo'
|
65
|
-
interface = interfaces.fetch(interface_name, {})
|
66
|
-
interface[:macaddress] = macs[interface_name]
|
67
|
-
if Net::Validations.validate_ip6(value)
|
68
|
-
interface[:ipaddress6] = value unless interface.include?(:ipaddress6)
|
69
|
-
else
|
70
|
-
interface[:ipaddress] = value unless interface.include?(:ipaddress)
|
71
|
-
end
|
72
|
-
interfaces[interface_name] = interface
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
interfaces.each do |name, interface|
|
77
|
-
set_additional_attributes(interface, name)
|
78
|
-
end
|
79
|
-
|
80
|
-
interfaces
|
81
|
-
end
|
82
|
-
|
83
|
-
def support_interfaces_parsing?
|
84
|
-
true
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def os_hash
|
90
|
-
name = facts[:os]
|
91
|
-
(_, major, minor, sub) = /(\d+)\.?(\d+)?\.?(\d+)?/.match(facts[:osrelease]).to_a
|
92
|
-
if name == 'CentOS'
|
93
|
-
if sub
|
94
|
-
minor += '.' + sub
|
95
|
-
end
|
96
|
-
end
|
97
|
-
{ :name => name, :major => major, :minor => minor }
|
98
|
-
end
|
99
|
-
|
100
|
-
def macs
|
101
|
-
unless @macs
|
102
|
-
@macs = {}
|
103
|
-
facts.each do |fact, value|
|
104
|
-
next unless value && fact.to_s =~ /^hwaddr_interfaces/
|
105
|
-
|
106
|
-
data = fact.split(FactName::SEPARATOR)
|
107
|
-
interface = data[1]
|
108
|
-
macs[interface] = value
|
109
|
-
end
|
110
|
-
end
|
111
|
-
@macs
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"facts": {
|
3
|
-
"kernelrelease": "2.6.32-431.23.3.el6.x86_64",
|
4
|
-
"ipv6::0": "::1",
|
5
|
-
"ipv6::1": "fe80::5054:ff:fe35:302a",
|
6
|
-
"saltversioninfo": [
|
7
|
-
2014,
|
8
|
-
1,
|
9
|
-
7
|
10
|
-
],
|
11
|
-
"operatingsystem": "CentOS",
|
12
|
-
"lsb_distrib_id": "CentOS",
|
13
|
-
"pythonversion::2": 6,
|
14
|
-
"pythonversion::3": "final",
|
15
|
-
"pythonversion::0": 2,
|
16
|
-
"pythonversion::1": 6,
|
17
|
-
"cpu_model": "QEMU Virtual CPU version (cpu64-rhel6)",
|
18
|
-
"pythonversion::4": 0,
|
19
|
-
"oscodename": "Final",
|
20
|
-
"num_gpus": 1,
|
21
|
-
"productname": "KVM",
|
22
|
-
"osarch": "x86_64",
|
23
|
-
"biosversion": "0.5.1",
|
24
|
-
"kernel": "Linux",
|
25
|
-
"domain": "example.com",
|
26
|
-
"pythonpath::4": "/usr/lib64/python2.6/lib-tk",
|
27
|
-
"pythonpath::5": "/usr/lib64/python2.6/lib-old",
|
28
|
-
"pythonpath::6": "/usr/lib64/python2.6/lib-dynload",
|
29
|
-
"pythonpath::7": "/usr/lib64/python2.6/site-packages",
|
30
|
-
"pythonpath::0": "/usr/bin",
|
31
|
-
"mem_total": 742,
|
32
|
-
"pythonpath::2": "/usr/lib64/python2.6",
|
33
|
-
"pythonpath::3": "/usr/lib64/python2.6/plat-linux2",
|
34
|
-
"pythonpath::8": "/usr/lib/python2.6/site-packages",
|
35
|
-
"cpu_flags::25": "pni",
|
36
|
-
"cpu_flags::24": "unfair_spinlock",
|
37
|
-
"cpu_flags::27": "hypervisor",
|
38
|
-
"cpu_flags::26": "cx16",
|
39
|
-
"cpu_flags::21": "nx",
|
40
|
-
"cpu_flags::20": "syscall",
|
41
|
-
"cpu_flags::23": "up",
|
42
|
-
"cpu_flags::22": "lm",
|
43
|
-
"cpu_flags::28": "lahf_lm",
|
44
|
-
"defaultlanguage": "en_US",
|
45
|
-
"osfullname": "CentOS",
|
46
|
-
"localhost": "saltclient01.example.com",
|
47
|
-
"lsb_distrib_release": "6.5",
|
48
|
-
"saltpath": "/usr/lib/python2.6/site-packages/salt",
|
49
|
-
"biosreleasedate": "01/01/2007",
|
50
|
-
"host": "saltclient01",
|
51
|
-
"defaultencoding": "UTF8",
|
52
|
-
"path": "/sbin:/usr/sbin:/bin:/usr/bin",
|
53
|
-
"ip_interfaces::eth0::0": "10.7.13.141",
|
54
|
-
"ip_interfaces::eth0::1": "10.7.23.141",
|
55
|
-
"manufacturer": "Red Hat",
|
56
|
-
"fqdn": "saltclient01.example.com",
|
57
|
-
"os": "CentOS",
|
58
|
-
"osfinger": "CentOS-6",
|
59
|
-
"ps": "ps -efH",
|
60
|
-
"server_id": 654860635,
|
61
|
-
"zmqversion": "3.2.4",
|
62
|
-
"osmajorrelease::1": "5",
|
63
|
-
"osmajorrelease::0": "6",
|
64
|
-
"ip_interfaces::lo::0": "127.0.0.1",
|
65
|
-
"master": "saltstack.example.com",
|
66
|
-
"shell": "/bin/sh",
|
67
|
-
"saltversion": "2014.1.7",
|
68
|
-
"hwaddr_interfaces::lo": "00:00:00:00:00:00",
|
69
|
-
"_timestamp": "2014-08-28 10:02:16 ",
|
70
|
-
"cpu_flags::18": "sse",
|
71
|
-
"cpu_flags::19": "sse2",
|
72
|
-
"cpu_flags::14": "pse36",
|
73
|
-
"cpu_flags::15": "clflush",
|
74
|
-
"cpu_flags::16": "mmx",
|
75
|
-
"cpu_flags::17": "fxsr",
|
76
|
-
"cpu_flags::10": "mtrr",
|
77
|
-
"cpu_flags::11": "pge",
|
78
|
-
"cpu_flags::12": "mca",
|
79
|
-
"cpu_flags::13": "cmov",
|
80
|
-
"cpuarch": "x86_64",
|
81
|
-
"pythonpath::1": "/usr/lib64/python26.zip",
|
82
|
-
"cpu_flags::6": "mce",
|
83
|
-
"cpu_flags::7": "cx8",
|
84
|
-
"cpu_flags::4": "msr",
|
85
|
-
"cpu_flags::5": "pae",
|
86
|
-
"cpu_flags::2": "pse",
|
87
|
-
"cpu_flags::3": "tsc",
|
88
|
-
"cpu_flags::0": "fpu",
|
89
|
-
"cpu_flags::1": "de",
|
90
|
-
"serialnumber": "Not Specified",
|
91
|
-
"hwaddr_interfaces::eth0": "52:54:00:35:30:2a",
|
92
|
-
"cpu_flags::8": "apic",
|
93
|
-
"cpu_flags::9": "sep",
|
94
|
-
"gpus::0::model": "GD 5446",
|
95
|
-
"id": "saltclient01.example.com",
|
96
|
-
"osrelease": "6.5",
|
97
|
-
"num_cpus": 1,
|
98
|
-
"virtual": "kvm",
|
99
|
-
"ipv4::0": "10.7.23.141",
|
100
|
-
"ipv4::1": "10.7.13.141",
|
101
|
-
"ipv4::2": "127.0.0.1",
|
102
|
-
"_type": "foreman_salt",
|
103
|
-
"nodename": "saltclient01.example.com",
|
104
|
-
"os_family": "RedHat",
|
105
|
-
"operatingsystemrelease": "6.5",
|
106
|
-
"gpus::0::vendor": "unknown",
|
107
|
-
"lsb_distrib_codename": "Final",
|
108
|
-
"fqdn_ip4::0": "10.7.13.141",
|
109
|
-
"ip_interfaces::eth1::0": "1.2.3.4",
|
110
|
-
"hwaddr_interfaces::eth1": "DE:AD:BE:EF:07:13"
|
111
|
-
},
|
112
|
-
"name": "saltclient01.example.com"
|
113
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'test_plugin_helper'
|
2
|
-
|
3
|
-
module ForemanSalt
|
4
|
-
class SaltFactImpoterTest < ActiveSupport::TestCase
|
5
|
-
def setup
|
6
|
-
@host = FactoryBot.build(:host)
|
7
|
-
end
|
8
|
-
|
9
|
-
test 'should have fact set' do
|
10
|
-
importer = FactImporter.new(@host, 'a' => 'b')
|
11
|
-
assert_equal({ 'a' => 'b' }, importer.send(:facts))
|
12
|
-
end
|
13
|
-
|
14
|
-
test 'should have Salt as origin' do
|
15
|
-
importer = FactImporter.new(@host, 'a' => 'b')
|
16
|
-
importer.stubs(:ensure_no_active_transaction).returns(true)
|
17
|
-
importer.import!
|
18
|
-
imported_fact = FactName.find_by_name('a')
|
19
|
-
assert_equal 'a', imported_fact.name
|
20
|
-
assert_equal 'Salt', imported_fact.origin
|
21
|
-
assert_equal 'foreman_salt/Salt', imported_fact.icon_path
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'test_plugin_helper'
|
2
|
-
|
3
|
-
module ForemanSalt
|
4
|
-
class SaltFactsParserTest < ActiveSupport::TestCase
|
5
|
-
def setup
|
6
|
-
grains = JSON.parse(File.read(File.join(Engine.root, 'test', 'unit', 'grains_centos.json')))
|
7
|
-
@facts_parser = FactParser.new grains["facts"]
|
8
|
-
User.current = users :admin
|
9
|
-
end
|
10
|
-
|
11
|
-
test "should return list of interfaces" do
|
12
|
-
assert @facts_parser.interfaces.present?
|
13
|
-
assert_not_nil @facts_parser.suggested_primary_interface(FactoryBot.build(:host))
|
14
|
-
assert @facts_parser.interfaces.key?(@facts_parser.suggested_primary_interface(FactoryBot.build(:host)).first)
|
15
|
-
end
|
16
|
-
|
17
|
-
test "should set operatingsystem correctly" do
|
18
|
-
os = @facts_parser.operatingsystem
|
19
|
-
assert os.present?
|
20
|
-
assert_equal 'CentOS', os.name
|
21
|
-
assert_equal '6', os.major
|
22
|
-
assert_equal '5', os.minor
|
23
|
-
assert_equal 'CentOS 6.5', os.title
|
24
|
-
end
|
25
|
-
|
26
|
-
test "should set domain correctly" do
|
27
|
-
domain = @facts_parser.domain
|
28
|
-
assert domain.present?
|
29
|
-
assert_equal 'example.com', domain.name
|
30
|
-
end
|
31
|
-
|
32
|
-
test "should set ip correctly" do
|
33
|
-
assert_equal '10.7.13.141', @facts_parser.ip
|
34
|
-
end
|
35
|
-
|
36
|
-
test "should set primary_interface correctly" do
|
37
|
-
assert_equal 'eth0', @facts_parser.primary_interface
|
38
|
-
end
|
39
|
-
|
40
|
-
test "should set mac correctly" do
|
41
|
-
assert_equal '52:54:00:35:30:2a', @facts_parser.mac
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|