foreman_salt 13.0.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/foreman_salt/api/v2/salt_variables_controller.rb +75 -0
- data/app/controllers/foreman_salt/concerns/salt_override_value.rb +28 -0
- data/app/controllers/foreman_salt/concerns/salt_variable_parameters.rb +29 -0
- data/app/controllers/foreman_salt/minions_controller.rb +2 -0
- data/app/controllers/foreman_salt/salt_variables_controller.rb +46 -0
- data/app/helpers/foreman_salt/salt_modules_helper.rb +14 -0
- data/app/helpers/foreman_salt/salt_plugin_helper.rb +13 -0
- data/app/models/foreman_salt/concerns/host_managed_extensions.rb +16 -1
- data/app/models/foreman_salt/salt_module.rb +5 -0
- data/app/models/foreman_salt/salt_variable.rb +29 -0
- data/app/services/foreman_salt/report_importer.rb +1 -1
- data/app/views/foreman_salt/api/v2/salt_variables/create.json.rabl +3 -0
- data/app/views/foreman_salt/api/v2/salt_variables/destroy.json.rabl +3 -0
- data/app/views/foreman_salt/api/v2/salt_variables/index.json.rabl +3 -0
- data/app/views/foreman_salt/api/v2/salt_variables/show.json.rabl +21 -0
- data/app/views/foreman_salt/salt_modules/index.html.erb +11 -3
- data/app/views/foreman_salt/salt_variables/_fields.erb +73 -0
- data/app/views/foreman_salt/salt_variables/edit.html.erb +17 -0
- data/app/views/foreman_salt/salt_variables/index.html.erb +46 -0
- data/app/views/foreman_salt/salt_variables/new.html.erb +17 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20190515112233_add_salt_module_id_to_lookup_keys.rb +14 -0
- data/lib/foreman_salt/plugin.rb +44 -16
- data/lib/foreman_salt/version.rb +1 -1
- data/locale/de/foreman_salt.edit.po +68 -41
- data/locale/en/foreman_salt.edit.po +1 -1
- data/test/factories/foreman_salt_factories.rb +6 -0
- data/test/functional/api/v2/salt_states_controller_test.rb +1 -1
- data/test/functional/api/v2/salt_variables_controller_test.rb +35 -0
- data/test/functional/minions_controller_test.rb +65 -5
- data/test/functional/salt_modules_controller_test.rb +22 -0
- data/test/functional/salt_variables_controller_test.rb +33 -0
- data/test/integration/salt_autosign_test.rb +1 -1
- data/test/integration/salt_keys_test.rb +3 -3
- data/test/integration/salt_module_test.rb +1 -1
- data/test/integration/salt_variable_test.rb +24 -0
- data/test/unit/salt_variables_test.rb +32 -0
- metadata +27 -2
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
require 'integration_test_helper'
|
3
|
+
|
4
|
+
module ForemanSalt
|
5
|
+
class SaltVariableTest < IntegrationTestWithJavascript
|
6
|
+
setup do
|
7
|
+
User.current = users :admin
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'index page' do
|
11
|
+
FactoryBot.create_list :salt_variable, 5
|
12
|
+
assert_index_page(salt_variables_path, 'Salt Variable', 'New Salt Variable')
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'create new page' do
|
16
|
+
state = FactoryBot.create :salt_module
|
17
|
+
assert_new_button(salt_variables_path, 'New Salt Variable', new_salt_variable_path)
|
18
|
+
fill_in 'foreman_salt_salt_variable_key', :with => 'mykey'
|
19
|
+
select2(state.name, :from => 'foreman_salt_salt_variable_salt_module_id')
|
20
|
+
assert_submit_button(salt_variables_path)
|
21
|
+
assert page.has_link? 'mykey'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
class SaltVariablesTest < ActiveSupport::TestCase
|
4
|
+
setup do
|
5
|
+
User.current = users :admin
|
6
|
+
@state = FactoryBot.create :salt_module
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'salt variable has a salt module' do
|
10
|
+
salt_variable = ForemanSalt::SaltVariable.new(:key => 'awesome_key', :salt_module_id => @state.id)
|
11
|
+
assert_valid salt_variable
|
12
|
+
assert_equal true, salt_variable.salt?
|
13
|
+
assert_equal @state.id, salt_variable.salt_module.id
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'salt variable is referencing a LookupValue' do
|
17
|
+
salt_variable = ForemanSalt::SaltVariable.new(:key => 'awesome_key', :salt_module_id => @state.id)
|
18
|
+
assert salt_variable.lookup_values.count.zero?
|
19
|
+
LookupValue.create(:value => "[1.2.3.4,2.3.4.5]", :match => "domain = mydomain.net", :lookup_key => salt_variable)
|
20
|
+
assert salt_variable.lookup_values.count == 1
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'should cast default_value to hash' do
|
24
|
+
salt_variable = ForemanSalt::SaltVariable.new(:key => 'awesome_key',
|
25
|
+
:salt_module_id => @state.id,
|
26
|
+
:key_type => 'hash',
|
27
|
+
:default_value => "{\r\n \"bat\": \"man\"\r\n}\r\n",
|
28
|
+
:override => true)
|
29
|
+
salt_variable.save
|
30
|
+
assert salt_variable.default_value.is_a?(Hash)
|
31
|
+
end
|
32
|
+
end
|
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: 13.
|
4
|
+
version: 13.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: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -85,21 +85,26 @@ files:
|
|
85
85
|
- app/controllers/foreman_salt/api/v2/salt_keys_controller.rb
|
86
86
|
- app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
|
87
87
|
- app/controllers/foreman_salt/api/v2/salt_states_controller.rb
|
88
|
+
- app/controllers/foreman_salt/api/v2/salt_variables_controller.rb
|
88
89
|
- app/controllers/foreman_salt/application_controller.rb
|
89
90
|
- app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb
|
90
91
|
- app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb
|
91
92
|
- app/controllers/foreman_salt/concerns/salt_environment_parameters.rb
|
92
93
|
- app/controllers/foreman_salt/concerns/salt_module_parameters.rb
|
94
|
+
- app/controllers/foreman_salt/concerns/salt_override_value.rb
|
95
|
+
- app/controllers/foreman_salt/concerns/salt_variable_parameters.rb
|
93
96
|
- app/controllers/foreman_salt/minions_controller.rb
|
94
97
|
- app/controllers/foreman_salt/salt_autosign_controller.rb
|
95
98
|
- app/controllers/foreman_salt/salt_environments_controller.rb
|
96
99
|
- app/controllers/foreman_salt/salt_keys_controller.rb
|
97
100
|
- app/controllers/foreman_salt/salt_modules_controller.rb
|
101
|
+
- app/controllers/foreman_salt/salt_variables_controller.rb
|
98
102
|
- app/controllers/foreman_salt/state_importer.rb
|
99
103
|
- app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb
|
100
104
|
- app/helpers/concerns/foreman_salt/smart_proxies_helper_extensions.rb
|
101
105
|
- app/helpers/foreman_salt/salt_keys_helper.rb
|
102
106
|
- app/helpers/foreman_salt/salt_modules_helper.rb
|
107
|
+
- app/helpers/foreman_salt/salt_plugin_helper.rb
|
103
108
|
- app/helpers/foreman_salt/salt_reports_helper.rb
|
104
109
|
- app/lib/actions/foreman_salt/report_import.rb
|
105
110
|
- app/lib/proxy_api/salt.rb
|
@@ -112,6 +117,7 @@ files:
|
|
112
117
|
- app/models/foreman_salt/salt_module.rb
|
113
118
|
- app/models/foreman_salt/salt_module_environment.rb
|
114
119
|
- app/models/foreman_salt/salt_provider.rb
|
120
|
+
- app/models/foreman_salt/salt_variable.rb
|
115
121
|
- app/models/setting/salt.rb
|
116
122
|
- app/overrides/salt_environment_host_selector.rb
|
117
123
|
- app/overrides/salt_environment_hostgroup_selector.rb
|
@@ -143,6 +149,10 @@ files:
|
|
143
149
|
- app/views/foreman_salt/api/v2/salt_states/index.json.rabl
|
144
150
|
- app/views/foreman_salt/api/v2/salt_states/main.json.rabl
|
145
151
|
- app/views/foreman_salt/api/v2/salt_states/show.json.rabl
|
152
|
+
- app/views/foreman_salt/api/v2/salt_variables/create.json.rabl
|
153
|
+
- app/views/foreman_salt/api/v2/salt_variables/destroy.json.rabl
|
154
|
+
- app/views/foreman_salt/api/v2/salt_variables/index.json.rabl
|
155
|
+
- app/views/foreman_salt/api/v2/salt_variables/show.json.rabl
|
146
156
|
- app/views/foreman_salt/job_templates/salt_run_command_-_salt_default.erb
|
147
157
|
- app/views/foreman_salt/job_templates/salt_run_function_-_ssh_default.erb
|
148
158
|
- app/views/foreman_salt/job_templates/salt_run_state_highstate_-_salt_default.erb
|
@@ -163,6 +173,10 @@ files:
|
|
163
173
|
- app/views/foreman_salt/salt_modules/import.html.erb
|
164
174
|
- app/views/foreman_salt/salt_modules/index.html.erb
|
165
175
|
- app/views/foreman_salt/salt_modules/new.html.erb
|
176
|
+
- app/views/foreman_salt/salt_variables/_fields.erb
|
177
|
+
- app/views/foreman_salt/salt_variables/edit.html.erb
|
178
|
+
- app/views/foreman_salt/salt_variables/index.html.erb
|
179
|
+
- app/views/foreman_salt/salt_variables/new.html.erb
|
166
180
|
- app/views/hosts/select_multiple_salt_environment.html.erb
|
167
181
|
- app/views/hosts/select_multiple_salt_master.html.erb
|
168
182
|
- config/routes.rb
|
@@ -175,6 +189,7 @@ files:
|
|
175
189
|
- db/migrate/20150509094409_rename_join_tables.rb
|
176
190
|
- db/migrate/20150509101505_add_primary_keys.rb
|
177
191
|
- db/migrate/20161103104146_add_index_to_join_tables.rb
|
192
|
+
- db/migrate/20190515112233_add_salt_module_id_to_lookup_keys.rb
|
178
193
|
- db/seeds.d/75-salt_seeds.rb
|
179
194
|
- db/seeds.d/76-job_templates.rb
|
180
195
|
- lib/foreman_salt.rb
|
@@ -199,13 +214,17 @@ files:
|
|
199
214
|
- test/functional/api/v2/salt_environments_controller_test.rb
|
200
215
|
- test/functional/api/v2/salt_keys_controller_test.rb
|
201
216
|
- test/functional/api/v2/salt_states_controller_test.rb
|
217
|
+
- test/functional/api/v2/salt_variables_controller_test.rb
|
202
218
|
- test/functional/hosts_controller_test.rb
|
203
219
|
- test/functional/minions_controller_test.rb
|
220
|
+
- test/functional/salt_modules_controller_test.rb
|
221
|
+
- test/functional/salt_variables_controller_test.rb
|
204
222
|
- test/integration/hosts_js_test.rb
|
205
223
|
- test/integration/salt_autosign_test.rb
|
206
224
|
- test/integration/salt_environment_test.rb
|
207
225
|
- test/integration/salt_keys_test.rb
|
208
226
|
- test/integration/salt_module_test.rb
|
227
|
+
- test/integration/salt_variable_test.rb
|
209
228
|
- test/test_plugin_helper.rb
|
210
229
|
- test/unit/grains_centos.json
|
211
230
|
- test/unit/grains_importer_test.rb
|
@@ -218,6 +237,7 @@ files:
|
|
218
237
|
- test/unit/salt_fact_parser_test.rb
|
219
238
|
- test/unit/salt_keys_test.rb
|
220
239
|
- test/unit/salt_modules_test.rb
|
240
|
+
- test/unit/salt_variables_test.rb
|
221
241
|
homepage: https://github.com/theforeman/foreman_salt
|
222
242
|
licenses:
|
223
243
|
- GPL-3.0
|
@@ -243,6 +263,7 @@ signing_key:
|
|
243
263
|
specification_version: 4
|
244
264
|
summary: Foreman Plug-in for Salt
|
245
265
|
test_files:
|
266
|
+
- test/integration/salt_variable_test.rb
|
246
267
|
- test/integration/salt_environment_test.rb
|
247
268
|
- test/integration/salt_module_test.rb
|
248
269
|
- test/integration/hosts_js_test.rb
|
@@ -258,12 +279,16 @@ test_files:
|
|
258
279
|
- test/unit/grains_centos.json
|
259
280
|
- test/unit/salt_fact_importer_test.rb
|
260
281
|
- test/unit/report_importer_test.rb
|
282
|
+
- test/unit/salt_variables_test.rb
|
261
283
|
- test/unit/salt_keys_test.rb
|
262
284
|
- test/unit/host_extensions_test.rb
|
263
285
|
- test/test_plugin_helper.rb
|
286
|
+
- test/functional/salt_variables_controller_test.rb
|
264
287
|
- test/functional/minions_controller_test.rb
|
265
288
|
- test/functional/api/v2/salt_autosign_controller_test.rb
|
289
|
+
- test/functional/api/v2/salt_variables_controller_test.rb
|
266
290
|
- test/functional/api/v2/salt_states_controller_test.rb
|
267
291
|
- test/functional/api/v2/salt_environments_controller_test.rb
|
268
292
|
- test/functional/api/v2/salt_keys_controller_test.rb
|
293
|
+
- test/functional/salt_modules_controller_test.rb
|
269
294
|
- test/functional/hosts_controller_test.rb
|