foreman_puppet 0.0.2 → 1.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.
- checksums.yaml +4 -4
- data/README.md +61 -7
- data/app/controllers/concerns/foreman_puppet/environments_import.rb +1 -1
- data/app/controllers/concerns/foreman_puppet/extensions/api_base_controller.rb +28 -0
- data/app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb +1 -1
- data/app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb +1 -1
- data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +1 -1
- data/app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb +3 -10
- data/app/controllers/concerns/foreman_puppet/parameters/puppetclass_lookup_key.rb +2 -2
- data/app/controllers/foreman_puppet/api/v2/config_groups_controller.rb +9 -1
- data/app/controllers/foreman_puppet/api/v2/environments_controller.rb +5 -2
- data/app/controllers/foreman_puppet/api/v2/host_classes_controller.rb +9 -1
- data/app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb +9 -1
- data/app/controllers/foreman_puppet/api/v2/override_values_controller.rb +1 -2
- data/app/controllers/foreman_puppet/api/v2/{base_controller.rb → puppet_base_controller.rb} +3 -4
- data/app/controllers/foreman_puppet/api/v2/{lookups_common_controller.rb → puppet_lookups_common_controller.rb} +6 -2
- data/app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb +5 -1
- data/app/controllers/foreman_puppet/api/v2/smart_class_parameters_controller.rb +1 -2
- data/app/controllers/foreman_puppet/config_groups_controller.rb +4 -0
- data/app/controllers/foreman_puppet/puppet_smart_proxies_controller.rb +4 -0
- data/app/controllers/foreman_puppet/puppetclass_lookup_keys_controller.rb +2 -2
- data/app/controllers/foreman_puppet/puppetclasses_controller.rb +12 -4
- data/app/graphgl/concerns/foreman_puppet/mutations/hosts/create_extensions.rb +29 -0
- data/app/graphgl/concerns/foreman_puppet/types/host_extensions.rb +13 -0
- data/app/graphgl/concerns/foreman_puppet/types/hostgroup_extensions.rb +13 -0
- data/app/graphgl/concerns/foreman_puppet/types/interface_attributes_input_extensions.rb +9 -0
- data/app/graphgl/concerns/foreman_puppet/types/location_extensions.rb +14 -0
- data/app/graphgl/concerns/foreman_puppet/types/organization_extensions.rb +14 -0
- data/app/graphgl/foreman_puppet/types/environment.rb +20 -0
- data/app/graphgl/foreman_puppet/types/puppetclass.rb +20 -0
- data/app/helpers/foreman_puppet/environments_helper.rb +1 -1
- data/app/helpers/foreman_puppet/hosts_helper.rb +15 -0
- data/app/helpers/foreman_puppet/puppetclass_lookup_keys_helper.rb +2 -2
- data/app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb +1 -1
- data/app/helpers/foreman_puppet/puppetclasses_helper.rb +2 -2
- data/app/models/concerns/foreman_puppet/extensions/host.rb +24 -9
- data/app/models/concerns/foreman_puppet/extensions/host_common.rb +17 -0
- data/app/models/concerns/foreman_puppet/extensions/hostgroup.rb +13 -7
- data/app/models/concerns/foreman_puppet/extensions/operatingsystem.rb +1 -1
- data/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb +19 -13
- data/app/models/concerns/foreman_puppet/extensions/report.rb +18 -0
- data/app/models/concerns/foreman_puppet/extensions/taxonomy.rb +1 -1
- data/app/models/concerns/foreman_puppet/extensions/template_combination.rb +1 -1
- data/app/models/concerns/foreman_puppet/extensions/user.rb +19 -12
- data/app/models/foreman_puppet/environment.rb +2 -0
- data/app/models/foreman_puppet/environment_class.rb +1 -1
- data/app/models/foreman_puppet/host_class.rb +1 -1
- data/app/models/foreman_puppet/host_puppet_facet.rb +6 -5
- data/app/models/foreman_puppet/hostgroup_puppet_facet.rb +1 -1
- data/app/models/{concerns/foreman_puppet/host_common.rb → foreman_puppet/puppet_facet_common.rb} +1 -1
- data/app/models/foreman_puppet/puppetclass.rb +15 -1
- data/app/{views/api/v2/template_combinations/base.json.erb → prepend_views/api/v2/template_combinations/base.json.rabl} +0 -0
- data/app/services/foreman_puppet/host_info_providers/config_groups_info.rb +2 -0
- data/app/services/foreman_puppet/puppet_class_importer.rb +17 -18
- data/app/views/foreman_puppet/common/_puppetclasses_or_envs_changed.html.erb +62 -0
- data/app/views/foreman_puppet/config_groups/index.html.erb +2 -2
- data/app/views/foreman_puppet/config_groups/welcome.html.erb +12 -11
- data/app/views/foreman_puppet/environments/index.html.erb +1 -1
- data/app/views/foreman_puppet/environments/welcome.html.erb +3 -15
- data/app/views/foreman_puppet/puppetclass_lookup_keys/welcome.html.erb +10 -8
- data/app/views/foreman_puppet/puppetclasses/_classes.html.erb +1 -1
- data/app/views/foreman_puppet/puppetclasses/_selected_classes.html.erb +1 -1
- data/app/views/foreman_puppet/puppetclasses/index.html.erb +1 -1
- data/app/views/hosts/_form_puppet_enc_tab.html.erb +1 -1
- data/app/views/hosts/select_multiple_environment.html.erb +1 -1
- data/app/views/smart_proxies/plugins/_puppet_ca.html.erb +44 -0
- data/config/initializers/api_reroute.rb +13 -0
- data/db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb +37 -12
- data/db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb +13 -1
- data/lib/foreman_puppet/engine.rb +68 -20
- data/lib/foreman_puppet/register.rb +7 -2
- data/lib/foreman_puppet/version.rb +1 -1
- data/lib/foreman_puppet.rb +3 -3
- data/locale/Makefile +1 -1
- data/locale/en/LC_MESSAGES/foreman_puppet.mo +0 -0
- data/locale/en/foreman_puppet.edit.po +19 -3
- data/locale/en/foreman_puppet.po +18 -6
- data/locale/en/foreman_puppet.pox +0 -0
- data/locale/foreman_puppet.pot +19 -3
- data/locale/messages.mo +0 -0
- data/test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb +7 -3
- data/test/controllers/foreman_puppet/api/v2/environments_controller_test.rb +18 -16
- data/test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb +3 -2
- data/test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb +1 -1
- data/test/controllers/foreman_puppet/api/v2/provisioning_templates_controller_test.rb +32 -0
- data/test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb +3 -0
- data/test/controllers/foreman_puppet/api/v2/smart_class_parameters_controller_test.rb +7 -1
- data/test/controllers/foreman_puppet/api/v2/template_combinations_controller_test.rb +2 -2
- data/test/controllers/foreman_puppet/config_groups_controller_test.rb +7 -3
- data/test/controllers/foreman_puppet/environments_controller_test.rb +2 -2
- data/test/controllers/foreman_puppet/puppetclass_lookup_keys_controller_test.rb +2 -2
- data/test/controllers/foreman_puppet/puppetclasses_controller_test.rb +5 -6
- data/test/factories/foreman_puppet_factories.rb +3 -0
- data/test/factories/host_puppet_enhancements.rb +6 -6
- data/test/graphql/mutations/hosts/create_mutation_test.rb +87 -0
- data/test/graphql/queries/environment_query_test.rb +54 -0
- data/test/graphql/queries/environments_query_test.rb +43 -0
- data/test/{qraphql → graphql}/queries/host_puppet_query_test.rb +3 -8
- data/test/{qraphql → graphql}/queries/hostgroup_puppet_query_test.rb +1 -6
- data/test/graphql/queries/location_query_test.rb +52 -0
- data/test/graphql/queries/organization_query_test.rb +52 -0
- data/test/graphql/queries/puppetclass_query_test.rb +68 -0
- data/test/graphql/queries/puppetclasses_query_test.rb +43 -0
- data/test/integration/foreman_puppet/environment_js_test.rb +4 -1
- data/test/integration/foreman_puppet/host_js_test.rb +1 -1
- data/test/integration/foreman_puppet/puppetclass_js_test.rb +4 -0
- data/test/models/foreman_puppet/config_group_class_test.rb +3 -1
- data/test/models/foreman_puppet/environment_test.rb +2 -0
- data/test/models/foreman_puppet/host_puppet_facet_test.rb +34 -1
- data/test/models/foreman_puppet/host_test.rb +4 -3
- data/test/models/foreman_puppet/hostgroup_puppet_facet_test.rb +2 -3
- data/test/models/foreman_puppet/provisioning_template_test.rb +14 -7
- data/test/models/foreman_puppet/report_test.rb +21 -0
- data/test/models/foreman_puppet/smart_proxy_test.rb +1 -1
- data/test/models/foreman_puppet/user_test.rb +37 -0
- data/test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb +35 -0
- data/test/services/foreman_puppet/host_info_providers/puppet_info_test.rb +159 -197
- data/test/unit/foreman_puppet/puppet_class_importer_test.rb +16 -2
- data/webpack/index.js +3 -4
- data/webpack/src/Components/Environments/Welcome.js +37 -0
- metadata +51 -12
|
@@ -5,7 +5,7 @@ module ForemanPuppet
|
|
|
5
5
|
|
|
6
6
|
included do
|
|
7
7
|
if ForemanPuppet.extracted_from_core?
|
|
8
|
-
belongs_to :environment
|
|
8
|
+
belongs_to :environment, class_name: 'ForemanPuppet::Environment'
|
|
9
9
|
|
|
10
10
|
validates :environment_id, uniqueness: { scope: %i[hostgroup_id provisioning_template_id] }
|
|
11
11
|
|
|
@@ -3,19 +3,26 @@ module ForemanPuppet
|
|
|
3
3
|
module User
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
result
|
|
6
|
+
included do
|
|
7
|
+
prepend PatchedMethods
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
module PatchedMethods
|
|
11
|
+
def visible_environments
|
|
12
|
+
authorized_scope = ForemanPuppet::Environment.unscoped.authorized(:view_environments)
|
|
13
|
+
authorized_scope = authorized_scope
|
|
14
|
+
.joins(:taxable_taxonomies)
|
|
15
|
+
.where('taxable_taxonomies.taxonomy_id' => taxonomy_ids[:organizations] + taxonomy_ids[:locations])
|
|
16
|
+
result = authorized_scope.distinct.pluck(:name)
|
|
17
|
+
if ::User.current.admin?
|
|
18
|
+
# Admin users can also see Environments that do not have any organization or location, even when
|
|
19
|
+
# organizations and locations are enabled.
|
|
20
|
+
untaxed_env_ids = TaxableTaxonomy.where(taxable_type: 'ForemanPuppet::Environment').distinct.select(:taxable_id)
|
|
21
|
+
untaxed_environments = ForemanPuppet::Environment.unscoped.where.not(id: untaxed_env_ids).pluck(:name)
|
|
22
|
+
result += untaxed_environments
|
|
23
|
+
end
|
|
24
|
+
result
|
|
17
25
|
end
|
|
18
|
-
result
|
|
19
26
|
end
|
|
20
27
|
end
|
|
21
28
|
end
|
|
@@ -6,7 +6,7 @@ module ForemanPuppet
|
|
|
6
6
|
belongs_to :puppetclass, inverse_of: :environment_classes
|
|
7
7
|
belongs_to :puppetclass_lookup_key, inverse_of: :environment_classes, class_name: 'ForemanPuppet::PuppetclassLookupKey'
|
|
8
8
|
validates :puppetclass_lookup_key_id, uniqueness: { scope: %i[environment_id puppetclass_id] }
|
|
9
|
-
validates :
|
|
9
|
+
validates :puppetclass, :environment, presence: true
|
|
10
10
|
after_destroy :delete_orphaned_lookup_keys
|
|
11
11
|
|
|
12
12
|
scope :parameters_for_class, lambda { |puppetclasses_ids, environment_id|
|
|
@@ -4,9 +4,9 @@ module ForemanPuppet
|
|
|
4
4
|
audited associated_with: :host
|
|
5
5
|
|
|
6
6
|
include Facets::Base
|
|
7
|
-
include ForemanPuppet::
|
|
7
|
+
include ForemanPuppet::PuppetFacetCommon
|
|
8
8
|
|
|
9
|
-
has_many :host_classes, dependent: :destroy
|
|
9
|
+
has_many :host_classes, dependent: :destroy, class_name: 'ForemanPuppet::HostClass'
|
|
10
10
|
has_many :puppetclasses, through: :host_classes
|
|
11
11
|
|
|
12
12
|
validates :environment_id, presence: true, unless: ->(facet) { facet.host.puppet_proxy_id.blank? }
|
|
@@ -18,10 +18,11 @@ module ForemanPuppet
|
|
|
18
18
|
type ||= 'puppet'
|
|
19
19
|
return unless type == 'puppet'
|
|
20
20
|
|
|
21
|
+
facet = host.puppet || host.build_puppet
|
|
21
22
|
if Setting[:update_environment_from_facts]
|
|
22
|
-
|
|
23
|
+
facet.environment = parser.environment if parser.environment.present?
|
|
23
24
|
elsif parser.environment.present?
|
|
24
|
-
|
|
25
|
+
facet.environment ||= parser.environment
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
# if proxy authentication is enabled and we have no puppet proxy set and the upload came from puppet,
|
|
@@ -42,7 +43,7 @@ module ForemanPuppet
|
|
|
42
43
|
# the environment used by #clases nees to be self.environment and not self.parent.environment
|
|
43
44
|
def parent_classes
|
|
44
45
|
return [] unless host.hostgroup
|
|
45
|
-
host.hostgroup.puppet&.classes(environment)
|
|
46
|
+
host.hostgroup.puppet&.classes(environment) || []
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
def parent_config_groups
|
|
@@ -61,7 +61,7 @@ module ForemanPuppet
|
|
|
61
61
|
audited associated_with: :hostgroup
|
|
62
62
|
self.table_name = 'hostgroup_puppet_facets'
|
|
63
63
|
|
|
64
|
-
include ForemanPuppet::
|
|
64
|
+
include ForemanPuppet::PuppetFacetCommon
|
|
65
65
|
include Facets::HostgroupFacet
|
|
66
66
|
|
|
67
67
|
has_many :hostgroup_classes, dependent: :destroy
|
|
@@ -2,6 +2,8 @@ module ForemanPuppet
|
|
|
2
2
|
class Puppetclass < ApplicationRecord
|
|
3
3
|
self.table_name = 'puppetclasses'
|
|
4
4
|
|
|
5
|
+
graphql_type 'ForemanPuppet::Types::Puppetclass'
|
|
6
|
+
|
|
5
7
|
audited
|
|
6
8
|
include Authorizable
|
|
7
9
|
include ScopedSearchExtensions
|
|
@@ -29,6 +31,7 @@ module ForemanPuppet
|
|
|
29
31
|
has_many :config_groups, through: :config_group_classes
|
|
30
32
|
|
|
31
33
|
has_many :class_params, -> { distinct }, through: :environment_classes, source: :puppetclass_lookup_key
|
|
34
|
+
accepts_nested_attributes_for :environment_classes
|
|
32
35
|
accepts_nested_attributes_for :class_params, reject_if: ->(a) { a[:key].blank? }, allow_destroy: true
|
|
33
36
|
|
|
34
37
|
validates :name, uniqueness: true, presence: true, no_whitespace: true
|
|
@@ -72,6 +75,17 @@ module ForemanPuppet
|
|
|
72
75
|
hash
|
|
73
76
|
end
|
|
74
77
|
|
|
78
|
+
# For Audits to be correctly taxed for Puppetclass creation
|
|
79
|
+
# Puppetclass gets saved before the environment class and thus taxonomy ids are empty
|
|
80
|
+
# We collect the ids from unsaved environment_classes for the Audits correct taxation
|
|
81
|
+
def location_ids
|
|
82
|
+
environment_classes.select(&:new_record?).flat_map { |ec| ec.environment.location_ids }.concat(super).uniq
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def organization_ids
|
|
86
|
+
environment_classes.select(&:new_record?).flat_map { |ec| ec.environment.organization_ids }.concat(super).uniq
|
|
87
|
+
end
|
|
88
|
+
|
|
75
89
|
# returns module name (excluding of the class name)
|
|
76
90
|
# if class separator does not exists (the "::" chars), then returns the whole class name
|
|
77
91
|
def module_name
|
|
@@ -106,7 +120,7 @@ module ForemanPuppet
|
|
|
106
120
|
# We are going through two associations, so we are on our own to define modifiers
|
|
107
121
|
def hostgroup_ids=(hg_ids)
|
|
108
122
|
hg_ids = Array(hg_ids).reject(&:blank?)
|
|
109
|
-
hg_to_facets_ids =
|
|
123
|
+
hg_to_facets_ids = HostgroupPuppetFacet.where(hostgroup_id: hg_ids).pluck(:hostgroup_id, :id).to_h
|
|
110
124
|
missing_facet_ids = hg_ids.map(&:to_i) - hg_to_facets_ids.keys
|
|
111
125
|
new_facet_ids = missing_facet_ids.map { |hg_id| HostgroupPuppetFacet.create(hostgroup_id: hg_id).id }
|
|
112
126
|
self.hostgroup_puppet_facet_ids = hg_to_facets_ids.values + new_facet_ids
|
|
File without changes
|
|
@@ -2,6 +2,8 @@ module ForemanPuppet
|
|
|
2
2
|
module HostInfoProviders
|
|
3
3
|
class ConfigGroupsInfo < HostInfo::Provider
|
|
4
4
|
def host_info
|
|
5
|
+
return {} unless host.puppet
|
|
6
|
+
|
|
5
7
|
config_groups = (host.puppet.config_groups + host.puppet.parent_config_groups).uniq.map(&:name)
|
|
6
8
|
{ 'parameters' => { 'foreman_config_groups' => config_groups } }
|
|
7
9
|
end
|
|
@@ -162,7 +162,7 @@ module ForemanPuppet
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
def db_environments
|
|
165
|
-
@db_environments ||= (Environment.pluck(
|
|
165
|
+
@db_environments ||= (Environment.pluck(:name) - ignored_environments)
|
|
166
166
|
end
|
|
167
167
|
|
|
168
168
|
def actual_environments
|
|
@@ -248,15 +248,11 @@ module ForemanPuppet
|
|
|
248
248
|
end
|
|
249
249
|
|
|
250
250
|
def add_classes_to_foreman(env_name, klasses)
|
|
251
|
-
env
|
|
252
|
-
# look for Puppet class in all scopes to make sure we do not try to create a new record
|
|
253
|
-
# with a name that already exists and hit the uniqueness constraint on name
|
|
254
|
-
new_classes = klasses.map { |k| find_or_create_puppetclass(name: k[0]) }
|
|
251
|
+
env = find_or_create_env env_name
|
|
255
252
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
add_new_parameter(env, new_class, class_params) if class_params.any?
|
|
253
|
+
klasses.each do |klass_name, klass_params|
|
|
254
|
+
puppetclass = find_or_create_puppetclass_for_env(klass_name, env)
|
|
255
|
+
add_new_parameter(env, puppetclass, klass_params) if klass_params.any?
|
|
260
256
|
end
|
|
261
257
|
end
|
|
262
258
|
|
|
@@ -302,7 +298,7 @@ module ForemanPuppet
|
|
|
302
298
|
changed_params['new'].map do |param_name, value|
|
|
303
299
|
param = find_or_create_puppet_class_param klass, param_name, value
|
|
304
300
|
EnvironmentClass.find_or_create_by! puppetclass_id: klass.id, environment_id: env.id,
|
|
305
|
-
|
|
301
|
+
puppetclass_lookup_key_id: param.id
|
|
306
302
|
end
|
|
307
303
|
end
|
|
308
304
|
|
|
@@ -317,10 +313,9 @@ module ForemanPuppet
|
|
|
317
313
|
Host.where(environment_id: env).update_all(environment_id: nil)
|
|
318
314
|
Hostgroup.where(environment_id: env).update_all(environment_id: nil)
|
|
319
315
|
# rubocop:enable Rails/SkipsModelValidations
|
|
320
|
-
|
|
321
|
-
# we can't guaranty that the env would be removed as it might have hosts attached to it.
|
|
322
|
-
env.destroy if klasses.include? '_destroy_'
|
|
323
316
|
end
|
|
317
|
+
# we can't guaranty that the env would be removed as it might have hosts attached to it.
|
|
318
|
+
env.destroy if klasses.include? '_destroy_'
|
|
324
319
|
# remove all klasses that have no environment now
|
|
325
320
|
classes.not_in_any_environment.destroy_all
|
|
326
321
|
end
|
|
@@ -331,8 +326,8 @@ module ForemanPuppet
|
|
|
331
326
|
|
|
332
327
|
def find_or_create_env(env)
|
|
333
328
|
user_visible_environment(env) || Environment.create!(name: env,
|
|
334
|
-
|
|
335
|
-
|
|
329
|
+
organizations: User.current.my_organizations,
|
|
330
|
+
locations: User.current.my_locations)
|
|
336
331
|
end
|
|
337
332
|
|
|
338
333
|
def user_visible_environment(env)
|
|
@@ -343,11 +338,15 @@ module ForemanPuppet
|
|
|
343
338
|
def find_or_create_puppet_class_param(klass, param_name, value)
|
|
344
339
|
klass.class_params.where(key: param_name).first ||
|
|
345
340
|
PuppetclassLookupKey.create!(key: param_name, default_value: value,
|
|
346
|
-
|
|
341
|
+
key_type: Foreman::ImporterPuppetclass.suggest_key_type(value))
|
|
347
342
|
end
|
|
348
343
|
|
|
349
|
-
def
|
|
350
|
-
|
|
344
|
+
def find_or_create_puppetclass_for_env(klass_name, env)
|
|
345
|
+
# look for Puppet class in all scopes to make sure we do not try to create a new record
|
|
346
|
+
# with a name that already exists and hit the uniqueness constraint on name
|
|
347
|
+
puppetclass = Puppetclass.find_or_initialize_by(name: klass_name)
|
|
348
|
+
puppetclass.environment_classes.find_or_initialize_by(environment_id: env.id)
|
|
349
|
+
puppetclass.save
|
|
351
350
|
raise Foreman::Exception.new('Failed to create Puppetclass: %s', puppetclass.errors.full_messages.to_sentence) unless puppetclass.errors.empty?
|
|
352
351
|
puppetclass
|
|
353
352
|
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<% title _("Changed environments") %>
|
|
2
|
+
<%= form_tag controller.send("obsolete_and_new_#{controller_name}_path") do %>
|
|
3
|
+
<h4><%= _("Select the changes you want to apply to Foreman") %></h4>
|
|
4
|
+
<h6>
|
|
5
|
+
<%= _("Toggle") %>:
|
|
6
|
+
<%= link_to_function(icon_text("check", _("New")),
|
|
7
|
+
"toggleCheckboxesBySelector('.env_select_boxes_new')",
|
|
8
|
+
:title => _("Check/Uncheck new")) %> |
|
|
9
|
+
<%= link_to_function(icon_text("check", _("Updated")),
|
|
10
|
+
"toggleCheckboxesBySelector('.env_select_boxes_updated')",
|
|
11
|
+
:title => _("Check/Uncheck updated")) %> |
|
|
12
|
+
<%= link_to_function(icon_text("check", _("Obsolete")),
|
|
13
|
+
"toggleCheckboxesBySelector('.env_select_boxes_obsolete')",
|
|
14
|
+
:title => _("Check/Uncheck obsolete")) %>
|
|
15
|
+
</h6>
|
|
16
|
+
<table class="<%= table_css_classes %>">
|
|
17
|
+
<thead>
|
|
18
|
+
<tr>
|
|
19
|
+
<th class="ca">
|
|
20
|
+
<%= link_to_function(icon_text("check"),
|
|
21
|
+
"toggleCheckboxesBySelector('.env_select_boxes')",
|
|
22
|
+
:title => _("Check/Uncheck all")) %>
|
|
23
|
+
</th>
|
|
24
|
+
<th><%= _("Environment") %></th>
|
|
25
|
+
<th><%= _("Operation") %></th>
|
|
26
|
+
<th><%= _("Puppet Modules") %></th>
|
|
27
|
+
</tr>
|
|
28
|
+
</thead>
|
|
29
|
+
<tbody>
|
|
30
|
+
<% for kind in ["new", "obsolete", "updated", "ignored"] %>
|
|
31
|
+
<% unless (envs = @changed[kind]).empty? %>
|
|
32
|
+
<% for env in envs.keys.sort %>
|
|
33
|
+
<tr>
|
|
34
|
+
<% unless kind == 'ignored' %>
|
|
35
|
+
<td>
|
|
36
|
+
<%= check_box_tag "changed[#{kind}][#{env}]", @changed[kind][env].to_json, false, :class => "env_select_boxes env_select_boxes_#{kind} env_select_boxes_env_#{env}" %>
|
|
37
|
+
</td>
|
|
38
|
+
<td>
|
|
39
|
+
<%= link_to_function("#{env}", "toggleCheckboxesBySelector('.env_select_boxes_env_#{env}')", :title => _("Check/Uncheck all %s changes") % env) %>
|
|
40
|
+
</td>
|
|
41
|
+
<% else %>
|
|
42
|
+
<td> </td>
|
|
43
|
+
<td><%= env %></td>
|
|
44
|
+
<% end %>
|
|
45
|
+
<td>
|
|
46
|
+
<%= {"new" => _("Add:"), "obsolete" => _("Remove:"), "updated" => _("Update:"), "ignored" => _("Ignored:")}[kind] %>
|
|
47
|
+
</td>
|
|
48
|
+
<td>
|
|
49
|
+
<% pcs = @changed[kind][env] %>
|
|
50
|
+
<%= class_update_text pcs, env %>
|
|
51
|
+
</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<% end %>
|
|
54
|
+
<% end %>
|
|
55
|
+
<% end %>
|
|
56
|
+
</tbody>
|
|
57
|
+
</table>
|
|
58
|
+
<div>
|
|
59
|
+
<%= link_to _("Cancel"), controller.send("#{controller_name}_path"), :class => "btn btn-default" %>
|
|
60
|
+
<%= submit_tag _("Update"), :class => "btn btn-primary" %>
|
|
61
|
+
</div>
|
|
62
|
+
<% end %>
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
<tbody>
|
|
18
18
|
<% @config_groups.each do |config_group| %>
|
|
19
19
|
<tr>
|
|
20
|
-
<td class="ellipsis"><%= link_to_if_authorized config_group.name, hash_for_edit_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer) %></td>
|
|
20
|
+
<td class="ellipsis"><%= link_to_if_authorized config_group.name, hash_for_edit_config_group_path(config_group).merge(engine: foreman_puppet, :auth_object => config_group, :authorizer => authorizer) %></td>
|
|
21
21
|
<td><%= link_to config_group.puppetclasses.size, puppetclasses_path(:search => %Q{config_group = "#{config_group}"}) %></td>
|
|
22
22
|
<td><%= link_to config_group.hosts_count, main_app.hosts_path(:search => %Q{config_group = "#{config_group}"}) %></td>
|
|
23
23
|
<td><%= link_to config_group.hostgroups_count, main_app.hostgroups_path(:search => %Q{config_group = "#{config_group}"}) %></td>
|
|
24
24
|
<td><%= action_buttons(
|
|
25
|
-
display_delete_if_authorized(hash_for_config_group_path(config_group).merge(:auth_object => config_group, :authorizer => authorizer), :data => { :confirm => _('Delete %s?') % config_group.name }))%>
|
|
25
|
+
display_delete_if_authorized(hash_for_config_group_path(config_group).merge(engine: foreman_puppet, :auth_object => config_group, :authorizer => authorizer), :data => { :confirm => _('Delete %s?') % config_group.name }))%>
|
|
26
26
|
</td>
|
|
27
27
|
</tr>
|
|
28
28
|
<% end %>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<% title _("Config Groups") %>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
|
|
3
|
+
<%= webpacked_plugins_js_for :foreman_puppet %>
|
|
4
|
+
<% description = _("A config group provides a one-step method of associating many Puppet classes to either a host or host group. Typically this would be used to add a particular application profile or stack in one step.")%>
|
|
5
|
+
<% action = { :title => _("Create Config Group"), :url => new_config_group_path } if authorized_for(:action => :new)%>
|
|
6
|
+
<%= react_component('EmptyState', {
|
|
7
|
+
:icon => 'object-group',
|
|
8
|
+
:iconType => 'fa',
|
|
9
|
+
:header => _('Config Groups'),
|
|
10
|
+
:description => description,
|
|
11
|
+
:documentation => { :url => documentation_url("using-config-groups") },
|
|
12
|
+
:action => action
|
|
13
|
+
}) %>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<td>
|
|
21
21
|
<%= action_buttons(
|
|
22
22
|
link_to(_('Classes'), puppetclasses_path(search: "environment = #{environment}")),
|
|
23
|
-
import_proxy_links(hash_for_import_environments_environments_path(env: environment)),
|
|
23
|
+
import_proxy_links(hash_for_import_environments_environments_path(env: environment).merge(engine: foreman_puppet)),
|
|
24
24
|
display_delete_if_authorized(hash_for_environment_path(environment).merge(engine: foreman_puppet, auth_object: environment, authorizer: authorizer),
|
|
25
25
|
data: { confirm: "Delete #{environment.name}?" })
|
|
26
26
|
) %>
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
<% content_for(:title, _("Puppet environments")) %>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</div>
|
|
6
|
-
<h1><%= _('Environments') %></h1>
|
|
7
|
-
<p><%= _("If you are planning to use Foreman as an external node classifier you should provide information about one or more environments. This information is commonly imported from a pre-existing Puppet configuration by the use of the %{link_start}Puppet classes and environment importer%{link_end}.").html_safe % { link_start: tag(:a, href: documentation_url("4.2.2Classes"), rel: 'external'), link_end: '</a>'.html_safe } %>
|
|
8
|
-
</p>
|
|
9
|
-
<p><%= link_to(_('Learn more about this in the documentation.'), documentation_url("4.2.1Environments")) %></p>
|
|
10
|
-
<div class="blank-slate-pf-main-action">
|
|
11
|
-
<%= new_link(_('Create Puppet Environment'), { engine: foreman_puppet }, { class: "btn-lg" }) %>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="blank-slate-pf-secondary-action">
|
|
14
|
-
<%= import_proxy_select(hash_for_import_environments_environments_path) %>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
2
|
+
|
|
3
|
+
<%= webpacked_plugins_js_for :foreman_puppet %>
|
|
4
|
+
<%= react_component('WelcomeEnv', {canCreate: authorized_for(action: :new)}) %>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<% title _("Smart Class Parameters") %>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
<%= webpacked_plugins_js_for :foreman_puppet %>
|
|
4
|
+
<% description = _("Parameterized class support permits detecting, importing, and supplying parameters directly to classes which support it, via the ENC and depending on a set of rules (Smart Matchers).")%>
|
|
5
|
+
<%= react_component('EmptyState', {
|
|
6
|
+
:icon => 'info-circle',
|
|
7
|
+
:iconType => 'fa',
|
|
8
|
+
:header => _('Smart Class Parameters'),
|
|
9
|
+
:description => description,
|
|
10
|
+
:documentation => { :url => documentation_url("4.2.5ParameterizedClasses") },
|
|
11
|
+
}) %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%= content_tag :li, id: "
|
|
1
|
+
<%= content_tag :li, id: "selected_puppetclass_#{klass.id}", class: [dom_class(klass, 'selected'), cycle('even', 'odd'), ('unavailable' unless klass.environments.include?(@environment))] do %>
|
|
2
2
|
<%= link_to_remove_puppetclass(klass, obj) %>
|
|
3
3
|
<%= hidden_field_tag "#{resource_type}[puppetclass_ids][]", klass.id %>
|
|
4
4
|
<% end %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% title _("Puppet Classes") %>
|
|
2
2
|
|
|
3
|
-
<% title_actions import_proxy_select(hash_for_import_environments_puppetclasses_path),
|
|
3
|
+
<% title_actions import_proxy_select(hash_for_import_environments_puppetclasses_path.merge(engine: foreman_puppet)),
|
|
4
4
|
documentation_button('4.2.2Classes') %>
|
|
5
5
|
|
|
6
6
|
<table class="<%= table_css_classes 'table-fixed' %>">
|