foreman_puppet 1.0.3 → 2.0.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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/foreman_puppet/extensions/api_hostgroups_controller.rb +14 -16
  3. data/app/controllers/concerns/foreman_puppet/{api/import_puppetclasses_common_controller.rb → extensions/api_smart_proxies_controller.rb} +9 -3
  4. data/app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb +23 -1
  5. data/app/controllers/concerns/foreman_puppet/extensions/api_v2_hosts_controller.rb +15 -17
  6. data/app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb +3 -1
  7. data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +0 -1
  8. data/app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb +41 -32
  9. data/app/controllers/concerns/foreman_puppet/extensions/parameters_hostgroup.rb +37 -34
  10. data/app/controllers/foreman_puppet/api/v2/environments_controller.rb +0 -1
  11. data/app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb +1 -1
  12. data/app/controllers/foreman_puppet/puppetclasses_controller.rb +1 -1
  13. data/app/helpers/foreman_puppet/environments_helper.rb +1 -1
  14. data/app/helpers/foreman_puppet/hosts_and_hostgroups_helper.rb +0 -5
  15. data/app/helpers/foreman_puppet/hosts_helper.rb +6 -10
  16. data/app/models/concerns/foreman_puppet/extensions/host.rb +2 -16
  17. data/app/models/concerns/foreman_puppet/extensions/hostgroup.rb +2 -7
  18. data/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb +7 -12
  19. data/app/models/concerns/foreman_puppet/extensions/template_combination.rb +5 -10
  20. data/app/models/foreman_puppet/host_puppet_facet.rb +1 -1
  21. data/app/models/foreman_puppet/hostgroup_puppet_facet.rb +2 -0
  22. data/app/services/concerns/foreman_puppet/extensions/host_counter.rb +17 -0
  23. data/app/services/foreman_puppet/puppet_class_importer.rb +0 -6
  24. data/app/views/foreman_puppet/api/v2/host_puppet_facets/host_list.json.rabl +3 -0
  25. data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/base.json.rabl +2 -0
  26. data/app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_list.json.rabl +3 -0
  27. data/app/views/foreman_puppet/config_groups/index.html.erb +1 -1
  28. data/config/api_routes.rb +1 -9
  29. data/config/initializers/api_reroute.rb +73 -5
  30. data/db/migrate/20101121140000_add_environment_to_template_combinations.foreman_puppet.rb +1 -1
  31. data/db/migrate/20200803113803_migrate_environment_to_puppet_facet.foreman_puppet.rb +2 -0
  32. data/db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb +36 -20
  33. data/db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb +0 -8
  34. data/db/migrate/20210924103241_remove_katello_id_from_environments.foreman_puppet.rb +5 -0
  35. data/db/migrate/20211111125003_drop_puppetclasses_direct_references.foreman_puppet.rb +11 -0
  36. data/db/migrate/20211112130803_cleanup_environment_from_core_tables.foreman_puppet.rb +10 -0
  37. data/db/migrate_foreman/{20090722141107_create_environments.rb → 20090722141107_create_environments.foreman_puppet.rb} +3 -3
  38. data/db/migrate_foreman/20090802062223_create_puppetclasses.foreman_puppet.rb +29 -0
  39. data/db/migrate_foreman/20090905150132_create_hostgroups_puppetclasses.foreman_puppet.rb +12 -0
  40. data/db/migrate_foreman/20110412103238_remove_unused_fields_from_puppet_classes.foreman_puppet.rb +9 -0
  41. data/db/migrate_foreman/20110712070522_create_host_class.foreman_puppet.rb +11 -0
  42. data/db/migrate_foreman/20120824142048_add_some_indexes.foreman_puppet.rb +21 -0
  43. data/db/migrate_foreman/{20120905095532_create_environment_classes.rb → 20120905095532_create_environment_classes.foreman_puppet.rb} +2 -2
  44. data/db/migrate_foreman/20121018152459_create_hostgroup_classes.foreman_puppet.rb +11 -0
  45. data/db/migrate_foreman/{20140407161817_create_config_groups.rb → 20140407161817_create_config_groups.foreman_puppet.rb} +0 -0
  46. data/db/migrate_foreman/{20140407162007_create_config_group_classes.rb → 20140407162007_create_config_group_classes.foreman_puppet.rb} +0 -0
  47. data/db/migrate_foreman/{20140407162059_create_host_config_groups.rb → 20140407162059_create_host_config_groups.foreman_puppet.rb} +0 -0
  48. data/db/migrate_foreman/{20161205142618_delete_orphaned_smart_class_parameters.rb → 20161205142618_delete_orphaned_smart_class_parameters.foreman_puppet.rb} +1 -1
  49. data/db/migrate_foreman/{20170109115157_fix_lookup_key_auditable_type.rb → 20170109115157_fix_lookup_key_auditable_type.foreman_puppet.rb} +0 -0
  50. data/db/migrate_foreman/20180816134832_cast_lookup_key_values.foreman_puppet.rb +5 -0
  51. data/db/migrate_foreman/20180831115634_add_uniqueness_to_puppetclass_name.foreman_puppet.rb +24 -0
  52. data/db/migrate_foreman/{20181023112532_add_environment_puppetclass_id.rb → 20181023112532_add_environment_puppetclass_id.foreman_puppet.rb} +1 -1
  53. 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
  54. data/lib/foreman_puppet/engine.rb +6 -36
  55. data/lib/foreman_puppet/register.rb +49 -45
  56. data/lib/foreman_puppet/version.rb +1 -1
  57. data/lib/foreman_puppet.rb +1 -6
  58. data/locale/ca/LC_MESSAGES/foreman_puppet.mo +0 -0
  59. data/locale/ca/foreman_puppet.po +760 -0
  60. data/locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo +0 -0
  61. data/locale/cs_CZ/foreman_puppet.edit.po +1085 -0
  62. data/locale/cs_CZ/foreman_puppet.po +823 -0
  63. data/locale/cs_CZ/foreman_puppet.po.time_stamp +0 -0
  64. data/locale/de/LC_MESSAGES/foreman_puppet.mo +0 -0
  65. data/locale/de/foreman_puppet.po +844 -0
  66. data/locale/en/LC_MESSAGES/foreman_puppet.mo +0 -0
  67. data/locale/en/foreman_puppet.edit.po +317 -162
  68. data/locale/en/foreman_puppet.po +119 -8
  69. data/locale/en_GB/LC_MESSAGES/foreman_puppet.mo +0 -0
  70. data/locale/en_GB/foreman_puppet.po +820 -0
  71. data/locale/es/LC_MESSAGES/foreman_puppet.mo +0 -0
  72. data/locale/es/foreman_puppet.po +827 -0
  73. data/locale/foreman_puppet.pot +376 -205
  74. data/locale/fr/LC_MESSAGES/foreman_puppet.mo +0 -0
  75. data/locale/fr/foreman_puppet.po +835 -0
  76. data/locale/gemspec.rb +1 -1
  77. data/locale/gl/LC_MESSAGES/foreman_puppet.mo +0 -0
  78. data/locale/gl/foreman_puppet.po +818 -0
  79. data/locale/it/LC_MESSAGES/foreman_puppet.mo +0 -0
  80. data/locale/it/foreman_puppet.po +822 -0
  81. data/locale/ja/LC_MESSAGES/foreman_puppet.mo +0 -0
  82. data/locale/ja/foreman_puppet.po +830 -0
  83. data/locale/ko/LC_MESSAGES/foreman_puppet.mo +0 -0
  84. data/locale/ko/foreman_puppet.po +819 -0
  85. data/locale/nl_NL/LC_MESSAGES/foreman_puppet.mo +0 -0
  86. data/locale/nl_NL/foreman_puppet.po +823 -0
  87. data/locale/pl/LC_MESSAGES/foreman_puppet.mo +0 -0
  88. data/locale/pl/foreman_puppet.po +822 -0
  89. data/locale/pt_BR/LC_MESSAGES/foreman_puppet.mo +0 -0
  90. data/locale/pt_BR/foreman_puppet.po +826 -0
  91. data/locale/ru/LC_MESSAGES/foreman_puppet.mo +0 -0
  92. data/locale/ru/foreman_puppet.po +827 -0
  93. data/locale/sv_SE/LC_MESSAGES/foreman_puppet.mo +0 -0
  94. data/locale/sv_SE/foreman_puppet.po +822 -0
  95. data/locale/zh_CN/LC_MESSAGES/foreman_puppet.mo +0 -0
  96. data/locale/zh_CN/foreman_puppet.po +831 -0
  97. data/locale/zh_TW/LC_MESSAGES/foreman_puppet.mo +0 -0
  98. data/locale/zh_TW/foreman_puppet.po +821 -0
  99. data/package.json +8 -11
  100. data/test/controllers/foreman_puppet/api/v2/environments_controller_test.rb +0 -231
  101. data/test/controllers/foreman_puppet/api/v2/smart_proxies_controller_test.rb +255 -0
  102. data/test/controllers/foreman_puppet/environments_controller_test.rb +2 -2
  103. data/test/controllers/foreman_puppet/hosts_controller_test.rb +0 -1
  104. data/test/factories/foreman_puppet_factories.rb +0 -2
  105. data/test/helpers/foreman_puppet/hosts_and_hostgroups_helper_test.rb +70 -31
  106. data/test/integration/foreman_puppet/dashboard_js_test.rb +31 -0
  107. data/test/integration/foreman_puppet/host_js_test.rb +0 -1
  108. data/test/integration/foreman_puppet/puppetclass_js_test.rb +1 -1
  109. data/test/models/foreman_puppet/host_puppet_facet_test.rb +7 -1
  110. data/test/models/foreman_puppet/host_test.rb +26 -0
  111. data/test/models/foreman_puppet/user_test.rb +1 -5
  112. data/test/services/foreman_puppet/host_counter_test.rb +17 -0
  113. data/test/unit/foreman_puppet/puppet_class_importer_test.rb +1 -1
  114. data/webpack/src/Components/Environments/Welcome.js +2 -2
  115. metadata +73 -18
  116. data/db/migrate_foreman/20180816134832_cast_lookup_key_values.rb +0 -35
@@ -9,49 +9,88 @@ module ForemanPuppet
9
9
  include HostsAndHostgroupsHelper
10
10
 
11
11
  describe 'puppet environment field' do
12
+ let(:fields) { mock('fields_for') }
13
+ let(:f) { mock('form_for') }
14
+ let(:object) { mock('object') }
15
+ let(:puppet_facet) { mock('puppet') }
16
+
12
17
  setup do
13
- @host = mock('host')
14
- puppet = mock('puppet')
15
- @host.stubs(:hostgroup)
16
- @host.stubs(:puppet).returns(puppet)
17
- @host.stubs(:id).returns(999)
18
- @f = mock('f')
19
- @f.stubs(:object).returns(@host)
20
- @fields = mock('fields')
21
- @fields.stubs(:object).returns(puppet)
22
- @f.stubs(:fields_for).yields(@fields)
18
+ f.stubs(:object).returns(object)
19
+ f.stubs(:fields_for).yields(fields)
20
+ fields.stubs(:object).returns(puppet_facet)
23
21
  end
24
22
 
25
- test 'it adds new first level attributes' do
26
- @fields.expects(:collection_select).with do |*attrs|
27
- select_options, html_options = extract_collection_options(attrs)
28
- select_options[:test_select_option] == 'test_value1' &&
29
- html_options[:test_html_option] == 'test_value2'
23
+ describe '#host_puppet_environment_field' do
24
+ let(:object) do
25
+ host = mock('host')
26
+ host.stubs(:hostgroup)
27
+ host.stubs(:puppet).returns(puppet_facet)
28
+ host.stubs(:id).returns(999)
29
+ host
30
30
  end
31
31
 
32
- host_puppet_environment_field(@f, { test_select_option: 'test_value1' }, { test_html_option: 'test_value2' })
33
- end
32
+ test 'it adds new first level attributes' do
33
+ fields.expects(:collection_select).with do |*attrs|
34
+ select_options, html_options = extract_collection_options(attrs)
35
+ select_options[:test_select_option] == 'test_value1' &&
36
+ html_options[:test_html_option] == 'test_value2'
37
+ end
34
38
 
35
- test 'it adds new data attributes' do
36
- @fields.expects(:collection_select).with do |*attrs|
37
- select_options, html_options = extract_collection_options(attrs)
38
- select_options[:test_select_option] == 'test_value1' &&
39
- html_options[:data][:test] == 'test_value2'
39
+ host_puppet_environment_field(f, { test_select_option: 'test_value1' }, { test_html_option: 'test_value2' })
40
40
  end
41
41
 
42
- host_puppet_environment_field(@f, { test_select_option: 'test_value1' }, { data: { test: 'test_value2' } })
42
+ test 'it adds new data attributes' do
43
+ fields.expects(:collection_select).with do |*attrs|
44
+ select_options, html_options = extract_collection_options(attrs)
45
+ select_options[:test_select_option] == 'test_value1' &&
46
+ html_options[:data][:test] == 'test_value2'
47
+ end
48
+
49
+ host_puppet_environment_field(f, { test_select_option: 'test_value1' }, { data: { test: 'test_value2' } })
50
+ end
51
+
52
+ test 'it overrides existing attributes' do
53
+ fields.expects(:collection_select).with do |*attrs|
54
+ html_options = attrs.pop
55
+ html_options[:data][:test] == 'some_test_value' &&
56
+ html_options[:data][:url] == '/test/url'
57
+ end.returns('')
58
+
59
+ html = host_puppet_environment_field(f, { disable_button: false }, { data: { url: '/test/url', test: 'some_test_value' } })
60
+
61
+ assert_no_match(/btn/, html)
62
+ end
43
63
  end
44
64
 
45
- test 'it overrides existing attributes' do
46
- @fields.expects(:collection_select).with do |*attrs|
47
- html_options = attrs.pop
48
- html_options[:data][:test] == 'some_test_value' &&
49
- html_options[:data][:url] == '/test/url'
50
- end.returns('')
65
+ describe '#hostgroup_puppet_environment_field' do
66
+ let(:object) { FactoryBot.build_stubbed(:hostgroup, parent: parent_hg) }
67
+ let(:puppet_facet) { object.puppet || object.build_puppet }
68
+
69
+ context 'parent without puppet' do
70
+ let(:parent_hg) { FactoryBot.create(:hostgroup) }
51
71
 
52
- html = host_puppet_environment_field(@f, { disable_button: false }, { data: { url: '/test/url', test: 'some_test_value' } })
72
+ it 'shows Inherit option with no value' do
73
+ fields.expects(:collection_select).with do |*attrs|
74
+ options = attrs.second
75
+ options.first.to_label == 'Inherit parent (no value)'
76
+ end.returns('')
77
+
78
+ hostgroup_puppet_environment_field(f)
79
+ end
80
+ end
53
81
 
54
- assert_no_match(/btn/, html)
82
+ context 'parent with puppet' do
83
+ let(:parent_hg) { FactoryBot.create(:hostgroup, :with_puppet_enc) }
84
+
85
+ it 'shows Inherit option with no value' do
86
+ fields.expects(:collection_select).with do |*attrs|
87
+ options = attrs.second
88
+ options.first.to_label == "Inherit parent (#{parent_hg.puppet.environment.name})"
89
+ end.returns('')
90
+
91
+ hostgroup_puppet_environment_field(f)
92
+ end
93
+ end
55
94
  end
56
95
  end
57
96
 
@@ -0,0 +1,31 @@
1
+ require 'test_puppet_helper'
2
+ require 'integration_test_helper'
3
+ require 'integration/shared/host_finders'
4
+ require 'integration/shared/host_orchestration_stubs'
5
+
6
+ module ForemanPuppet
7
+ class DashboardJSTest < IntegrationTestWithJavascript
8
+ setup do
9
+ Dashboard::Manager.reset_user_to_default(users(:admin))
10
+ Setting[:outofsync_interval] = 35
11
+ end
12
+
13
+ context 'with origin' do
14
+ setup do
15
+ Setting[:puppet_out_of_sync_disabled] = true
16
+ end
17
+
18
+ context 'out of sync disabled' do
19
+ test 'has no out of sync link' do
20
+ visit dashboard_path
21
+ wait_for_ajax
22
+ within "li[data-name='Host Configuration Status for Puppet']" do
23
+ assert page.has_no_link?('Out of sync hosts')
24
+ assert page.has_no_link?('Good host reports in the last')
25
+ assert page.has_link?('Good host with reports')
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -362,7 +362,6 @@ module ForemanPuppet
362
362
  page.find('#puppet_klasses_parameters_table')
363
363
  end
364
364
 
365
- # TODO: unless ForemanPuppet.extracted_from_core?
366
365
  def switch_form_tab_to_interfaces
367
366
  switch_form_tab('Interfaces')
368
367
  disable_interface_modal_animation
@@ -11,7 +11,7 @@ module ForemanPuppet
11
11
  let(:puppetclass) { FactoryBot.create(:puppetclass, environments: [environment]) }
12
12
 
13
13
  test 'edit page' do
14
- FactoryBot.create(:puppetclass, name: 'vim', environments: [environment]) if ForemanPuppet.extracted_from_core?
14
+ FactoryBot.create(:puppetclass, name: 'vim', environments: [environment])
15
15
  visit puppetclasses_path
16
16
  click_link 'vim'
17
17
  assert page.has_no_link? 'Common'
@@ -107,7 +107,13 @@ module ForemanPuppet
107
107
  test 'should return empty array if host has no hostgroup' do
108
108
  host = FactoryBot.create(:host, :with_puppet_enc)
109
109
  assert_not host.hostgroup
110
- assert_empty host.puppet.parent_config_groups
110
+ assert_equal [], host.puppet.parent_config_groups
111
+ end
112
+
113
+ test 'should return empty array if hostgroup do not have puppet data' do
114
+ hostgroup = FactoryBot.create(:hostgroup)
115
+ host = FactoryBot.create(:host, :with_puppet_enc, hostgroup: hostgroup)
116
+ assert_equal [], host.puppet.parent_config_groups
111
117
  end
112
118
  end
113
119
 
@@ -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) do
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
@@ -0,0 +1,17 @@
1
+ require 'test_puppet_helper'
2
+
3
+ module ForemanPuppet
4
+ class HostCounterTest < ActiveSupport::TestCase
5
+ def hosts_count(association)
6
+ ::HostCounter.new(association)
7
+ end
8
+
9
+ let(:environment) { FactoryBot.create(:environment) }
10
+
11
+ test 'it should get number of hosts associated to environment' do
12
+ FactoryBot.create(:host, :with_puppet_enc, environment: environment)
13
+ count = hosts_count(:environment)
14
+ assert_equal 1, count[environment]
15
+ end
16
+ end
17
+ end
@@ -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') if ForemanPuppet.extracted_from_core?
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)
@@ -7,11 +7,11 @@ import { foremanUrl, getManualURL } from 'foremanReact/common/helpers';
7
7
  export const WelcomeEnv = ({ canCreate }) => {
8
8
  const action = canCreate && {
9
9
  title: __('Create Puppet Environment'),
10
- url: foremanUrl('environments/new'),
10
+ url: foremanUrl('/foreman_puppet/environments/new'),
11
11
  };
12
12
 
13
13
  const content = __(`If you are planning to use Foreman as an external node classifier you should provide information about one or more environments.<br/>
14
- This information is commonly imported from a pre-existing Puppet configuration by the use of the <a href=${getManualURL(
14
+ This information is commonly imported from a pre-existing Puppet configuration by the use of the <a target="_blank" href=${getManualURL(
15
15
  '4.2.2Classes'
16
16
  )}>Puppet classes and environment importer.</a>`);
17
17
  return (
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
8
8
  - Shira Maximov
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-09-17 00:00:00.000000000 Z
12
+ date: 2021-11-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: Allow assigning Puppet environmets and classes to the Foreman Hosts.
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
@@ -94,6 +94,7 @@ files:
94
94
  - app/models/foreman_puppet/puppetclass.rb
95
95
  - app/models/foreman_puppet/puppetclass_lookup_key.rb
96
96
  - app/prepend_views/api/v2/template_combinations/base.json.rabl
97
+ - app/services/concerns/foreman_puppet/extensions/host_counter.rb
97
98
  - app/services/foreman_puppet/host_info_providers/config_groups_info.rb
98
99
  - app/services/foreman_puppet/host_info_providers/puppet_info.rb
99
100
  - app/services/foreman_puppet/input_type/puppet_parameter_input.rb
@@ -112,9 +113,11 @@ files:
112
113
  - app/views/foreman_puppet/api/v2/environments/show.json.rabl
113
114
  - app/views/foreman_puppet/api/v2/environments/update.json.rabl
114
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
115
117
  - app/views/foreman_puppet/api/v2/host_puppet_facets/host_single.json.rabl
116
118
  - app/views/foreman_puppet/api/v2/host_puppet_facets/show.json.rabl
117
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
118
121
  - app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/hostgroup_single.json.rabl
119
122
  - app/views/foreman_puppet/api/v2/hostgroup_puppet_facets/show.json.rabl
120
123
  - app/views/foreman_puppet/api/v2/import_puppetclasses/index.json.rabl
@@ -182,16 +185,26 @@ files:
182
185
  - db/migrate/20200803113803_migrate_environment_to_puppet_facet.foreman_puppet.rb
183
186
  - db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb
184
187
  - db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb
185
- - db/migrate_foreman/20090722141107_create_environments.rb
186
- - db/migrate_foreman/20120905095532_create_environment_classes.rb
187
- - db/migrate_foreman/20140407161817_create_config_groups.rb
188
- - db/migrate_foreman/20140407162007_create_config_group_classes.rb
189
- - db/migrate_foreman/20140407162059_create_host_config_groups.rb
190
- - db/migrate_foreman/20161205142618_delete_orphaned_smart_class_parameters.rb
191
- - db/migrate_foreman/20170109115157_fix_lookup_key_auditable_type.rb
192
- - db/migrate_foreman/20180816134832_cast_lookup_key_values.rb
193
- - db/migrate_foreman/20181023112532_add_environment_puppetclass_id.rb
194
- - db/migrate_foreman/20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.rb
188
+ - db/migrate/20210924103241_remove_katello_id_from_environments.foreman_puppet.rb
189
+ - db/migrate/20211111125003_drop_puppetclasses_direct_references.foreman_puppet.rb
190
+ - db/migrate/20211112130803_cleanup_environment_from_core_tables.foreman_puppet.rb
191
+ - db/migrate_foreman/20090722141107_create_environments.foreman_puppet.rb
192
+ - db/migrate_foreman/20090802062223_create_puppetclasses.foreman_puppet.rb
193
+ - db/migrate_foreman/20090905150132_create_hostgroups_puppetclasses.foreman_puppet.rb
194
+ - db/migrate_foreman/20110412103238_remove_unused_fields_from_puppet_classes.foreman_puppet.rb
195
+ - db/migrate_foreman/20110712070522_create_host_class.foreman_puppet.rb
196
+ - db/migrate_foreman/20120824142048_add_some_indexes.foreman_puppet.rb
197
+ - db/migrate_foreman/20120905095532_create_environment_classes.foreman_puppet.rb
198
+ - db/migrate_foreman/20121018152459_create_hostgroup_classes.foreman_puppet.rb
199
+ - db/migrate_foreman/20140407161817_create_config_groups.foreman_puppet.rb
200
+ - db/migrate_foreman/20140407162007_create_config_group_classes.foreman_puppet.rb
201
+ - db/migrate_foreman/20140407162059_create_host_config_groups.foreman_puppet.rb
202
+ - db/migrate_foreman/20161205142618_delete_orphaned_smart_class_parameters.foreman_puppet.rb
203
+ - db/migrate_foreman/20170109115157_fix_lookup_key_auditable_type.foreman_puppet.rb
204
+ - db/migrate_foreman/20180816134832_cast_lookup_key_values.foreman_puppet.rb
205
+ - db/migrate_foreman/20180831115634_add_uniqueness_to_puppetclass_name.foreman_puppet.rb
206
+ - db/migrate_foreman/20181023112532_add_environment_puppetclass_id.foreman_puppet.rb
207
+ - db/migrate_foreman/20181224174419_add_index_to_environment_class_by_lookup_key_and_puppetclass.foreman_puppet.rb
195
208
  - db/seeds.d/111_puppet_proxy_feature.rb
196
209
  - lib/foreman_puppet.rb
197
210
  - lib/foreman_puppet/engine.rb
@@ -200,14 +213,50 @@ files:
200
213
  - lib/tasks/foreman_puppet_tasks.rake
201
214
  - locale/Makefile
202
215
  - locale/action_names.rb
216
+ - locale/ca/LC_MESSAGES/foreman_puppet.mo
217
+ - locale/ca/foreman_puppet.po
218
+ - locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo
219
+ - locale/cs_CZ/foreman_puppet.edit.po
220
+ - locale/cs_CZ/foreman_puppet.po
221
+ - locale/cs_CZ/foreman_puppet.po.time_stamp
222
+ - locale/de/LC_MESSAGES/foreman_puppet.mo
223
+ - locale/de/foreman_puppet.po
203
224
  - locale/en/LC_MESSAGES/foreman_puppet.mo
204
225
  - locale/en/foreman_puppet.edit.po
205
226
  - locale/en/foreman_puppet.po
206
227
  - locale/en/foreman_puppet.po.time_stamp
207
228
  - locale/en/foreman_puppet.pox
229
+ - locale/en_GB/LC_MESSAGES/foreman_puppet.mo
230
+ - locale/en_GB/foreman_puppet.po
231
+ - locale/es/LC_MESSAGES/foreman_puppet.mo
232
+ - locale/es/foreman_puppet.po
208
233
  - locale/foreman_puppet.pot
234
+ - locale/fr/LC_MESSAGES/foreman_puppet.mo
235
+ - locale/fr/foreman_puppet.po
209
236
  - locale/gemspec.rb
237
+ - locale/gl/LC_MESSAGES/foreman_puppet.mo
238
+ - locale/gl/foreman_puppet.po
239
+ - locale/it/LC_MESSAGES/foreman_puppet.mo
240
+ - locale/it/foreman_puppet.po
241
+ - locale/ja/LC_MESSAGES/foreman_puppet.mo
242
+ - locale/ja/foreman_puppet.po
243
+ - locale/ko/LC_MESSAGES/foreman_puppet.mo
244
+ - locale/ko/foreman_puppet.po
210
245
  - locale/messages.mo
246
+ - locale/nl_NL/LC_MESSAGES/foreman_puppet.mo
247
+ - locale/nl_NL/foreman_puppet.po
248
+ - locale/pl/LC_MESSAGES/foreman_puppet.mo
249
+ - locale/pl/foreman_puppet.po
250
+ - locale/pt_BR/LC_MESSAGES/foreman_puppet.mo
251
+ - locale/pt_BR/foreman_puppet.po
252
+ - locale/ru/LC_MESSAGES/foreman_puppet.mo
253
+ - locale/ru/foreman_puppet.po
254
+ - locale/sv_SE/LC_MESSAGES/foreman_puppet.mo
255
+ - locale/sv_SE/foreman_puppet.po
256
+ - locale/zh_CN/LC_MESSAGES/foreman_puppet.mo
257
+ - locale/zh_CN/foreman_puppet.po
258
+ - locale/zh_TW/LC_MESSAGES/foreman_puppet.mo
259
+ - locale/zh_TW/foreman_puppet.po
211
260
  - package.json
212
261
  - test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
213
262
  - test/controllers/foreman_puppet/api/v2/environments_controller_test.rb
@@ -220,6 +269,7 @@ files:
220
269
  - test/controllers/foreman_puppet/api/v2/provisioning_templates_controller_test.rb
221
270
  - test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb
222
271
  - test/controllers/foreman_puppet/api/v2/smart_class_parameters_controller_test.rb
272
+ - test/controllers/foreman_puppet/api/v2/smart_proxies_controller_test.rb
223
273
  - test/controllers/foreman_puppet/api/v2/template_combinations_controller_test.rb
224
274
  - test/controllers/foreman_puppet/config_groups_controller_test.rb
225
275
  - test/controllers/foreman_puppet/environments_controller_test.rb
@@ -243,6 +293,7 @@ files:
243
293
  - test/graphql/queries/puppetclasses_query_test.rb
244
294
  - test/helpers/foreman_puppet/hosts_and_hostgroups_helper_test.rb
245
295
  - test/helpers/foreman_puppet/puppetclasses_helper_test.rb
296
+ - test/integration/foreman_puppet/dashboard_js_test.rb
246
297
  - test/integration/foreman_puppet/environment_js_test.rb
247
298
  - test/integration/foreman_puppet/host_js_test.rb
248
299
  - test/integration/foreman_puppet/hostgroup_js_test.rb
@@ -263,6 +314,7 @@ files:
263
314
  - test/models/foreman_puppet/report_test.rb
264
315
  - test/models/foreman_puppet/smart_proxy_test.rb
265
316
  - test/models/foreman_puppet/user_test.rb
317
+ - test/services/foreman_puppet/host_counter_test.rb
266
318
  - test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb
267
319
  - test/services/foreman_puppet/host_info_providers/puppet_info_test.rb
268
320
  - test/services/foreman_puppet/input_type/puppet_parameter_input_test.rb
@@ -296,7 +348,7 @@ homepage: https://github.com/theforeman/foreman_puppet
296
348
  licenses:
297
349
  - GPL-3.0
298
350
  metadata: {}
299
- post_install_message:
351
+ post_install_message:
300
352
  rdoc_options: []
301
353
  require_paths:
302
354
  - lib
@@ -312,17 +364,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
364
  version: '0'
313
365
  requirements: []
314
366
  rubygems_version: 3.1.6
315
- signing_key:
367
+ signing_key:
316
368
  specification_version: 4
317
- summary: Adds puppet ENC features
369
+ summary: Add Puppet features to Foreman
318
370
  test_files:
319
371
  - test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb
320
372
  - test/services/foreman_puppet/host_info_providers/puppet_info_test.rb
321
373
  - test/services/foreman_puppet/input_type/puppet_parameter_input_test.rb
374
+ - test/services/foreman_puppet/host_counter_test.rb
322
375
  - test/integration/foreman_puppet/smartclass_parameter_js_test.rb
323
376
  - test/integration/foreman_puppet/puppetclass_js_test.rb
324
377
  - test/integration/foreman_puppet/hostgroup_js_test.rb
325
378
  - test/integration/foreman_puppet/environment_js_test.rb
379
+ - test/integration/foreman_puppet/dashboard_js_test.rb
326
380
  - test/integration/foreman_puppet/host_js_test.rb
327
381
  - test/graphql/mutations/hosts/create_mutation_test.rb
328
382
  - test/graphql/queries/puppetclasses_query_test.rb
@@ -373,6 +427,7 @@ test_files:
373
427
  - test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb
374
428
  - test/controllers/foreman_puppet/api/v2/host_classes_controller_test.rb
375
429
  - test/controllers/foreman_puppet/api/v2/provisioning_templates_controller_test.rb
430
+ - test/controllers/foreman_puppet/api/v2/smart_proxies_controller_test.rb
376
431
  - test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb
377
432
  - test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb
378
433
  - 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