foreman_puppet 1.0.0 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49e644faeeffa930e09b12d75395777a23aa7bec00b9dbdf16eeed14b3d2e9bc
4
- data.tar.gz: 9da4592a03b0fc3431a8f3c12c8bd046782544b5df29419949471b5919388c66
3
+ metadata.gz: 0f4ecdeb14e00d3daed1a47021174874190c39173dbcf50548f8652128cff8c9
4
+ data.tar.gz: ee23eb1076fbf0a2d5a6b95e7d066c4eb88a343b99d039903f9350233095bb89
5
5
  SHA512:
6
- metadata.gz: 2e40390e1c1b70276056a455672397f0425c48fa71dda42cdf814f3718b3869f6b59ab3fa0250acbb5699754a9bdc7ef64640aef07e0cf1388e9b5b4ebc4fe27
7
- data.tar.gz: c6a7e53a32381af7bef757d359e14e5828b3a3536e31f9291fda67af175ca637e971d605c302e479f49bf2e09c9ce8cdcf22494bcd28afe2244f19bbe429f053
6
+ metadata.gz: fa9df4333cfdf456010e4a67e5a7d67c7a198424b471c48a22a04f86ee8896e8be69ffcdcdc8b0b7df87d081cc7773dc13a489fd1586a5924329fbe3adc0742e
7
+ data.tar.gz: 4fc2f8dfccfb68519faed7519b65a8347e156dc776240d66d235c52c36bbed9736755b79bae5407b6bf67c5f8fd46628f126e075099a781b040d0d00a7a87f32
@@ -36,7 +36,7 @@ module ForemanPuppet
36
36
 
37
37
  puppet.puppetclasses = ForemanPuppet::Puppetclass.where(id: params[:hostgroup][:puppetclass_ids])
38
38
  puppet.config_groups = ForemanPuppet::ConfigGroup.where(id: params[:hostgroup][:config_group_ids])
39
- render partial: 'hosts/form_puppet_enc_tab', locals: { host_or_hostgroup: @hostgroup, resource_type: :hostgroup }
39
+ render partial: 'hosts/form_puppet_enc_tab', locals: { subject: @hostgroup, resource_type: :hostgroup }
40
40
  end
41
41
 
42
42
  def puppetclass_parameters
@@ -41,7 +41,7 @@ module ForemanPuppet
41
41
  set_class_variables(@host)
42
42
  ::Taxonomy.as_taxonomy @organization, @location do
43
43
  if @environment || @hostgroup
44
- render partial: 'hosts/form_puppet_enc_tab', locals: { host_or_hostgroup: @host, resource_type: :host }
44
+ render partial: 'hosts/form_puppet_enc_tab', locals: { subject: @host, resource_type: :host }
45
45
  else
46
46
  logger.info 'environment_id or hostgroup_id is required to render puppetclasses'
47
47
  end
@@ -14,12 +14,7 @@ module ForemanPuppet
14
14
  module PatchedClassMethods
15
15
  def host_params_filter
16
16
  super.tap do |filter|
17
- filter.permit :environment_id, :environment_name, :environment,
18
- config_groups: [], config_group_ids: [], config_group_names: [],
19
- puppetclasses: [], puppetclass_ids: [], puppetclass_names: []
20
-
21
- # TODO: bring to core - this is what facets should do, but does not
22
- filter.permit(puppet_attributes: {})
17
+ add_host_puppet_params_filter(filter)
23
18
  end
24
19
  end
25
20
  end
@@ -27,40 +22,54 @@ module ForemanPuppet
27
22
  module PatchedMethods
28
23
  def host_params(*attrs)
29
24
  params = super(*attrs)
30
-
31
- process_deprecated_environment_params!(params)
32
- process_deprecated_attributes!(params)
25
+ process_deprecated_puppet_params!(params)
33
26
  params
34
27
  end
28
+ end
35
29
 
36
- def process_deprecated_environment_params!(params)
37
- env_id = params.delete(:environment_id)
38
- env_name = params.delete(:environment_name)
39
- env = params.delete(:environment)
40
-
41
- return unless env_id || env_name || env
42
- ::Foreman::Deprecation.api_deprecation_warning('param host[environment_*] has been deprecated in favor of host[puppet_attributes][environment_*]')
30
+ class_methods do
31
+ def add_host_puppet_params_filter(filter)
32
+ filter.permit :environment_id, :environment_name, :environment,
33
+ config_groups: [], config_group_ids: [], config_group_names: [],
34
+ puppetclasses: [], puppetclass_ids: [], puppetclass_names: []
43
35
 
44
- params[:puppet_attributes] ||= {}
45
- params[:puppet_attributes][:environment_id] ||= env_id if env_id
46
- params[:puppet_attributes][:environment_name] ||= env_name if env_name
47
- params[:puppet_attributes][:environment] ||= env if env
36
+ # TODO: bring to core - this is what facets should do, but does not
37
+ filter.permit(puppet_attributes: {})
48
38
  end
39
+ end
40
+
41
+ def process_deprecated_puppet_params!(params, top_level_hash = controller_name.singularize)
42
+ process_deprecated_environment_params!(params, top_level_hash)
43
+ process_deprecated_attributes!(params, top_level_hash)
44
+ end
49
45
 
50
- def process_deprecated_attributes!(params)
51
- %w[puppetclass config_group].each do |relation|
52
- ids = params.delete("#{relation}_ids".to_sym)
53
- names = params.delete("#{relation}_names".to_sym)
54
- plains = params.delete(relation.pluralize.to_sym)
46
+ def process_deprecated_environment_params!(params, top_level_hash = 'host')
47
+ env_id = params.delete(:environment_id)
48
+ env_name = params.delete(:environment_name)
49
+ env = params.delete(:environment)
55
50
 
56
- next unless ids || names || plains
57
- ::Foreman::Deprecation.api_deprecation_warning("param host[#{relation}_*] has been deprecated in favor of host[puppet_attributes][#{relation}_*]")
51
+ return unless env_id || env_name || env
52
+ ::Foreman::Deprecation.api_deprecation_warning("param #{top_level_hash}[environment_*] has been deprecated in favor of #{top_level_hash}[puppet_attributes][environment_*]")
58
53
 
59
- params[:puppet_attributes] ||= {}
60
- params[:puppet_attributes]["#{relation}_ids".to_sym] ||= ids if ids
61
- params[:puppet_attributes]["#{relation}_names".to_sym] ||= names if names
62
- params[:puppet_attributes][relation.pluralize.to_sym] ||= plains if plains
63
- end
54
+ params[:puppet_attributes] ||= {}
55
+ params[:puppet_attributes][:environment_id] ||= env_id if env_id
56
+ params[:puppet_attributes][:environment_name] ||= env_name if env_name
57
+ params[:puppet_attributes][:environment] ||= env if env
58
+ end
59
+
60
+ def process_deprecated_attributes!(params, top_level_hash = 'host')
61
+ %w[puppetclass config_group].each do |relation|
62
+ ids = params.delete("#{relation}_ids".to_sym)
63
+ names = params.delete("#{relation}_names".to_sym)
64
+ plains = params.delete(relation.pluralize.to_sym)
65
+
66
+ next unless ids || names || plains
67
+ ::Foreman::Deprecation.api_deprecation_warning("param #{top_level_hash}[#{relation}_*] has been deprecated in favor of #{top_level_hash}[puppet_attributes][#{relation}_*]")
68
+
69
+ params[:puppet_attributes] ||= {}
70
+ params[:puppet_attributes]["#{relation}_ids".to_sym] ||= ids if ids
71
+ params[:puppet_attributes]["#{relation}_names".to_sym] ||= names if names
72
+ params[:puppet_attributes][relation.pluralize.to_sym] ||= plains if plains
64
73
  end
65
74
  end
66
75
  end
@@ -14,12 +14,7 @@ module ForemanPuppet
14
14
  module PatchedClassMethods
15
15
  def hostgroup_params_filter
16
16
  super.tap do |filter|
17
- filter.permit :environment_id, :environment_name,
18
- config_group_ids: [], config_group_names: [],
19
- puppetclass_ids: [], puppetclass_names: []
20
-
21
- # TODO: bring to core - this is what facets should do, but does not
22
- filter.permit(puppet_attributes: {})
17
+ add_hostgroup_puppet_params_filter(filter)
23
18
  end
24
19
  end
25
20
  end
@@ -27,42 +22,56 @@ module ForemanPuppet
27
22
  module PatchedMethods
28
23
  def hostgroup_params(*attrs)
29
24
  params = super(*attrs)
30
-
31
- process_deprecated_hostgroup_environment_params!(params)
32
- process_deprecated_hostgroup_attributes!(params)
25
+ process_deprecated_hostgroup_puppet_params!(params)
33
26
  params
34
27
  end
28
+ end
35
29
 
36
- def process_deprecated_hostgroup_environment_params!(params)
37
- env_id = env_name = nil
38
- if ForemanPuppet.extracted_from_core?
39
- env_id = params.delete(:environment_id)
40
- env_name = params.delete(:environment_name)
41
- else
42
- env_id = params[:environment_id]
43
- env_name = params[:environment_name]
44
- end
30
+ class_methods do
31
+ def add_hostgroup_puppet_params_filter(filter)
32
+ filter.permit :environment_id, :environment_name,
33
+ config_group_ids: [], config_group_names: [],
34
+ puppetclass_ids: [], puppetclass_names: []
45
35
 
46
- return unless env_id || env_name
47
- ::Foreman::Deprecation.api_deprecation_warning('param hostgroup[environment_*] has been deprecated in favor of hostgroup[puppet_attributes][environment_*]')
36
+ # TODO: bring to core - this is what facets should do, but does not
37
+ filter.permit(puppet_attributes: {})
38
+ end
39
+ end
48
40
 
49
- params[:puppet_attributes] ||= {}
50
- params[:puppet_attributes][:environment_id] ||= env_id if env_id
51
- params[:puppet_attributes][:environment_name] ||= env_name if env_name
41
+ def process_deprecated_hostgroup_puppet_params!(params, top_level_hash = 'hostgroup')
42
+ process_deprecated_hostgroup_environment_params!(params, top_level_hash)
43
+ process_deprecated_hostgroup_attributes!(params, top_level_hash)
44
+ end
45
+
46
+ def process_deprecated_hostgroup_environment_params!(params, top_level_hash = 'hostgroup')
47
+ env_id = env_name = nil
48
+ if ForemanPuppet.extracted_from_core?
49
+ env_id = params.delete(:environment_id)
50
+ env_name = params.delete(:environment_name)
51
+ else
52
+ env_id = params[:environment_id]
53
+ env_name = params[:environment_name]
52
54
  end
53
55
 
54
- def process_deprecated_hostgroup_attributes!(params)
55
- %w[puppetclass config_group].each do |relation|
56
- ids = params.delete("#{relation}_ids")
57
- names = params.delete("#{relation}_names")
56
+ return unless env_id || env_name
57
+ ::Foreman::Deprecation.api_deprecation_warning("param #{top_level_hash}[environment_*] has been deprecated in favor of #{top_level_hash}[puppet_attributes][environment_*]")
58
58
 
59
- next unless ids || names
60
- ::Foreman::Deprecation.api_deprecation_warning("param hostgroup[#{relation}_*] has been deprecated in favor of hostgroup[puppet_attributes][#{relation}_*]")
59
+ params[:puppet_attributes] ||= {}
60
+ params[:puppet_attributes][:environment_id] ||= env_id if env_id
61
+ params[:puppet_attributes][:environment_name] ||= env_name if env_name
62
+ end
61
63
 
62
- params[:puppet_attributes] ||= {}
63
- params[:puppet_attributes]["#{relation}_ids".to_sym] ||= ids if ids
64
- params[:puppet_attributes]["#{relation}_names".to_sym] ||= names if names
65
- end
64
+ def process_deprecated_hostgroup_attributes!(params, top_level_hash = 'hostgroup')
65
+ %w[puppetclass config_group].each do |relation|
66
+ ids = params.delete("#{relation}_ids")
67
+ names = params.delete("#{relation}_names")
68
+
69
+ next unless ids || names
70
+ ::Foreman::Deprecation.api_deprecation_warning("param #{top_level_hash}[#{relation}_*] has been deprecated in favor of #{top_level_hash}[puppet_attributes][#{relation}_*]")
71
+
72
+ params[:puppet_attributes] ||= {}
73
+ params[:puppet_attributes]["#{relation}_ids".to_sym] ||= ids if ids
74
+ params[:puppet_attributes]["#{relation}_names".to_sym] ||= names if names
66
75
  end
67
76
  end
68
77
  end
@@ -4,5 +4,9 @@ module ForemanPuppet
4
4
  def hosts_path(*attrs)
5
5
  main_app.hosts_path(*attrs)
6
6
  end
7
+
8
+ def host_config_reports_path(*attrs)
9
+ main_app.host_config_reports_path(*attrs)
10
+ end
7
11
  end
8
12
  end
@@ -0,0 +1,17 @@
1
+ module ForemanPuppet
2
+ module Extensions
3
+ module HostCounter
4
+ extend ActiveSupport::Concern
5
+
6
+ def counted_hosts
7
+ case @association.to_s
8
+ when 'environment'
9
+ hosts_scope = ::Host::Managed.reorder('').joins(:puppet)
10
+ hosts_scope.authorized(:view_hosts).group(HostPuppetFacet.arel_table[:environment_id]).count
11
+ else
12
+ super
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,5 @@
1
1
  <% resource_type ||= pagelet.opts[:resource_type] %>
2
- <% host_or_hostgroup ||= local_assigns[resource_type] %>
3
- <% obj = (host_or_hostgroup.puppet || host_or_hostgroup.build_puppet) if %i[host hostgroup].include?(resource_type) %>
2
+ <% obj = (subject.puppet || subject.build_puppet) if %i[host hostgroup].include?(resource_type) %>
4
3
  <% if resource_type == :host %>
5
4
  <span id="puppet_klasses_reload_url" data-url="<%= foreman_puppet.hostgroup_or_environment_selected_hosts_path %>"></span>
6
5
  <% elsif resource_type == :hostgroup %>
@@ -18,7 +17,7 @@
18
17
  text: _('Please select an environment first')) %>
19
18
  <% end %>
20
19
 
21
- <fieldset id="puppet_klasses_parameters" data-url="<%= foreman_puppet.url_for(action: :puppetclass_parameters, only_path: true) %>">
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) %>">
22
21
  <h2><%= _('Puppet Class Parameters') %></h2>
23
- <%= render 'foreman_puppet/puppetclasses/classes_parameters', obj: host_or_hostgroup %>
22
+ <%= render 'foreman_puppet/puppetclasses/classes_parameters', obj: subject %>
24
23
  </fieldset>
@@ -2,11 +2,11 @@ class MigrateEnvironmentToPuppetFacet < ActiveRecord::Migration[6.0]
2
2
  def up
3
3
  puppet_hostgroups = ::Hostgroup.unscoped.where.not(environment_id: nil).pluck(:id, :environment_id)
4
4
  puppet_hostgroups.map! { |hg_id, env_id| { hostgroup_id: hg_id, environment_id: env_id } }
5
- ForemanPuppet::HostgroupPuppetFacet.insert_all(puppet_hostgroups) if puppet_hostgroups.any?
5
+ ForemanPuppet::HostgroupPuppetFacet.insert_all!(puppet_hostgroups) if puppet_hostgroups.any?
6
6
 
7
7
  puppet_hosts = Host::Managed.unscoped.where.not(environment_id: nil).pluck(:id, :environment_id)
8
8
  puppet_hosts.map! { |host_id, env_id| { host_id: host_id, environment_id: env_id } }
9
- ForemanPuppet::HostPuppetFacet.insert_all(puppet_hosts) if puppet_hosts.any?
9
+ ForemanPuppet::HostPuppetFacet.insert_all!(puppet_hosts) if puppet_hosts.any?
10
10
  end
11
11
 
12
12
  def down
@@ -79,6 +79,8 @@ module ForemanPuppet
79
79
  ::TemplateCombination.include ForemanPuppet::Extensions::TemplateCombination
80
80
  ::ProvisioningTemplate.include ForemanPuppet::Extensions::ProvisioningTemplate
81
81
 
82
+ ::HostCounter.prepend ForemanPuppet::Extensions::HostCounter
83
+
82
84
  ::Api::V2::BaseController.include ForemanPuppet::Extensions::ApiBaseController
83
85
  ::Api::V2::HostsController.include ForemanPuppet::Extensions::ApiV2HostsController
84
86
  ::Api::V2::HostgroupsController.include ForemanPuppet::Extensions::ApiHostgroupsController
@@ -1,3 +1,3 @@
1
1
  module ForemanPuppet
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.4'.freeze
3
3
  end
@@ -4,68 +4,88 @@ module ForemanPuppet
4
4
  class HostgroupsControllerTest < ActionController::TestCase
5
5
  tests ::HostgroupsController
6
6
 
7
- setup do
8
- @routes = ForemanPuppet::Engine.routes
7
+ context 'with core routes' do
8
+ describe '#nest' do
9
+ it 'works without puppetclasses' do
10
+ hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, :with_puppetclass)
11
+
12
+ post :nest, params: { id: hostgroup.id }, session: set_session_user
13
+ assert_template 'new'
14
+ end
15
+
16
+ it 'works with puppetclasses' do
17
+ hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, :with_puppetclass)
18
+
19
+ post :nest, params: { id: hostgroup.id }, session: set_session_user
20
+ assert_template 'new'
21
+ end
22
+ end
9
23
  end
10
24
 
11
- describe '#environment_selected' do
25
+ context 'with plugin routes' do
12
26
  setup do
13
- @environment = FactoryBot.create(:environment)
14
- @puppetclass = FactoryBot.create(:puppetclass)
15
- @hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, environment: @environment)
16
- @params = {
17
- id: @hostgroup.id,
18
- hostgroup: {
19
- name: @hostgroup.name,
20
- environment_id: '',
21
- puppetclass_ids: [@puppetclass.id],
22
- },
23
- }
27
+ @routes = ForemanPuppet::Engine.routes
24
28
  end
25
29
 
26
- test 'should return the selected puppet classes on environment change' do
27
- assert_equal 0, @hostgroup.puppet.puppetclasses.length
28
-
29
- post :environment_selected, params: @params, session: set_session_user, xhr: true
30
- assert_equal(1, assigns(:hostgroup).puppet.puppetclasses.length)
31
- assert_include assigns(:hostgroup).puppet.puppetclasses, @puppetclass
32
- end
30
+ describe '#environment_selected' do
31
+ setup do
32
+ @environment = FactoryBot.create(:environment)
33
+ @puppetclass = FactoryBot.create(:puppetclass)
34
+ @hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, environment: @environment)
35
+ @params = {
36
+ id: @hostgroup.id,
37
+ hostgroup: {
38
+ name: @hostgroup.name,
39
+ environment_id: '',
40
+ puppetclass_ids: [@puppetclass.id],
41
+ },
42
+ }
43
+ end
33
44
 
34
- context 'environment_id param is set' do
35
- test 'it will take the hostgroup params environment_id' do
36
- other_environment = FactoryBot.create(:environment)
37
- @params[:hostgroup][:environment_id] = other_environment.id
45
+ test 'should return the selected puppet classes on environment change' do
46
+ assert_equal 0, @hostgroup.puppet.puppetclasses.length
38
47
 
39
48
  post :environment_selected, params: @params, session: set_session_user, xhr: true
40
- assert_equal assigns(:environment), other_environment
49
+ assert_equal(1, assigns(:hostgroup).puppet.puppetclasses.length)
50
+ assert_include assigns(:hostgroup).puppet.puppetclasses, @puppetclass
41
51
  end
42
- end
43
52
 
44
- test 'should not escape lookup values on environment change' do
45
- hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, environment: @environment, puppetclasses: [@puppetclass])
46
- lookup_key = FactoryBot.create(:puppetclass_lookup_key, :array, default_value: %w[a b],
47
- override: true,
48
- puppetclass: @puppetclass,
49
- overrides: { "hostgroup=#{hostgroup.name}" => %w[c d] })
50
- lookup_value = lookup_key.lookup_values.first
51
- FactoryBot.create(:environment_class, puppetclass: @puppetclass, environment: @environment, puppetclass_lookup_key: lookup_key)
52
-
53
- # sending exactly what the host form would send which is lookup_value.value_before_type_cast
54
- lk = { 'lookup_values_attributes' => { lookup_key.id.to_s => { 'value' => lookup_value.value_before_type_cast,
55
- 'id' => lookup_value.id,
56
- 'lookup_key_id' => lookup_key.id,
57
- '_destroy' => false } } }
58
-
59
- params = {
60
- hostgroup_id: hostgroup.id,
61
- hostgroup: hostgroup.attributes.merge(lk),
62
- }
63
-
64
- # environment change calls puppetclass_parameters which caused the extra escaping
65
- post :puppetclass_parameters, params: params, session: set_session_user, xhr: true
66
-
67
- # if this was escaped during refresh_host the value in response.body after unescapeHTML would include "[\\\"c\\\",\\\"d\\\"]"
68
- assert_includes CGI.unescapeHTML(response.body), '["c","d"]'
53
+ context 'environment_id param is set' do
54
+ test 'it will take the hostgroup params environment_id' do
55
+ other_environment = FactoryBot.create(:environment)
56
+ @params[:hostgroup][:environment_id] = other_environment.id
57
+
58
+ post :environment_selected, params: @params, session: set_session_user, xhr: true
59
+ assert_equal assigns(:environment), other_environment
60
+ end
61
+ end
62
+
63
+ test 'should not escape lookup values on environment change' do
64
+ hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, environment: @environment, puppetclasses: [@puppetclass])
65
+ lookup_key = FactoryBot.create(:puppetclass_lookup_key, :array, default_value: %w[a b],
66
+ override: true,
67
+ puppetclass: @puppetclass,
68
+ overrides: { "hostgroup=#{hostgroup.name}" => %w[c d] })
69
+ lookup_value = lookup_key.lookup_values.first
70
+ FactoryBot.create(:environment_class, puppetclass: @puppetclass, environment: @environment, puppetclass_lookup_key: lookup_key)
71
+
72
+ # sending exactly what the host form would send which is lookup_value.value_before_type_cast
73
+ lk = { 'lookup_values_attributes' => { lookup_key.id.to_s => { 'value' => lookup_value.value_before_type_cast,
74
+ 'id' => lookup_value.id,
75
+ 'lookup_key_id' => lookup_key.id,
76
+ '_destroy' => false } } }
77
+
78
+ params = {
79
+ hostgroup_id: hostgroup.id,
80
+ hostgroup: hostgroup.attributes.merge(lk),
81
+ }
82
+
83
+ # environment change calls puppetclass_parameters which caused the extra escaping
84
+ post :puppetclass_parameters, params: params, session: set_session_user, xhr: true
85
+
86
+ # if this was escaped during refresh_host the value in response.body after unescapeHTML would include "[\\\"c\\\",\\\"d\\\"]"
87
+ assert_includes CGI.unescapeHTML(response.body), '["c","d"]'
88
+ end
69
89
  end
70
90
  end
71
91
  end
@@ -45,6 +45,9 @@ FactoryBot.modify do
45
45
  puppet_proxy do
46
46
  FactoryBot.create(:smart_proxy, features: [FactoryBot.create(:feature, :puppet)])
47
47
  end
48
+ puppet_ca_proxy do
49
+ FactoryBot.create(:smart_proxy, features: [FactoryBot.create(:feature, :puppetca)])
50
+ end
48
51
  end
49
52
 
50
53
  trait :with_config_group do
@@ -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
@@ -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,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
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-10 00:00:00.000000000 Z
12
+ date: 2021-10-27 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Allow assigning Puppet environmets and classes to the Foreman Hosts.
15
15
  email:
@@ -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
@@ -263,6 +264,7 @@ files:
263
264
  - test/models/foreman_puppet/report_test.rb
264
265
  - test/models/foreman_puppet/smart_proxy_test.rb
265
266
  - test/models/foreman_puppet/user_test.rb
267
+ - test/services/foreman_puppet/host_counter_test.rb
266
268
  - test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb
267
269
  - test/services/foreman_puppet/host_info_providers/puppet_info_test.rb
268
270
  - test/services/foreman_puppet/input_type/puppet_parameter_input_test.rb
@@ -296,7 +298,7 @@ homepage: https://github.com/theforeman/foreman_puppet
296
298
  licenses:
297
299
  - GPL-3.0
298
300
  metadata: {}
299
- post_install_message:
301
+ post_install_message:
300
302
  rdoc_options: []
301
303
  require_paths:
302
304
  - lib
@@ -312,13 +314,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
314
  version: '0'
313
315
  requirements: []
314
316
  rubygems_version: 3.1.6
315
- signing_key:
317
+ signing_key:
316
318
  specification_version: 4
317
319
  summary: Adds puppet ENC features
318
320
  test_files:
319
321
  - test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb
320
322
  - test/services/foreman_puppet/host_info_providers/puppet_info_test.rb
321
323
  - test/services/foreman_puppet/input_type/puppet_parameter_input_test.rb
324
+ - test/services/foreman_puppet/host_counter_test.rb
322
325
  - test/integration/foreman_puppet/smartclass_parameter_js_test.rb
323
326
  - test/integration/foreman_puppet/puppetclass_js_test.rb
324
327
  - test/integration/foreman_puppet/hostgroup_js_test.rb