foreman_puppet 1.0.5 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/foreman_puppet/extensions/api_hostgroups_controller.rb +14 -16
- data/app/controllers/concerns/foreman_puppet/{api/import_puppetclasses_common_controller.rb → extensions/api_smart_proxies_controller.rb} +9 -3
- data/app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb +23 -1
- data/app/controllers/concerns/foreman_puppet/extensions/api_v2_hosts_controller.rb +15 -17
- data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +0 -1
- data/app/controllers/concerns/foreman_puppet/extensions/parameters_hostgroup.rb +2 -8
- data/app/controllers/foreman_puppet/api/v2/environments_controller.rb +0 -1
- data/app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb +1 -1
- data/app/controllers/foreman_puppet/puppetclasses_controller.rb +1 -1
- data/app/helpers/foreman_puppet/environments_helper.rb +1 -1
- data/app/helpers/foreman_puppet/hosts_and_hostgroups_helper.rb +0 -5
- data/app/helpers/foreman_puppet/hosts_helper.rb +6 -10
- data/app/helpers/foreman_puppet/puppetclass_lookup_keys_helper.rb +1 -1
- data/app/models/concerns/foreman_puppet/extensions/host.rb +2 -16
- data/app/models/concerns/foreman_puppet/extensions/hostgroup.rb +2 -7
- data/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb +7 -12
- data/app/models/concerns/foreman_puppet/extensions/template_combination.rb +5 -10
- data/app/services/foreman_puppet/puppet_class_importer.rb +0 -6
- data/app/views/foreman_puppet/api/v2/host_puppet_facets/host_list.json.rabl +3 -0
- data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/base.json.rabl +2 -0
- data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_list.json.rabl +3 -0
- data/app/views/foreman_puppet/config_groups/index.html.erb +1 -1
- data/config/api_routes.rb +1 -9
- data/config/initializers/api_reroute.rb +73 -5
- data/db/migrate/20101121140000_add_environment_to_template_combinations.foreman_puppet.rb +1 -1
- data/db/migrate/20200803113803_migrate_environment_to_puppet_facet.foreman_puppet.rb +2 -0
- data/db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb +0 -8
- data/db/migrate/20210924103241_remove_katello_id_from_environments.foreman_puppet.rb +5 -0
- data/db/migrate/20211111125003_drop_puppetclasses_direct_references.foreman_puppet.rb +11 -0
- data/db/migrate/20220201205305_migrate_host_class_permission.foreman_puppet.rb +9 -0
- data/db/migrate/20220208135305_migrate_environment_ignore_type.foreman_puppet.rb +15 -0
- data/db/migrate_foreman/{20090722141107_create_environments.rb → 20090722141107_create_environments.foreman_puppet.rb} +3 -3
- data/db/migrate_foreman/20090802062223_create_puppetclasses.foreman_puppet.rb +29 -0
- data/db/migrate_foreman/20090905150132_create_hostgroups_puppetclasses.foreman_puppet.rb +14 -0
- data/db/migrate_foreman/20110412103238_remove_unused_fields_from_puppet_classes.foreman_puppet.rb +9 -0
- data/db/migrate_foreman/20110712070522_create_host_class.foreman_puppet.rb +11 -0
- data/db/migrate_foreman/20120824142048_add_some_indexes.foreman_puppet.rb +21 -0
- data/db/migrate_foreman/{20120905095532_create_environment_classes.rb → 20120905095532_create_environment_classes.foreman_puppet.rb} +2 -2
- data/db/migrate_foreman/20121018152459_create_hostgroup_classes.foreman_puppet.rb +11 -0
- data/db/migrate_foreman/{20140407161817_create_config_groups.rb → 20140407161817_create_config_groups.foreman_puppet.rb} +0 -0
- data/db/migrate_foreman/{20140407162007_create_config_group_classes.rb → 20140407162007_create_config_group_classes.foreman_puppet.rb} +0 -0
- data/db/migrate_foreman/{20140407162059_create_host_config_groups.rb → 20140407162059_create_host_config_groups.foreman_puppet.rb} +0 -0
- data/db/migrate_foreman/{20161205142618_delete_orphaned_smart_class_parameters.rb → 20161205142618_delete_orphaned_smart_class_parameters.foreman_puppet.rb} +1 -1
- data/db/migrate_foreman/{20170109115157_fix_lookup_key_auditable_type.rb → 20170109115157_fix_lookup_key_auditable_type.foreman_puppet.rb} +0 -0
- data/db/migrate_foreman/20180816134832_cast_lookup_key_values.foreman_puppet.rb +5 -0
- data/db/migrate_foreman/20180831115634_add_uniqueness_to_puppetclass_name.foreman_puppet.rb +24 -0
- data/db/migrate_foreman/{20181023112532_add_environment_puppetclass_id.rb → 20181023112532_add_environment_puppetclass_id.foreman_puppet.rb} +1 -1
- data/db/migrate_foreman/{20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.rb → 20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.foreman_puppet.rb} +0 -0
- data/lib/foreman_puppet/engine.rb +4 -36
- data/lib/foreman_puppet/register.rb +51 -46
- data/lib/foreman_puppet/version.rb +1 -1
- data/lib/foreman_puppet.rb +1 -6
- data/locale/ca/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/ca/foreman_puppet.po +760 -0
- data/locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/cs_CZ/foreman_puppet.po +823 -0
- data/locale/de/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/de/foreman_puppet.po +844 -0
- data/locale/en/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/en/foreman_puppet.po +119 -8
- data/locale/en_GB/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/en_GB/foreman_puppet.po +820 -0
- data/locale/es/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/es/foreman_puppet.po +827 -0
- data/locale/foreman_puppet.pot +376 -205
- data/locale/fr/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/fr/foreman_puppet.po +835 -0
- data/locale/gemspec.rb +1 -1
- data/locale/gl/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/gl/foreman_puppet.po +818 -0
- data/locale/it/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/it/foreman_puppet.po +822 -0
- data/locale/ja/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/ja/foreman_puppet.po +830 -0
- data/locale/ko/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/ko/foreman_puppet.po +819 -0
- data/locale/nl_NL/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/nl_NL/foreman_puppet.po +823 -0
- data/locale/pl/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/pl/foreman_puppet.po +822 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/pt_BR/foreman_puppet.po +826 -0
- data/locale/ru/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/ru/foreman_puppet.po +827 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/sv_SE/foreman_puppet.po +822 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/zh_CN/foreman_puppet.po +831 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/zh_TW/foreman_puppet.po +821 -0
- data/package.json +8 -11
- data/test/controllers/foreman_puppet/api/v2/environments_controller_test.rb +0 -231
- data/test/controllers/foreman_puppet/api/v2/smart_proxies_controller_test.rb +255 -0
- data/test/controllers/foreman_puppet/environments_controller_test.rb +2 -2
- data/test/controllers/foreman_puppet/hosts_controller_test.rb +0 -1
- data/test/factories/foreman_puppet_factories.rb +0 -2
- data/test/helpers/foreman_puppet/puppetclass_lookup_keys_helper_test.rb +34 -0
- data/test/integration/foreman_puppet/dashboard_js_test.rb +31 -0
- data/test/integration/foreman_puppet/host_js_test.rb +0 -1
- data/test/integration/foreman_puppet/puppetclass_js_test.rb +1 -1
- data/test/models/foreman_puppet/host_test.rb +26 -0
- data/test/models/foreman_puppet/user_test.rb +1 -5
- data/test/unit/foreman_puppet/puppet_class_importer_test.rb +1 -1
- metadata +69 -16
- data/db/migrate_foreman/20180816134832_cast_lookup_key_values.rb +0 -35
@@ -150,6 +150,32 @@ module ForemanPuppet
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
+
describe '#available_template_kinds' do
|
154
|
+
let(:template_kinds) { [stub(name: 'iPXE'), stub(name: 'finish')] }
|
155
|
+
|
156
|
+
test 'calls find_template with Puppet environment' do
|
157
|
+
host = FactoryBot.create(:host, :with_hostgroup, :with_puppet_enc)
|
158
|
+
host.expects(:template_kinds).returns(template_kinds)
|
159
|
+
template_kinds.each do |kind|
|
160
|
+
::ProvisioningTemplate.expects(:find_template)
|
161
|
+
.with(kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: host.puppet.environment.id)
|
162
|
+
.returns(stub(name: "default #{kind.name}"))
|
163
|
+
end
|
164
|
+
assert_equal template_kinds.map { |k| "default #{k.name}" }, host.available_template_kinds.map(&:name)
|
165
|
+
end
|
166
|
+
|
167
|
+
test 'calls find_template without Puppet environment' do
|
168
|
+
host = FactoryBot.create(:host, :with_hostgroup)
|
169
|
+
host.expects(:template_kinds).returns(template_kinds)
|
170
|
+
template_kinds.each do |kind|
|
171
|
+
::ProvisioningTemplate.expects(:find_template)
|
172
|
+
.with(kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: nil)
|
173
|
+
.returns(stub(name: "default #{kind.name}"))
|
174
|
+
end
|
175
|
+
assert_equal template_kinds.map { |k| "default #{k.name}" }, host.available_template_kinds.map(&:name)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
153
179
|
test 'should import from external nodes output' do
|
154
180
|
# create a dummy node
|
155
181
|
Parameter.destroy_all
|
@@ -5,11 +5,7 @@ module ForemanPuppet
|
|
5
5
|
describe '#visible_environments' do
|
6
6
|
let(:environment) { FactoryBot.create(:environment) }
|
7
7
|
let(:untaxed_env) { FactoryBot.create(:environment, organizations: [], locations: []) }
|
8
|
-
let(:env_names)
|
9
|
-
env_names = [environment.name, untaxed_env.name]
|
10
|
-
env_names += %w[production global_puppetmaster testing] unless ForemanPuppet.extracted_from_core?
|
11
|
-
env_names
|
12
|
-
end
|
8
|
+
let(:env_names) { [environment.name, untaxed_env.name] }
|
13
9
|
|
14
10
|
setup do
|
15
11
|
environment
|
@@ -3,7 +3,7 @@ require 'test_puppet_helper'
|
|
3
3
|
module ForemanPuppet
|
4
4
|
class PuppetClassImporterTest < ActiveSupport::TestCase
|
5
5
|
def setup
|
6
|
-
FactoryBot.create(:environment, name: 'production')
|
6
|
+
FactoryBot.create(:environment, name: 'production')
|
7
7
|
ProxyAPI::Puppet.any_instance.stubs(:environments).returns(%w[foreman-testing foreman-testing-1])
|
8
8
|
ProxyAPI::Puppet.any_instance.stubs(:classes).returns(mocked_classes)
|
9
9
|
User.current = users(:admin)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
@@ -9,9 +9,9 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: Allow assigning Puppet
|
14
|
+
description: Allow assigning Puppet environments and classes to the Foreman Hosts.
|
15
15
|
email:
|
16
16
|
- foreman-dev@googlegroups.com
|
17
17
|
executables: []
|
@@ -22,10 +22,10 @@ files:
|
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
24
|
- app/assets/stylesheets/foreman_puppet.scss
|
25
|
-
- app/controllers/concerns/foreman_puppet/api/import_puppetclasses_common_controller.rb
|
26
25
|
- app/controllers/concerns/foreman_puppet/environments_import.rb
|
27
26
|
- app/controllers/concerns/foreman_puppet/extensions/api_base_controller.rb
|
28
27
|
- app/controllers/concerns/foreman_puppet/extensions/api_hostgroups_controller.rb
|
28
|
+
- app/controllers/concerns/foreman_puppet/extensions/api_smart_proxies_controller.rb
|
29
29
|
- app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb
|
30
30
|
- app/controllers/concerns/foreman_puppet/extensions/api_v2_hosts_controller.rb
|
31
31
|
- app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb
|
@@ -113,9 +113,11 @@ files:
|
|
113
113
|
- app/views/foreman_puppet/api/v2/environments/show.json.rabl
|
114
114
|
- app/views/foreman_puppet/api/v2/environments/update.json.rabl
|
115
115
|
- app/views/foreman_puppet/api/v2/host_puppet_facets/base.json.rabl
|
116
|
+
- app/views/foreman_puppet/api/v2/host_puppet_facets/host_list.json.rabl
|
116
117
|
- app/views/foreman_puppet/api/v2/host_puppet_facets/host_single.json.rabl
|
117
118
|
- app/views/foreman_puppet/api/v2/host_puppet_facets/show.json.rabl
|
118
119
|
- app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/base.json.rabl
|
120
|
+
- app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_list.json.rabl
|
119
121
|
- app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_single.json.rabl
|
120
122
|
- app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/show.json.rabl
|
121
123
|
- app/views/foreman_puppet/api/v2/import_puppetclasses/index.json.rabl
|
@@ -183,17 +185,28 @@ files:
|
|
183
185
|
- db/migrate/20200803113803_migrate_environment_to_puppet_facet.foreman_puppet.rb
|
184
186
|
- db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb
|
185
187
|
- db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb
|
188
|
+
- db/migrate/20210924103241_remove_katello_id_from_environments.foreman_puppet.rb
|
189
|
+
- db/migrate/20211111125003_drop_puppetclasses_direct_references.foreman_puppet.rb
|
186
190
|
- db/migrate/20211112130803_cleanup_environment_from_core_tables.foreman_puppet.rb
|
187
|
-
- db/
|
188
|
-
- db/
|
189
|
-
- db/migrate_foreman/
|
190
|
-
- db/migrate_foreman/
|
191
|
-
- db/migrate_foreman/
|
192
|
-
- db/migrate_foreman/
|
193
|
-
- db/migrate_foreman/
|
194
|
-
- db/migrate_foreman/
|
195
|
-
- db/migrate_foreman/
|
196
|
-
- db/migrate_foreman/
|
191
|
+
- db/migrate/20220201205305_migrate_host_class_permission.foreman_puppet.rb
|
192
|
+
- db/migrate/20220208135305_migrate_environment_ignore_type.foreman_puppet.rb
|
193
|
+
- db/migrate_foreman/20090722141107_create_environments.foreman_puppet.rb
|
194
|
+
- db/migrate_foreman/20090802062223_create_puppetclasses.foreman_puppet.rb
|
195
|
+
- db/migrate_foreman/20090905150132_create_hostgroups_puppetclasses.foreman_puppet.rb
|
196
|
+
- db/migrate_foreman/20110412103238_remove_unused_fields_from_puppet_classes.foreman_puppet.rb
|
197
|
+
- db/migrate_foreman/20110712070522_create_host_class.foreman_puppet.rb
|
198
|
+
- db/migrate_foreman/20120824142048_add_some_indexes.foreman_puppet.rb
|
199
|
+
- db/migrate_foreman/20120905095532_create_environment_classes.foreman_puppet.rb
|
200
|
+
- db/migrate_foreman/20121018152459_create_hostgroup_classes.foreman_puppet.rb
|
201
|
+
- db/migrate_foreman/20140407161817_create_config_groups.foreman_puppet.rb
|
202
|
+
- db/migrate_foreman/20140407162007_create_config_group_classes.foreman_puppet.rb
|
203
|
+
- db/migrate_foreman/20140407162059_create_host_config_groups.foreman_puppet.rb
|
204
|
+
- db/migrate_foreman/20161205142618_delete_orphaned_smart_class_parameters.foreman_puppet.rb
|
205
|
+
- db/migrate_foreman/20170109115157_fix_lookup_key_auditable_type.foreman_puppet.rb
|
206
|
+
- db/migrate_foreman/20180816134832_cast_lookup_key_values.foreman_puppet.rb
|
207
|
+
- db/migrate_foreman/20180831115634_add_uniqueness_to_puppetclass_name.foreman_puppet.rb
|
208
|
+
- db/migrate_foreman/20181023112532_add_environment_puppetclass_id.foreman_puppet.rb
|
209
|
+
- db/migrate_foreman/20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.foreman_puppet.rb
|
197
210
|
- db/seeds.d/111_puppet_proxy_feature.rb
|
198
211
|
- lib/foreman_puppet.rb
|
199
212
|
- lib/foreman_puppet/engine.rb
|
@@ -202,16 +215,50 @@ files:
|
|
202
215
|
- lib/tasks/foreman_puppet_tasks.rake
|
203
216
|
- locale/Makefile
|
204
217
|
- locale/action_names.rb
|
218
|
+
- locale/ca/LC_MESSAGES/foreman_puppet.mo
|
219
|
+
- locale/ca/foreman_puppet.po
|
220
|
+
- locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo
|
205
221
|
- locale/cs_CZ/foreman_puppet.edit.po
|
222
|
+
- locale/cs_CZ/foreman_puppet.po
|
206
223
|
- locale/cs_CZ/foreman_puppet.po.time_stamp
|
224
|
+
- locale/de/LC_MESSAGES/foreman_puppet.mo
|
225
|
+
- locale/de/foreman_puppet.po
|
207
226
|
- locale/en/LC_MESSAGES/foreman_puppet.mo
|
208
227
|
- locale/en/foreman_puppet.edit.po
|
209
228
|
- locale/en/foreman_puppet.po
|
210
229
|
- locale/en/foreman_puppet.po.time_stamp
|
211
230
|
- locale/en/foreman_puppet.pox
|
231
|
+
- locale/en_GB/LC_MESSAGES/foreman_puppet.mo
|
232
|
+
- locale/en_GB/foreman_puppet.po
|
233
|
+
- locale/es/LC_MESSAGES/foreman_puppet.mo
|
234
|
+
- locale/es/foreman_puppet.po
|
212
235
|
- locale/foreman_puppet.pot
|
236
|
+
- locale/fr/LC_MESSAGES/foreman_puppet.mo
|
237
|
+
- locale/fr/foreman_puppet.po
|
213
238
|
- locale/gemspec.rb
|
239
|
+
- locale/gl/LC_MESSAGES/foreman_puppet.mo
|
240
|
+
- locale/gl/foreman_puppet.po
|
241
|
+
- locale/it/LC_MESSAGES/foreman_puppet.mo
|
242
|
+
- locale/it/foreman_puppet.po
|
243
|
+
- locale/ja/LC_MESSAGES/foreman_puppet.mo
|
244
|
+
- locale/ja/foreman_puppet.po
|
245
|
+
- locale/ko/LC_MESSAGES/foreman_puppet.mo
|
246
|
+
- locale/ko/foreman_puppet.po
|
214
247
|
- locale/messages.mo
|
248
|
+
- locale/nl_NL/LC_MESSAGES/foreman_puppet.mo
|
249
|
+
- locale/nl_NL/foreman_puppet.po
|
250
|
+
- locale/pl/LC_MESSAGES/foreman_puppet.mo
|
251
|
+
- locale/pl/foreman_puppet.po
|
252
|
+
- locale/pt_BR/LC_MESSAGES/foreman_puppet.mo
|
253
|
+
- locale/pt_BR/foreman_puppet.po
|
254
|
+
- locale/ru/LC_MESSAGES/foreman_puppet.mo
|
255
|
+
- locale/ru/foreman_puppet.po
|
256
|
+
- locale/sv_SE/LC_MESSAGES/foreman_puppet.mo
|
257
|
+
- locale/sv_SE/foreman_puppet.po
|
258
|
+
- locale/zh_CN/LC_MESSAGES/foreman_puppet.mo
|
259
|
+
- locale/zh_CN/foreman_puppet.po
|
260
|
+
- locale/zh_TW/LC_MESSAGES/foreman_puppet.mo
|
261
|
+
- locale/zh_TW/foreman_puppet.po
|
215
262
|
- package.json
|
216
263
|
- test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
|
217
264
|
- test/controllers/foreman_puppet/api/v2/environments_controller_test.rb
|
@@ -224,6 +271,7 @@ files:
|
|
224
271
|
- test/controllers/foreman_puppet/api/v2/provisioning_templates_controller_test.rb
|
225
272
|
- test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb
|
226
273
|
- test/controllers/foreman_puppet/api/v2/smart_class_parameters_controller_test.rb
|
274
|
+
- test/controllers/foreman_puppet/api/v2/smart_proxies_controller_test.rb
|
227
275
|
- test/controllers/foreman_puppet/api/v2/template_combinations_controller_test.rb
|
228
276
|
- test/controllers/foreman_puppet/config_groups_controller_test.rb
|
229
277
|
- test/controllers/foreman_puppet/environments_controller_test.rb
|
@@ -246,7 +294,9 @@ files:
|
|
246
294
|
- test/graphql/queries/puppetclass_query_test.rb
|
247
295
|
- test/graphql/queries/puppetclasses_query_test.rb
|
248
296
|
- test/helpers/foreman_puppet/hosts_and_hostgroups_helper_test.rb
|
297
|
+
- test/helpers/foreman_puppet/puppetclass_lookup_keys_helper_test.rb
|
249
298
|
- test/helpers/foreman_puppet/puppetclasses_helper_test.rb
|
299
|
+
- test/integration/foreman_puppet/dashboard_js_test.rb
|
250
300
|
- test/integration/foreman_puppet/environment_js_test.rb
|
251
301
|
- test/integration/foreman_puppet/host_js_test.rb
|
252
302
|
- test/integration/foreman_puppet/hostgroup_js_test.rb
|
@@ -316,10 +366,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
366
|
- !ruby/object:Gem::Version
|
317
367
|
version: '0'
|
318
368
|
requirements: []
|
319
|
-
rubygems_version: 3.
|
369
|
+
rubygems_version: 3.3.4
|
320
370
|
signing_key:
|
321
371
|
specification_version: 4
|
322
|
-
summary:
|
372
|
+
summary: Add Puppet features to Foreman
|
323
373
|
test_files:
|
324
374
|
- test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb
|
325
375
|
- test/services/foreman_puppet/host_info_providers/puppet_info_test.rb
|
@@ -329,6 +379,7 @@ test_files:
|
|
329
379
|
- test/integration/foreman_puppet/puppetclass_js_test.rb
|
330
380
|
- test/integration/foreman_puppet/hostgroup_js_test.rb
|
331
381
|
- test/integration/foreman_puppet/environment_js_test.rb
|
382
|
+
- test/integration/foreman_puppet/dashboard_js_test.rb
|
332
383
|
- test/integration/foreman_puppet/host_js_test.rb
|
333
384
|
- test/graphql/mutations/hosts/create_mutation_test.rb
|
334
385
|
- test/graphql/queries/puppetclasses_query_test.rb
|
@@ -339,6 +390,7 @@ test_files:
|
|
339
390
|
- test/graphql/queries/environment_query_test.rb
|
340
391
|
- test/graphql/queries/hostgroup_puppet_query_test.rb
|
341
392
|
- test/graphql/queries/environments_query_test.rb
|
393
|
+
- test/helpers/foreman_puppet/puppetclass_lookup_keys_helper_test.rb
|
342
394
|
- test/helpers/foreman_puppet/puppetclasses_helper_test.rb
|
343
395
|
- test/helpers/foreman_puppet/hosts_and_hostgroups_helper_test.rb
|
344
396
|
- test/models/foreman_puppet/config_group_class_test.rb
|
@@ -379,6 +431,7 @@ test_files:
|
|
379
431
|
- test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
|
380
432
|
- test/controllers/foreman_puppet/api/v2/host_classes_controller_test.rb
|
381
433
|
- test/controllers/foreman_puppet/api/v2/provisioning_templates_controller_test.rb
|
434
|
+
- test/controllers/foreman_puppet/api/v2/smart_proxies_controller_test.rb
|
382
435
|
- test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb
|
383
436
|
- test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb
|
384
437
|
- test/controllers/foreman_puppet/puppetclasses_controller_test.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
class CastLookupKeyValues < ActiveRecord::Migration[5.1]
|
2
|
-
def up
|
3
|
-
# Different LookupKey types handle casting a bit differently
|
4
|
-
PuppetclassLookupKey.unscoped.preload(:lookup_values).where(override: true).where.not(key_type: 'string').find_each do |key|
|
5
|
-
cast_key_and_values(key)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def cast_key_and_values(key)
|
12
|
-
fix_value(key, :default_value)
|
13
|
-
key.lookup_values.each do |lv|
|
14
|
-
fix_value(lv, :value)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def safemode_box
|
19
|
-
@safemode_box ||= Safemode::Box.new
|
20
|
-
end
|
21
|
-
|
22
|
-
def fix_value(obj, attribute)
|
23
|
-
return if obj.omit && !obj.try(:merge_default)
|
24
|
-
value = obj.send(attribute)
|
25
|
-
return unless value.is_a? String
|
26
|
-
return if value.contains_erb?
|
27
|
-
fixed = safemode_box.eval(value)
|
28
|
-
obj.update_column(attribute, fixed)
|
29
|
-
rescue StandardError => e
|
30
|
-
say "Failed to cast #{attribute} for #{obj.inspect}:"
|
31
|
-
say "Value: #{value}", subitem: true
|
32
|
-
say "Error: #{e.message}", subitem: true
|
33
|
-
say 'Perhaps it is invalid? Casting skipped, manual action may be needed.', subitem: true
|
34
|
-
end
|
35
|
-
end
|