foreman_puppet 3.0.1 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +1 -1
  3. data/app/helpers/foreman_puppet/environments_helper.rb +1 -1
  4. data/app/helpers/foreman_puppet/puppetclass_lookup_keys_helper.rb +1 -1
  5. data/app/services/foreman_puppet/host_info_providers/puppet_info.rb +1 -1
  6. data/app/views/foreman_puppet/config_groups/index.html.erb +3 -1
  7. data/app/views/hosts/_form_puppet_enc_tab.html.erb +5 -4
  8. data/db/migrate/20220201205305_migrate_host_class_permission.foreman_puppet.rb +9 -0
  9. data/db/migrate/20220208135305_migrate_environment_ignore_type.foreman_puppet.rb +15 -0
  10. data/db/migrate_foreman/20090905150132_create_hostgroups_puppetclasses.foreman_puppet.rb +3 -1
  11. data/lib/foreman_puppet/register.rb +2 -1
  12. data/lib/foreman_puppet/version.rb +1 -1
  13. data/locale/ca/LC_MESSAGES/foreman_puppet.mo +0 -0
  14. data/locale/ca/foreman_puppet.edit.po +1095 -0
  15. data/locale/ca/foreman_puppet.po +70 -1
  16. data/locale/ca/foreman_puppet.po.time_stamp +0 -0
  17. data/locale/cs_CZ/LC_MESSAGES/foreman_puppet.mo +0 -0
  18. data/locale/cs_CZ/foreman_puppet.edit.po +199 -184
  19. data/locale/cs_CZ/foreman_puppet.po +13 -2
  20. data/locale/de/LC_MESSAGES/foreman_puppet.mo +0 -0
  21. data/locale/de/foreman_puppet.edit.po +1122 -0
  22. data/locale/de/foreman_puppet.po +25 -13
  23. data/locale/de/foreman_puppet.po.time_stamp +0 -0
  24. data/locale/en/LC_MESSAGES/foreman_puppet.mo +0 -0
  25. data/locale/en/foreman_puppet.edit.po +33 -25
  26. data/locale/en/foreman_puppet.po +13 -1
  27. data/locale/en_GB/LC_MESSAGES/foreman_puppet.mo +0 -0
  28. data/locale/en_GB/foreman_puppet.edit.po +1097 -0
  29. data/locale/en_GB/foreman_puppet.po +13 -2
  30. data/locale/en_GB/foreman_puppet.po.time_stamp +0 -0
  31. data/locale/es/LC_MESSAGES/foreman_puppet.mo +0 -0
  32. data/locale/es/foreman_puppet.edit.po +1104 -0
  33. data/locale/es/foreman_puppet.po +13 -2
  34. data/locale/es/foreman_puppet.po.time_stamp +0 -0
  35. data/locale/foreman_puppet.pot +48 -25
  36. data/locale/fr/LC_MESSAGES/foreman_puppet.mo +0 -0
  37. data/locale/fr/foreman_puppet.edit.po +1112 -0
  38. data/locale/fr/foreman_puppet.po +13 -2
  39. data/locale/fr/foreman_puppet.po.time_stamp +0 -0
  40. data/locale/gl/LC_MESSAGES/foreman_puppet.mo +0 -0
  41. data/locale/gl/foreman_puppet.edit.po +1095 -0
  42. data/locale/gl/foreman_puppet.po +13 -2
  43. data/locale/gl/foreman_puppet.po.time_stamp +0 -0
  44. data/locale/it/LC_MESSAGES/foreman_puppet.mo +0 -0
  45. data/locale/it/foreman_puppet.edit.po +1099 -0
  46. data/locale/it/foreman_puppet.po +13 -2
  47. data/locale/it/foreman_puppet.po.time_stamp +0 -0
  48. data/locale/ja/LC_MESSAGES/foreman_puppet.mo +0 -0
  49. data/locale/ja/foreman_puppet.edit.po +1107 -0
  50. data/locale/ja/foreman_puppet.po +15 -4
  51. data/locale/ja/foreman_puppet.po.time_stamp +0 -0
  52. data/locale/ko/LC_MESSAGES/foreman_puppet.mo +0 -0
  53. data/locale/ko/foreman_puppet.edit.po +1096 -0
  54. data/locale/ko/foreman_puppet.po +13 -2
  55. data/locale/ko/foreman_puppet.po.time_stamp +0 -0
  56. data/locale/nl_NL/LC_MESSAGES/foreman_puppet.mo +0 -0
  57. data/locale/nl_NL/foreman_puppet.edit.po +1100 -0
  58. data/locale/nl_NL/foreman_puppet.po +13 -2
  59. data/locale/nl_NL/foreman_puppet.po.time_stamp +0 -0
  60. data/locale/pl/LC_MESSAGES/foreman_puppet.mo +0 -0
  61. data/locale/pl/foreman_puppet.edit.po +1099 -0
  62. data/locale/pl/foreman_puppet.po +13 -2
  63. data/locale/pl/foreman_puppet.po.time_stamp +0 -0
  64. data/locale/pt_BR/LC_MESSAGES/foreman_puppet.mo +0 -0
  65. data/locale/pt_BR/foreman_puppet.edit.po +1103 -0
  66. data/locale/pt_BR/foreman_puppet.po +13 -2
  67. data/locale/pt_BR/foreman_puppet.po.time_stamp +0 -0
  68. data/locale/ru/LC_MESSAGES/foreman_puppet.mo +0 -0
  69. data/locale/ru/foreman_puppet.edit.po +1104 -0
  70. data/locale/ru/foreman_puppet.po +15 -4
  71. data/locale/ru/foreman_puppet.po.time_stamp +0 -0
  72. data/locale/sv_SE/LC_MESSAGES/foreman_puppet.mo +0 -0
  73. data/locale/sv_SE/foreman_puppet.edit.po +1099 -0
  74. data/locale/sv_SE/foreman_puppet.po +13 -2
  75. data/locale/sv_SE/foreman_puppet.po.time_stamp +0 -0
  76. data/locale/zh_CN/LC_MESSAGES/foreman_puppet.mo +0 -0
  77. data/locale/zh_CN/foreman_puppet.edit.po +1108 -0
  78. data/locale/zh_CN/foreman_puppet.po +16 -5
  79. data/locale/zh_CN/foreman_puppet.po.time_stamp +0 -0
  80. data/locale/zh_TW/LC_MESSAGES/foreman_puppet.mo +0 -0
  81. data/locale/zh_TW/foreman_puppet.edit.po +1098 -0
  82. data/locale/zh_TW/foreman_puppet.po +13 -2
  83. data/locale/zh_TW/foreman_puppet.po.time_stamp +0 -0
  84. data/test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb +10 -0
  85. data/test/controllers/foreman_puppet/hosts_controller_test.rb +4 -27
  86. data/test/helpers/foreman_puppet/puppetclass_lookup_keys_helper_test.rb +34 -0
  87. data/test/integration/foreman_puppet/host_js_test.rb +14 -9
  88. data/test/models/foreman_puppet/host_puppet_facet_test.rb +11 -0
  89. metadata +39 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 551d9a6cf7153dfc0bb5a4709bbd394bc6d2ba5354b16531de6787653ca1d185
4
- data.tar.gz: cacbf35dfb12c49175bd0ee95ea8cf4b441319c140b7401c5527b8231a9000f0
3
+ metadata.gz: 80c2355783d6696a0c201214e7447b649e387f82e1585a349b1eeb3e13b7717b
4
+ data.tar.gz: 6dcd3c36bc6ffbcf8249f0916c1e96c8d9ce0fed6d6fe4bd933bea22487fef60
5
5
  SHA512:
6
- metadata.gz: 6c28a424fb8afdb633134b1f57fa7254ead445a7a1e45d3b8bc97cbfc3ffd42a0dbb80df33ae2d7cc52d55cc12575078a773b3ed5ae3b9a360f9afb26d2631b8
7
- data.tar.gz: d29c6598e1709bfddceb64e92fe16f33df55ce5eb85288e3f3ad14d590aa59d88515c37fd7116a252d889deb416bb652449c6fa6de3ef4baad5e27bfd9547bc8
6
+ metadata.gz: d8b9474051ad593d3492e3f987cb07d379901b9df21f8e2034ff0965a275cb86375f5dff6d7b427428387a7f83596e59cfc9a847cb3a7b3af3acff8bc67540c6
7
+ data.tar.gz: 96957f843bcd42ce54dee222fcfc00b4abfa0fda1ea12ec73e7bf44bbcbe0b9dbfb820585743e05335b226d71fed431a4522251582629cf5bc538ef493a29277
@@ -3,7 +3,7 @@ module ForemanPuppet
3
3
  module HostsControllerExtensions
4
4
  extend ActiveSupport::Concern
5
5
 
6
- PUPPETMASTER_ACTIONS = %i[externalNodes lookup].freeze
6
+ PUPPETMASTER_ACTIONS = %i[externalNodes].freeze
7
7
  PUPPET_AJAX_REQUESTS = %w[hostgroup_or_environment_selected puppetclass_parameters].freeze
8
8
 
9
9
  MULTIPLE_EDIT_ACTIONS = %w[select_multiple_environment update_multiple_environment
@@ -11,7 +11,7 @@ module ForemanPuppet
11
11
  def environments_title_actions
12
12
  title_actions import_proxy_select(hash_for_import_environments_environments_path.merge(engine: foreman_puppet)),
13
13
  button_group(new_link(_('Create Puppet Environment'), { engine: foreman_puppet }, id: 'new_environment')),
14
- button_group(help_button)
14
+ button_group(link_to(_('Help'), { action: 'welcome' }, { class: 'btn btn-default' }))
15
15
  end
16
16
  end
17
17
  end
@@ -9,7 +9,7 @@ module ForemanPuppet
9
9
  # ------ Host(group) Form Helpers -----
10
10
 
11
11
  def overridable_puppet_lookup_keys(klass, obj)
12
- klass.class_params.override.where(environment_classes: { environment_id: obj.environment_id })
12
+ klass.class_params.override.where(environment_classes: { environment_id: obj.environment })
13
13
  end
14
14
 
15
15
  def hidden_puppet_lookup_value_fields(lookup_key, lookup_value, disabled)
@@ -45,7 +45,7 @@ module ForemanPuppet
45
45
  end
46
46
 
47
47
  def ca_defined?
48
- SETTINGS[:unattended] && host.puppetca_exists?
48
+ host.puppetca_exists?
49
49
  end
50
50
 
51
51
  def has_environment?
@@ -2,7 +2,9 @@
2
2
  <% content_for(:search_bar) { } %>
3
3
  <% title _('Config Groups') %>
4
4
 
5
- <% title_actions new_link(_('Create Config Group'), { engine: foreman_puppet }, id: 'new_config_group'), help_button %>
5
+ <% title_actions(
6
+ new_link(_('Create Config Group'), { engine: foreman_puppet }, id: 'new_config_group'),
7
+ link_to(_('Help'), { action: 'welcome' }, { class: 'btn btn-default' })) %>
6
8
 
7
9
  <table class="<%= table_css_classes 'table-fixed' %>">
8
10
  <thead>
@@ -11,13 +11,14 @@
11
11
  <% end %>
12
12
 
13
13
  <%= render 'foreman_puppet/puppetclasses/class_selection', obj: obj, resource_type: resource_type %>
14
+
15
+ <fieldset id="puppet_klasses_parameters" data-url="<%= foreman_puppet.url_for(controller: resource_type.to_s.pluralize.to_sym, action: :puppetclass_parameters, only_path: true) %>">
16
+ <h2><%= _('Puppet Class Parameters') %></h2>
17
+ <%= render 'foreman_puppet/puppetclasses/classes_parameters', obj: subject %>
18
+ </fieldset>
14
19
  <% else %>
15
20
  <%= alert(class: alert_class(:info),
16
21
  header: _('Notice'),
17
22
  text: _('Please select an environment first')) %>
18
23
  <% end %>
19
24
 
20
- <fieldset id="puppet_klasses_parameters" data-url="<%= foreman_puppet.url_for(controller: resource_type.to_s.pluralize.to_sym, action: :puppetclass_parameters, only_path: true) %>">
21
- <h2><%= _('Puppet Class Parameters') %></h2>
22
- <%= render 'foreman_puppet/puppetclasses/classes_parameters', obj: subject %>
23
- </fieldset>
@@ -0,0 +1,9 @@
1
+ class MigrateHostClassPermission < ActiveRecord::Migration[6.0]
2
+ def up
3
+ Permission.where(resource_type: 'HostClass').update_all(resource_type: 'ForemanPuppet::HostClass')
4
+ end
5
+
6
+ def down
7
+ # no can do
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class MigrateEnvironmentIgnoreType < ActiveRecord::Migration[6.0]
2
+ def up
3
+ taxonomies = Taxonomy.unscoped.where("ignore_types LIKE '%Environment%'")
4
+ environment_ids = ForemanPuppet::Environment.unscoped.pluck(:id)
5
+
6
+ taxonomies.each do |tax|
7
+ new_types = tax.ignore_types.reject { |type| type == 'Environment' }
8
+ tax.update_columns(ignore_types: new_types)
9
+ taxable_rows = environment_ids.map do |env_id|
10
+ { taxable_id: env_id, taxable_type: 'ForemanPuppet::Environment', taxonomy_id: tax.id }
11
+ end
12
+ TaxableTaxonomy.insert_all(taxable_rows) if taxable_rows.any?
13
+ end
14
+ end
15
+ end
@@ -1,6 +1,8 @@
1
1
  class CreateHostgroupsPuppetclasses < ActiveRecord::Migration[6.0]
2
2
  def up
3
- create_table :hostgroups_puppetclasses, id: false, if_not_exists: true do |t|
3
+ # this table is later renamed into hostgroup_classes and thus we don't want to create it if it exists under the later name
4
+ return if table_exists?(:hostgroups_puppetclasses) || table_exists?(:hostgroup_classes)
5
+ create_table :hostgroups_puppetclasses, id: false do |t|
4
6
  t.references :hostgroup, foreign_key: true, null: false
5
7
  t.references :puppetclass, foreign_key: true, null: false
6
8
  end
@@ -147,7 +147,8 @@ Foreman::Plugin.register :foreman_puppet do
147
147
  permission :import_puppetclasses, { 'foreman_puppet/puppetclasses' => %i[import_environments obsolete_and_new],
148
148
  'foreman_puppet/api/v2/environments' => [:import_puppetclasses] },
149
149
  resource_type: 'ForemanPuppet::Puppetclass'
150
- permission :edit_classes, { 'foreman_puppet/api/v2/host_classes': %i[index create destroy] },
150
+ permission :edit_classes, { :host_editing => [:edit_classes],
151
+ 'foreman_puppet/api/v2/host_classes' => %i[index create destroy] },
151
152
  resource_type: 'ForemanPuppet::HostClass'
152
153
  end
153
154
 
@@ -1,3 +1,3 @@
1
1
  module ForemanPuppet
2
- VERSION = '3.0.1'.freeze
2
+ VERSION = '3.0.4'.freeze
3
3
  end