foreman_puppet 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -7
  3. data/app/controllers/concerns/foreman_puppet/environments_import.rb +1 -1
  4. data/app/controllers/concerns/foreman_puppet/extensions/api_base_controller.rb +28 -0
  5. data/app/controllers/concerns/foreman_puppet/extensions/api_template_combinations_controller.rb +1 -1
  6. data/app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb +1 -1
  7. data/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb +1 -1
  8. data/app/controllers/concerns/foreman_puppet/extensions/parameters_host.rb +3 -10
  9. data/app/controllers/concerns/foreman_puppet/parameters/puppetclass_lookup_key.rb +2 -2
  10. data/app/controllers/foreman_puppet/api/v2/config_groups_controller.rb +9 -1
  11. data/app/controllers/foreman_puppet/api/v2/environments_controller.rb +5 -2
  12. data/app/controllers/foreman_puppet/api/v2/host_classes_controller.rb +9 -1
  13. data/app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb +9 -1
  14. data/app/controllers/foreman_puppet/api/v2/override_values_controller.rb +1 -2
  15. data/app/controllers/foreman_puppet/api/v2/{base_controller.rb → puppet_base_controller.rb} +3 -4
  16. data/app/controllers/foreman_puppet/api/v2/{lookups_common_controller.rb → puppet_lookups_common_controller.rb} +6 -2
  17. data/app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb +5 -1
  18. data/app/controllers/foreman_puppet/api/v2/smart_class_parameters_controller.rb +1 -2
  19. data/app/controllers/foreman_puppet/config_groups_controller.rb +4 -0
  20. data/app/controllers/foreman_puppet/puppet_smart_proxies_controller.rb +4 -0
  21. data/app/controllers/foreman_puppet/puppetclass_lookup_keys_controller.rb +2 -2
  22. data/app/controllers/foreman_puppet/puppetclasses_controller.rb +12 -4
  23. data/app/graphgl/concerns/foreman_puppet/mutations/hosts/create_extensions.rb +29 -0
  24. data/app/graphgl/concerns/foreman_puppet/types/host_extensions.rb +13 -0
  25. data/app/graphgl/concerns/foreman_puppet/types/hostgroup_extensions.rb +13 -0
  26. data/app/graphgl/concerns/foreman_puppet/types/interface_attributes_input_extensions.rb +9 -0
  27. data/app/graphgl/concerns/foreman_puppet/types/location_extensions.rb +14 -0
  28. data/app/graphgl/concerns/foreman_puppet/types/organization_extensions.rb +14 -0
  29. data/app/graphgl/foreman_puppet/types/environment.rb +20 -0
  30. data/app/graphgl/foreman_puppet/types/puppetclass.rb +20 -0
  31. data/app/helpers/foreman_puppet/environments_helper.rb +1 -1
  32. data/app/helpers/foreman_puppet/hosts_helper.rb +15 -0
  33. data/app/helpers/foreman_puppet/puppetclass_lookup_keys_helper.rb +2 -2
  34. data/app/helpers/foreman_puppet/puppetclasses_and_environments_helper.rb +1 -1
  35. data/app/helpers/foreman_puppet/puppetclasses_helper.rb +2 -2
  36. data/app/models/concerns/foreman_puppet/extensions/host.rb +24 -9
  37. data/app/models/concerns/foreman_puppet/extensions/host_common.rb +17 -0
  38. data/app/models/concerns/foreman_puppet/extensions/hostgroup.rb +13 -7
  39. data/app/models/concerns/foreman_puppet/extensions/operatingsystem.rb +1 -1
  40. data/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb +19 -13
  41. data/app/models/concerns/foreman_puppet/extensions/report.rb +18 -0
  42. data/app/models/concerns/foreman_puppet/extensions/taxonomy.rb +1 -1
  43. data/app/models/concerns/foreman_puppet/extensions/template_combination.rb +1 -1
  44. data/app/models/concerns/foreman_puppet/extensions/user.rb +19 -12
  45. data/app/models/foreman_puppet/environment.rb +2 -0
  46. data/app/models/foreman_puppet/environment_class.rb +1 -1
  47. data/app/models/foreman_puppet/host_class.rb +1 -1
  48. data/app/models/foreman_puppet/host_puppet_facet.rb +6 -5
  49. data/app/models/foreman_puppet/hostgroup_puppet_facet.rb +1 -1
  50. data/app/models/{concerns/foreman_puppet/host_common.rb → foreman_puppet/puppet_facet_common.rb} +1 -1
  51. data/app/models/foreman_puppet/puppetclass.rb +15 -1
  52. data/app/{views/api/v2/template_combinations/base.json.erb → prepend_views/api/v2/template_combinations/base.json.rabl} +0 -0
  53. data/app/services/foreman_puppet/host_info_providers/config_groups_info.rb +2 -0
  54. data/app/services/foreman_puppet/puppet_class_importer.rb +17 -18
  55. data/app/views/foreman_puppet/common/_puppetclasses_or_envs_changed.html.erb +62 -0
  56. data/app/views/foreman_puppet/config_groups/index.html.erb +2 -2
  57. data/app/views/foreman_puppet/config_groups/welcome.html.erb +12 -11
  58. data/app/views/foreman_puppet/environments/index.html.erb +1 -1
  59. data/app/views/foreman_puppet/environments/welcome.html.erb +3 -15
  60. data/app/views/foreman_puppet/puppetclass_lookup_keys/welcome.html.erb +10 -8
  61. data/app/views/foreman_puppet/puppetclasses/_classes.html.erb +1 -1
  62. data/app/views/foreman_puppet/puppetclasses/_selected_classes.html.erb +1 -1
  63. data/app/views/foreman_puppet/puppetclasses/index.html.erb +1 -1
  64. data/app/views/hosts/_form_puppet_enc_tab.html.erb +1 -1
  65. data/app/views/hosts/select_multiple_environment.html.erb +1 -1
  66. data/app/views/smart_proxies/plugins/_puppet_ca.html.erb +44 -0
  67. data/config/initializers/api_reroute.rb +13 -0
  68. data/db/migrate/20200803113903_migrate_host_type_in_host_config_groups.foreman_puppet.rb +37 -12
  69. data/db/migrate/20201125113903_migrate_puppetclasses_to_facets.foreman_puppet.rb +13 -1
  70. data/lib/foreman_puppet/engine.rb +68 -20
  71. data/lib/foreman_puppet/register.rb +7 -2
  72. data/lib/foreman_puppet/version.rb +1 -1
  73. data/lib/foreman_puppet.rb +3 -3
  74. data/locale/Makefile +1 -1
  75. data/locale/en/LC_MESSAGES/foreman_puppet.mo +0 -0
  76. data/locale/en/foreman_puppet.edit.po +19 -3
  77. data/locale/en/foreman_puppet.po +18 -6
  78. data/locale/en/foreman_puppet.pox +0 -0
  79. data/locale/foreman_puppet.pot +19 -3
  80. data/locale/messages.mo +0 -0
  81. data/test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb +7 -3
  82. data/test/controllers/foreman_puppet/api/v2/environments_controller_test.rb +18 -16
  83. data/test/controllers/foreman_puppet/api/v2/hosts_controller_test.rb +3 -2
  84. data/test/controllers/foreman_puppet/api/v2/lookups_common_controller_test.rb +1 -1
  85. data/test/controllers/foreman_puppet/api/v2/provisioning_templates_controller_test.rb +32 -0
  86. data/test/controllers/foreman_puppet/api/v2/puppetclasses_controller_test.rb +3 -0
  87. data/test/controllers/foreman_puppet/api/v2/smart_class_parameters_controller_test.rb +7 -1
  88. data/test/controllers/foreman_puppet/api/v2/template_combinations_controller_test.rb +2 -2
  89. data/test/controllers/foreman_puppet/config_groups_controller_test.rb +7 -3
  90. data/test/controllers/foreman_puppet/environments_controller_test.rb +2 -2
  91. data/test/controllers/foreman_puppet/puppetclass_lookup_keys_controller_test.rb +2 -2
  92. data/test/controllers/foreman_puppet/puppetclasses_controller_test.rb +5 -6
  93. data/test/factories/foreman_puppet_factories.rb +3 -0
  94. data/test/factories/host_puppet_enhancements.rb +6 -6
  95. data/test/graphql/mutations/hosts/create_mutation_test.rb +87 -0
  96. data/test/graphql/queries/environment_query_test.rb +54 -0
  97. data/test/graphql/queries/environments_query_test.rb +43 -0
  98. data/test/{qraphql → graphql}/queries/host_puppet_query_test.rb +3 -8
  99. data/test/{qraphql → graphql}/queries/hostgroup_puppet_query_test.rb +1 -6
  100. data/test/graphql/queries/location_query_test.rb +52 -0
  101. data/test/graphql/queries/organization_query_test.rb +52 -0
  102. data/test/graphql/queries/puppetclass_query_test.rb +68 -0
  103. data/test/graphql/queries/puppetclasses_query_test.rb +43 -0
  104. data/test/integration/foreman_puppet/environment_js_test.rb +4 -1
  105. data/test/integration/foreman_puppet/host_js_test.rb +1 -1
  106. data/test/integration/foreman_puppet/puppetclass_js_test.rb +4 -0
  107. data/test/models/foreman_puppet/config_group_class_test.rb +3 -1
  108. data/test/models/foreman_puppet/environment_test.rb +2 -0
  109. data/test/models/foreman_puppet/host_puppet_facet_test.rb +34 -1
  110. data/test/models/foreman_puppet/host_test.rb +4 -3
  111. data/test/models/foreman_puppet/hostgroup_puppet_facet_test.rb +2 -3
  112. data/test/models/foreman_puppet/provisioning_template_test.rb +14 -7
  113. data/test/models/foreman_puppet/report_test.rb +21 -0
  114. data/test/models/foreman_puppet/smart_proxy_test.rb +1 -1
  115. data/test/models/foreman_puppet/user_test.rb +37 -0
  116. data/test/services/foreman_puppet/host_info_providers/config_groups_info_test.rb +35 -0
  117. data/test/services/foreman_puppet/host_info_providers/puppet_info_test.rb +159 -197
  118. data/test/unit/foreman_puppet/puppet_class_importer_test.rb +16 -2
  119. data/webpack/index.js +3 -4
  120. data/webpack/src/Components/Environments/Welcome.js +37 -0
  121. metadata +51 -12
@@ -2,6 +2,8 @@ require 'test_puppet_helper'
2
2
 
3
3
  module ForemanPuppet
4
4
  class EnvironmentTest < ActiveSupport::TestCase
5
+ setup { FactoryBot.create(:environment) }
6
+
5
7
  should validate_presence_of(:name)
6
8
  should validate_uniqueness_of(:name)
7
9
  should have_many(:provisioning_templates).through(:template_combinations)
@@ -1,13 +1,46 @@
1
1
  require 'test_puppet_helper'
2
2
 
3
3
  module ForemanPuppet
4
- class HostgroupPuppetFacetTest < ActiveSupport::TestCase
4
+ class HostPuppetFacetTest < ActiveSupport::TestCase
5
5
  let(:environment) { FactoryBot.create(:environment) }
6
6
  let(:diff_environment) { FactoryBot.create(:environment) }
7
7
  let(:puppetclass_both) { FactoryBot.create(:puppetclass, environments: [environment, diff_environment]) }
8
8
  let(:config_group) { FactoryBot.create(:config_group, :with_puppetclass, class_environments: [environment]) }
9
9
  let(:config_group_diff_env) { FactoryBot.create(:config_group, :with_puppetclass, class_environments: [diff_environment]) }
10
10
 
11
+ describe '.populate_fields_from_facts' do
12
+ test 'populate environment without any puppet info' do
13
+ h = FactoryBot.create(:host)
14
+ parser = stub(environment: environment)
15
+ HostPuppetFacet.populate_fields_from_facts(h, parser, 'puppet', FactoryBot.create(:puppet_smart_proxy))
16
+ assert_equal environment, h.puppet.environment
17
+ end
18
+
19
+ test 'changes puppet environment when setting says to do so' do
20
+ Setting[:update_environment_from_facts] = true
21
+ h = FactoryBot.create(:host, :with_puppet_enc)
22
+ parser = stub(environment: environment)
23
+ HostPuppetFacet.populate_fields_from_facts(h, parser, 'puppet', FactoryBot.create(:puppet_smart_proxy))
24
+ assert_equal environment, h.puppet.environment
25
+ end
26
+
27
+ test 'keep puppet environment when parser has empty environment' do
28
+ Setting[:update_environment_from_facts] = true
29
+ h = FactoryBot.create(:host, :with_puppet_enc)
30
+ parser = stub(environment: nil)
31
+ HostPuppetFacet.populate_fields_from_facts(h, parser, 'puppet', FactoryBot.create(:puppet_smart_proxy))
32
+ assert_not_nil h.puppet.environment
33
+ end
34
+
35
+ test 'do not update puppet environment when setting says not to' do
36
+ Setting[:update_environment_from_facts] = false
37
+ h = FactoryBot.create(:host, :with_puppet_enc)
38
+ parser = stub(environment: environment)
39
+ HostPuppetFacet.populate_fields_from_facts(h, parser, 'puppet', FactoryBot.create(:puppet_smart_proxy))
40
+ assert_not_equal environment, h.puppet.environment
41
+ end
42
+ end
43
+
11
44
  describe '#classes_in_groups' do
12
45
  test 'classes_in_groups should return the puppetclasses of a config group only if it is in host environment' do
13
46
  host = FactoryBot.create(:host, :with_puppet_enc,
@@ -79,7 +79,7 @@ module ForemanPuppet
79
79
 
80
80
  test 'can search hosts by puppet class from config group in parent hostgroup' do
81
81
  hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc)
82
- host = FactoryBot.create(:host, :with_puppet_enc, hostgroup: hostgroup, environment: hostgroup.environment)
82
+ host = FactoryBot.create(:host, :with_puppet_enc, hostgroup: hostgroup, environment: hostgroup.puppet.environment)
83
83
  config_group = FactoryBot.create(:config_group, :with_puppetclass)
84
84
  hostgroup.puppet.config_groups << config_group
85
85
  result = Host.search_for("class = #{config_group.puppetclass_names.first}")
@@ -138,7 +138,8 @@ module ForemanPuppet
138
138
  describe '#clone' do
139
139
  test '#classes etc. on cloned host return the same' do
140
140
  hostgroup = FactoryBot.create(:hostgroup, :with_puppet_enc, :with_config_group, :with_puppetclass)
141
- host = FactoryBot.create(:host, :with_puppet_enc, :with_config_group, :with_puppetclass, :with_parameter, hostgroup: hostgroup, environment: hostgroup.environment)
141
+ host = FactoryBot.create(:host, :with_puppet_enc, :with_config_group, :with_puppetclass, :with_parameter,
142
+ hostgroup: hostgroup, environment: hostgroup.puppet.environment)
142
143
  copy = host.clone
143
144
  assert_equal host.puppet.individual_puppetclasses.map(&:id), copy.puppet.individual_puppetclasses.map(&:id)
144
145
  assert_equal host.puppet.classes_in_groups.map(&:id), copy.puppet.classes_in_groups.map(&:id)
@@ -241,7 +242,7 @@ module ForemanPuppet
241
242
 
242
243
  host.puppet.environment = env_with_other_tax
243
244
  assert_not host.valid?
244
- assert_match(/is not assigned/, host.errors[:environment_id].first)
245
+ assert_match(/is not assigned/, host.errors['puppet.environment_id'].first)
245
246
  end
246
247
 
247
248
  test 'when saving a host, require puppet environment if puppet master is set' do
@@ -22,15 +22,14 @@ module ForemanPuppet
22
22
  end
23
23
 
24
24
  test 'changing environment should preserve puppetclasses' do
25
- skip 'Something fishy on env update, try once extracted' unless ForemanPuppet.extracted_from_core?
26
25
  new_environment = FactoryBot.create(:environment)
27
- old_puppetclass_ids = hostgroup.puppet.puppetclass_ids
26
+ old_puppetclass_ids = hostgroup.puppet.puppetclasses.all
28
27
 
29
28
  hostgroup.puppet.update!(environment: new_environment)
30
29
  hostgroup.reload
31
30
 
32
31
  assert_equal new_environment, hostgroup.puppet.environment
33
- assert_equal old_puppetclass_ids.sort, hostgroup.puppet.puppetclass_ids.sort
32
+ assert_equal old_puppetclass_ids.sort, hostgroup.puppet.puppetclasses.all
34
33
  end
35
34
 
36
35
  test 'should return all classes for environment only' do
@@ -37,7 +37,14 @@ module ForemanPuppet
37
37
  assert_equal [], tmplt.template_combinations
38
38
  end
39
39
 
40
- describe 'Association cascading' do
40
+ test '#template_includes adds environment include' do
41
+ includes = ProvisioningTemplate.template_includes
42
+ tc_include = includes.detect { |i| i.is_a?(Hash) && i.key?(:template_combinations) }
43
+ assert tc_include
44
+ assert_includes tc_include[:template_combinations], :environment
45
+ end
46
+
47
+ describe '#find_template by template_combinations' do
41
48
  setup do
42
49
  @arch = FactoryBot.create(:architecture)
43
50
  medium = FactoryBot.create(:medium, name: 'combo_medium', path: 'http://www.example.com/m')
@@ -74,7 +81,7 @@ module ForemanPuppet
74
81
  @ctd.os_default_templates.create(operatingsystem: @os1, template_kind_id: @ctd.template_kind_id)
75
82
  end
76
83
 
77
- test 'find_template finds a matching template with hg and env' do
84
+ test 'finds a matching template with hg and env' do
78
85
  assert_equal @ct1.name,
79
86
  ProvisioningTemplate.find_template({ kind: @tk.name,
80
87
  operatingsystem_id: @os1.id,
@@ -82,14 +89,14 @@ module ForemanPuppet
82
89
  environment_id: @ev1.id }).name
83
90
  end
84
91
 
85
- test 'find_template finds a matching template with hg only' do
92
+ test 'finds a matching template with hg only' do
86
93
  assert_equal @ct2.name,
87
94
  ProvisioningTemplate.find_template({ kind: @tk.name,
88
95
  operatingsystem_id: @os1.id,
89
96
  hostgroup_id: @hg1.id }).name
90
97
  end
91
98
 
92
- test 'find_template finds a matching template with hg and mismatched env' do
99
+ test 'finds a matching template with hg and mismatched env' do
93
100
  assert_equal @ct2.name,
94
101
  ProvisioningTemplate.find_template({ kind: @tk.name,
95
102
  operatingsystem_id: @os1.id,
@@ -97,14 +104,14 @@ module ForemanPuppet
97
104
  environment_id: @ev3.id }).name
98
105
  end
99
106
 
100
- test 'find_template finds a matching template with env only' do
107
+ test 'finds a matching template with env only' do
101
108
  assert_equal @ct3.name,
102
109
  ProvisioningTemplate.find_template({ kind: @tk.name,
103
110
  operatingsystem_id: @os1.id,
104
111
  environment_id: @ev1.id }).name
105
112
  end
106
113
 
107
- test 'find_template finds a matching template with env and mismatched hg' do
114
+ test 'finds a matching template with env and mismatched hg' do
108
115
  assert_equal @ct3.name,
109
116
  ProvisioningTemplate.find_template({ kind: @tk.name,
110
117
  operatingsystem_id: @os1.id,
@@ -112,7 +119,7 @@ module ForemanPuppet
112
119
  environment_id: @ev1.id }).name
113
120
  end
114
121
 
115
- test 'find_template finds the default template when hg and env do not match' do
122
+ test 'finds the default template when hg and env do not match' do
116
123
  assert_equal @ctd.name,
117
124
  ProvisioningTemplate.find_template({ kind: @tk.name,
118
125
  operatingsystem_id: @os1.id,
@@ -0,0 +1,21 @@
1
+ require 'test_puppet_helper'
2
+
3
+ module ForemanPuppet
4
+ class TestReport < ::Report
5
+ end
6
+
7
+ class ReportTest < ActiveSupport::TestCase
8
+ test 'Inherited children can search by environment' do
9
+ assert_nothing_raised do
10
+ TestReport.search_for('environment = blah')
11
+ end
12
+ end
13
+
14
+ # to include the environment search
15
+ test 'Inherited children can search' do
16
+ assert_nothing_raised do
17
+ TestReport.search_for('blah')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -17,7 +17,7 @@ module ForemanPuppet
17
17
  end
18
18
 
19
19
  test 'can count connected hosts' do
20
- FactoryBot.create(:host, :with_puppet_enc, :with_environment, puppet_proxy: proxy)
20
+ FactoryBot.create(:host, :with_puppet_enc, puppet_proxy: proxy)
21
21
 
22
22
  as_admin do
23
23
  assert_equal 1, proxy.hosts_count
@@ -0,0 +1,37 @@
1
+ require 'test_puppet_helper'
2
+
3
+ module ForemanPuppet
4
+ class UserTest < ActiveSupport::TestCase
5
+ describe '#visible_environments' do
6
+ let(:environment) { FactoryBot.create(:environment) }
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
13
+
14
+ setup do
15
+ environment
16
+ untaxed_env
17
+ end
18
+
19
+ # These will need refactor when the environment fixtures will be gone
20
+ test 'should show the list of environments visible as admin user' do
21
+ # Admin user sees all environments - including the ones without taxonomies\
22
+ assert_equal env_names.sort, ::User.current.visible_environments.sort
23
+ end
24
+
25
+ test 'should show the list of environments visible as inherited admin user' do
26
+ ::User.current = FactoryBot.create(:user, usergroups: [FactoryBot.create(:usergroup, admin: true)]).reload
27
+ assert_same_elements env_names.sort, ::User.current.visible_environments
28
+ end
29
+
30
+ test 'should show the list of environments visible as non-admin user' do
31
+ # Non-admin user only sees environments in a taxonomy at least
32
+ setup_user 'view', 'environments'
33
+ assert_equal [environment.name], ::User.current.visible_environments
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,35 @@
1
+ require 'test_puppet_helper'
2
+
3
+ module ForemanPuppet
4
+ class ConfigGroupInfoTest < ActiveSupport::TestCase
5
+ let(:cg_info) { HostInfoProviders::ConfigGroupsInfo.new(host) }
6
+
7
+ context 'with Puppet Host' do
8
+ let(:config_group) { FactoryBot.create(:config_group) }
9
+ let(:host) do
10
+ FactoryBot.build(:host, :with_puppet_enc,
11
+ location: taxonomies(:location1),
12
+ organization: taxonomies(:organization1),
13
+ operatingsystem: operatingsystems(:redhat),
14
+ config_groups: [config_group])
15
+ end
16
+
17
+ it 'adds config_groups to host parameters' do
18
+ assert_equal([config_group.name], cg_info.host_info['parameters']['foreman_config_groups'])
19
+ end
20
+ end
21
+
22
+ context 'without Puppet' do
23
+ let(:host) do
24
+ FactoryBot.build(:host,
25
+ location: taxonomies(:location1),
26
+ organization: taxonomies(:organization1),
27
+ operatingsystem: operatingsystems(:redhat))
28
+ end
29
+
30
+ it 'does not fail without puppet facet' do
31
+ assert_equal({}, cg_info.host_info)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -37,9 +37,9 @@ module ForemanPuppet
37
37
 
38
38
  value = as_admin do
39
39
  LookupValue.create! lookup_key_id: puppetclass_lookup_key.id,
40
- match: "organization=#{taxonomies(:organization1)},location=#{taxonomies(:location1)}",
41
- value: 'test',
42
- omit: false
40
+ match: "organization=#{taxonomies(:organization1)},location=#{taxonomies(:location1)}",
41
+ value: 'test',
42
+ omit: false
43
43
  end
44
44
  enc = HostInfoProviders::PuppetInfo.new(@host).puppetclass_parameters
45
45
 
@@ -78,19 +78,17 @@ module ForemanPuppet
78
78
  host = FactoryBot.build_stubbed(:host, :with_puppet_enc, environment: environment, puppetclasses: [puppetclass])
79
79
  Classification::MatchesGenerator.any_instance.expects(:attr_to_value).with('comment').returns('override')
80
80
 
81
- assert_equal(
82
- {
83
- lkey.id => {
84
- lkey.key => {
85
- value: 'overridden value',
86
- element: 'comment',
87
- element_name: 'override',
88
- managed: false,
89
- },
81
+ expected = {
82
+ lkey.id => {
83
+ lkey.key => {
84
+ value: 'overridden value',
85
+ element: 'comment',
86
+ element_name: 'override',
87
+ managed: false,
90
88
  },
91
89
  },
92
- Classification::ValuesHashQuery.values_hash(host, LookupKey.where(id: [lkey])).raw
93
- )
90
+ }
91
+ assert_equal(expected, Classification::ValuesHashQuery.values_hash(host, LookupKey.where(id: [lkey])).raw)
94
92
 
95
93
  Classification::MatchesGenerator.any_instance.unstub(:attr_to_value)
96
94
  end
@@ -108,9 +106,9 @@ module ForemanPuppet
108
106
  puppetclass: puppetclass, path: "location\ncomment")
109
107
  as_admin do
110
108
  LookupValue.create! lookup_key_id: lkey.id,
111
- match: "location=#{taxonomies(:location1)}",
112
- value: 'test',
113
- omit: true
109
+ match: "location=#{taxonomies(:location1)}",
110
+ value: 'test',
111
+ omit: true
114
112
  end
115
113
 
116
114
  enc = HostInfoProviders::PuppetInfo.new(@host).puppetclass_parameters
@@ -124,9 +122,9 @@ module ForemanPuppet
124
122
  path: "location\ncomment")
125
123
  lvalue = as_admin do
126
124
  LookupValue.create! lookup_key_id: lkey.id,
127
- match: "location=#{taxonomies(:location1)}",
128
- value: 'test',
129
- omit: false
125
+ match: "location=#{taxonomies(:location1)}",
126
+ value: 'test',
127
+ omit: false
130
128
  end
131
129
 
132
130
  enc = HostInfoProviders::PuppetInfo.new(@host).puppetclass_parameters
@@ -142,22 +140,22 @@ module ForemanPuppet
142
140
 
143
141
  as_admin do
144
142
  LookupValue.create! lookup_key_id: key.id,
145
- match: "location=#{taxonomies(:location1)}",
146
- value: { example: { a: 'test' } },
147
- omit: true
143
+ match: "location=#{taxonomies(:location1)}",
144
+ value: { example: { a: 'test' } },
145
+ omit: true
148
146
  end
149
147
  as_admin do
150
148
  LookupValue.create! lookup_key_id: key.id,
151
- match: "organization=#{taxonomies(:organization1)}",
152
- value: { example: { b: 'test2' } },
153
- omit: true
149
+ match: "organization=#{taxonomies(:organization1)}",
150
+ value: { example: { b: 'test2' } },
151
+ omit: true
154
152
  end
155
153
 
156
154
  as_admin do
157
155
  LookupValue.create! lookup_key_id: key.id,
158
- match: "os=#{operatingsystems(:redhat)}",
159
- value: { example: { a: 'test3' } },
160
- omit: true
156
+ match: "os=#{operatingsystems(:redhat)}",
157
+ value: { example: { a: 'test3' } },
158
+ omit: true
161
159
  end
162
160
 
163
161
  enc = HostInfoProviders::PuppetInfo.new(@host).puppetclass_parameters
@@ -166,9 +164,6 @@ module ForemanPuppet
166
164
  end
167
165
 
168
166
  test '#enc should return correct merged override to host when multiple overrides for inherited hostgroups exist' do
169
- FactoryBot.create(:setting,
170
- name: 'matchers_inheritance',
171
- value: true)
172
167
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
173
168
  key_type: 'array', merge_overrides: true,
174
169
  path: "organization\nhostgroup\nlocation",
@@ -184,13 +179,13 @@ module ForemanPuppet
184
179
 
185
180
  as_admin do
186
181
  LookupValue.create! lookup_key_id: key.id,
187
- match: "hostgroup=#{parent_hostgroup}",
188
- value: ['parent'],
189
- omit: false
182
+ match: "hostgroup=#{parent_hostgroup}",
183
+ value: ['parent'],
184
+ omit: false
190
185
  LookupValue.create! lookup_key_id: key.id,
191
- match: "organization=#{taxonomies(:organization1)}",
192
- value: ['org'],
193
- omit: false
186
+ match: "organization=#{taxonomies(:organization1)}",
187
+ value: ['org'],
188
+ omit: false
194
189
  end
195
190
 
196
191
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -199,9 +194,6 @@ module ForemanPuppet
199
194
  end
200
195
 
201
196
  test '#enc should return correct merged override to host when multiple overrides for inherited organizations exist' do
202
- FactoryBot.create(:setting,
203
- name: 'matchers_inheritance',
204
- value: true)
205
197
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
206
198
  key_type: 'array', merge_overrides: true,
207
199
  path: "location\norganization\nhostgroup",
@@ -218,13 +210,13 @@ module ForemanPuppet
218
210
 
219
211
  as_admin do
220
212
  LookupValue.create! lookup_key_id: key.id,
221
- match: "organization=#{parent_org}",
222
- value: ['parent'],
223
- omit: false
213
+ match: "organization=#{parent_org}",
214
+ value: ['parent'],
215
+ omit: false
224
216
  LookupValue.create! lookup_key_id: key.id,
225
- match: "location=#{taxonomies(:location1)}",
226
- value: ['loc'],
227
- omit: false
217
+ match: "location=#{taxonomies(:location1)}",
218
+ value: ['loc'],
219
+ omit: false
228
220
  end
229
221
 
230
222
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -233,9 +225,6 @@ module ForemanPuppet
233
225
  end
234
226
 
235
227
  test '#enc should return correct merged override to host when multiple overrides for inherited locations exist' do
236
- FactoryBot.create(:setting,
237
- name: 'matchers_inheritance',
238
- value: true)
239
228
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
240
229
  key_type: 'array', merge_overrides: true,
241
230
  path: "organization\nhostgroup\nlocation",
@@ -252,13 +241,13 @@ module ForemanPuppet
252
241
 
253
242
  as_admin do
254
243
  LookupValue.create! lookup_key_id: key.id,
255
- match: "location=#{parent_loc}",
256
- value: ['parent'],
257
- omit: false
244
+ match: "location=#{parent_loc}",
245
+ value: ['parent'],
246
+ omit: false
258
247
  LookupValue.create! lookup_key_id: key.id,
259
- match: "organization=#{taxonomies(:organization1)}",
260
- value: ['org'],
261
- omit: false
248
+ match: "organization=#{taxonomies(:organization1)}",
249
+ value: ['org'],
250
+ omit: false
262
251
  end
263
252
 
264
253
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -267,9 +256,6 @@ module ForemanPuppet
267
256
  end
268
257
 
269
258
  test '#enc should return correct merged override to host when multiple overrides for inherited hostgroups exist' do
270
- FactoryBot.create(:setting,
271
- name: 'matchers_inheritance',
272
- value: true)
273
259
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
274
260
  key_type: 'array', merge_overrides: true,
275
261
  path: "organization\nhostgroup\nlocation",
@@ -285,17 +271,17 @@ module ForemanPuppet
285
271
 
286
272
  as_admin do
287
273
  LookupValue.create! lookup_key_id: key.id,
288
- match: "hostgroup=#{parent_hostgroup}",
289
- value: ['parent'],
290
- omit: false
274
+ match: "hostgroup=#{parent_hostgroup}",
275
+ value: ['parent'],
276
+ omit: false
291
277
  LookupValue.create! lookup_key_id: key.id,
292
- match: "hostgroup=#{child_hostgroup}",
293
- value: ['child'],
294
- omit: false
278
+ match: "hostgroup=#{child_hostgroup}",
279
+ value: ['child'],
280
+ omit: false
295
281
  LookupValue.create! lookup_key_id: key.id,
296
- match: "organization=#{taxonomies(:organization1)}",
297
- value: ['org'],
298
- omit: false
282
+ match: "organization=#{taxonomies(:organization1)}",
283
+ value: ['org'],
284
+ omit: false
299
285
  end
300
286
 
301
287
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -304,9 +290,6 @@ module ForemanPuppet
304
290
  end
305
291
 
306
292
  test '#enc should return correct merged override to host when multiple overrides for inherited organizations exist' do
307
- FactoryBot.create(:setting,
308
- name: 'matchers_inheritance',
309
- value: true)
310
293
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
311
294
  key_type: 'array', merge_overrides: true,
312
295
  path: "location\norganization\nhostgroup",
@@ -323,17 +306,17 @@ module ForemanPuppet
323
306
 
324
307
  as_admin do
325
308
  LookupValue.create! lookup_key_id: key.id,
326
- match: "organization=#{parent_org}",
327
- value: ['parent'],
328
- omit: false
309
+ match: "organization=#{parent_org}",
310
+ value: ['parent'],
311
+ omit: false
329
312
  LookupValue.create! lookup_key_id: key.id,
330
- match: "organization=#{child_org}",
331
- value: ['child'],
332
- omit: false
313
+ match: "organization=#{child_org}",
314
+ value: ['child'],
315
+ omit: false
333
316
  LookupValue.create! lookup_key_id: key.id,
334
- match: "location=#{taxonomies(:location1)}",
335
- value: ['loc'],
336
- omit: false
317
+ match: "location=#{taxonomies(:location1)}",
318
+ value: ['loc'],
319
+ omit: false
337
320
  end
338
321
 
339
322
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -342,9 +325,6 @@ module ForemanPuppet
342
325
  end
343
326
 
344
327
  test '#enc should return correct merged override to host when multiple overrides for inherited locations exist' do
345
- FactoryBot.create(:setting,
346
- name: 'matchers_inheritance',
347
- value: true)
348
328
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
349
329
  key_type: 'array', merge_overrides: true,
350
330
  path: "organization\nhostgroup\nlocation",
@@ -361,17 +341,17 @@ module ForemanPuppet
361
341
 
362
342
  as_admin do
363
343
  LookupValue.create! lookup_key_id: key.id,
364
- match: "location=#{parent_loc}",
365
- value: ['parent'],
366
- omit: false
344
+ match: "location=#{parent_loc}",
345
+ value: ['parent'],
346
+ omit: false
367
347
  LookupValue.create! lookup_key_id: key.id,
368
- match: "location=#{child_loc}",
369
- value: ['child'],
370
- omit: false
348
+ match: "location=#{child_loc}",
349
+ value: ['child'],
350
+ omit: false
371
351
  LookupValue.create! lookup_key_id: key.id,
372
- match: "organization=#{taxonomies(:organization1)}",
373
- value: ['org'],
374
- omit: false
352
+ match: "organization=#{taxonomies(:organization1)}",
353
+ value: ['org'],
354
+ omit: false
375
355
  end
376
356
 
377
357
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -380,9 +360,6 @@ module ForemanPuppet
380
360
  end
381
361
 
382
362
  test '#enc should return correct override to host when multiple overrides for inherited hostgroups exist' do
383
- FactoryBot.create(:setting,
384
- name: 'matchers_inheritance',
385
- value: true)
386
363
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
387
364
  merge_overrides: false,
388
365
  path: "organization\nhostgroup\nlocation",
@@ -398,17 +375,17 @@ module ForemanPuppet
398
375
 
399
376
  value2 = as_admin do
400
377
  LookupValue.create! lookup_key_id: key.id,
401
- match: "hostgroup=#{parent_hostgroup}",
402
- value: 'parent',
403
- omit: false
378
+ match: "hostgroup=#{parent_hostgroup}",
379
+ value: 'parent',
380
+ omit: false
404
381
  LookupValue.create! lookup_key_id: key.id,
405
- match: "hostgroup=#{child_hostgroup}",
406
- value: 'child',
407
- omit: false
382
+ match: "hostgroup=#{child_hostgroup}",
383
+ value: 'child',
384
+ omit: false
408
385
  LookupValue.create! lookup_key_id: key.id,
409
- match: "organization=#{taxonomies(:organization1)}",
410
- value: 'org',
411
- omit: false
386
+ match: "organization=#{taxonomies(:organization1)}",
387
+ value: 'org',
388
+ omit: false
412
389
  end
413
390
 
414
391
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -417,9 +394,6 @@ module ForemanPuppet
417
394
  end
418
395
 
419
396
  test '#enc should return correct override to host when multiple overrides for inherited organizations exist' do
420
- FactoryBot.create(:setting,
421
- name: 'matchers_inheritance',
422
- value: true)
423
397
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
424
398
  merge_overrides: false,
425
399
  path: "location\norganization\nhostgroup",
@@ -434,17 +408,17 @@ module ForemanPuppet
434
408
 
435
409
  value2 = as_admin do
436
410
  LookupValue.create! lookup_key_id: key.id,
437
- match: "organization=#{parent_org}",
438
- value: 'parent',
439
- omit: false
411
+ match: "organization=#{parent_org}",
412
+ value: 'parent',
413
+ omit: false
440
414
  LookupValue.create! lookup_key_id: key.id,
441
- match: "organization=#{child_org}",
442
- value: 'child',
443
- omit: false
415
+ match: "organization=#{child_org}",
416
+ value: 'child',
417
+ omit: false
444
418
  LookupValue.create! lookup_key_id: key.id,
445
- match: "location=#{taxonomies(:location1)}",
446
- value: 'loc',
447
- omit: false
419
+ match: "location=#{taxonomies(:location1)}",
420
+ value: 'loc',
421
+ omit: false
448
422
  end
449
423
 
450
424
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -453,9 +427,6 @@ module ForemanPuppet
453
427
  end
454
428
 
455
429
  test '#enc should return correct override to host when multiple overrides for inherited locations exist' do
456
- FactoryBot.create(:setting,
457
- name: 'matchers_inheritance',
458
- value: true)
459
430
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
460
431
  merge_overrides: false,
461
432
  path: "organization\nlocation\nhostgroup",
@@ -470,17 +441,17 @@ module ForemanPuppet
470
441
 
471
442
  value2 = as_admin do
472
443
  LookupValue.create! lookup_key_id: key.id,
473
- match: "location=#{parent_loc}",
474
- value: 'parent',
475
- omit: false
444
+ match: "location=#{parent_loc}",
445
+ value: 'parent',
446
+ omit: false
476
447
  LookupValue.create! lookup_key_id: key.id,
477
- match: "location=#{child_loc}",
478
- value: 'child',
479
- omit: false
448
+ match: "location=#{child_loc}",
449
+ value: 'child',
450
+ omit: false
480
451
  LookupValue.create! lookup_key_id: key.id,
481
- match: "organization=#{taxonomies(:organization1)}",
482
- value: 'org',
483
- omit: false
452
+ match: "organization=#{taxonomies(:organization1)}",
453
+ value: 'org',
454
+ omit: false
484
455
  end
485
456
 
486
457
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -489,9 +460,6 @@ module ForemanPuppet
489
460
  end
490
461
 
491
462
  test '#enc should return correct override to host when multiple overrides for inherited hostgroups exist' do
492
- FactoryBot.create(:setting,
493
- name: 'matchers_inheritance',
494
- value: true)
495
463
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
496
464
  merge_overrides: false,
497
465
  path: "organization\nhostgroup\nlocation",
@@ -506,17 +474,17 @@ module ForemanPuppet
506
474
 
507
475
  value2 = as_admin do
508
476
  LookupValue.create! lookup_key_id: key.id,
509
- match: "hostgroup=#{parent_hostgroup}",
510
- value: 'parent',
511
- omit: false
477
+ match: "hostgroup=#{parent_hostgroup}",
478
+ value: 'parent',
479
+ omit: false
512
480
  LookupValue.create! lookup_key_id: key.id,
513
- match: "location=#{taxonomies(:location1)}",
514
- value: 'loc',
515
- omit: true
481
+ match: "location=#{taxonomies(:location1)}",
482
+ value: 'loc',
483
+ omit: true
516
484
  LookupValue.create! lookup_key_id: key.id,
517
- match: "hostgroup=#{child_hostgroup}",
518
- value: 'child',
519
- omit: false
485
+ match: "hostgroup=#{child_hostgroup}",
486
+ value: 'child',
487
+ omit: false
520
488
  end
521
489
 
522
490
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -525,9 +493,6 @@ module ForemanPuppet
525
493
  end
526
494
 
527
495
  test '#enc should return correct override to host when multiple overrides for inherited organizations exist' do
528
- FactoryBot.create(:setting,
529
- name: 'matchers_inheritance',
530
- value: true)
531
496
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
532
497
  merge_overrides: false,
533
498
  path: "organization\nhostgroup\nlocation",
@@ -544,17 +509,17 @@ module ForemanPuppet
544
509
 
545
510
  value2 = as_admin do
546
511
  LookupValue.create! lookup_key_id: key.id,
547
- match: "organization=#{parent_org}",
548
- value: 'parent',
549
- omit: false
512
+ match: "organization=#{parent_org}",
513
+ value: 'parent',
514
+ omit: false
550
515
  LookupValue.create! lookup_key_id: key.id,
551
- match: "location=#{taxonomies(:location1)}",
552
- value: 'loc',
553
- omit: true
516
+ match: "location=#{taxonomies(:location1)}",
517
+ value: 'loc',
518
+ omit: true
554
519
  LookupValue.create! lookup_key_id: key.id,
555
- match: "organization=#{child_org}",
556
- value: 'child',
557
- omit: false
520
+ match: "organization=#{child_org}",
521
+ value: 'child',
522
+ omit: false
558
523
  end
559
524
 
560
525
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -563,9 +528,6 @@ module ForemanPuppet
563
528
  end
564
529
 
565
530
  test '#enc should return correct override to host when multiple overrides for inherited locations exist' do
566
- FactoryBot.create(:setting,
567
- name: 'matchers_inheritance',
568
- value: true)
569
531
  key = FactoryBot.create(:puppetclass_lookup_key, omit: true,
570
532
  merge_overrides: false,
571
533
  path: "location\norganization\nhostgroup",
@@ -582,17 +544,17 @@ module ForemanPuppet
582
544
 
583
545
  value2 = as_admin do
584
546
  LookupValue.create! lookup_key_id: key.id,
585
- match: "location=#{parent_loc}",
586
- value: 'parent',
587
- omit: false
547
+ match: "location=#{parent_loc}",
548
+ value: 'parent',
549
+ omit: false
588
550
  LookupValue.create! lookup_key_id: key.id,
589
- match: "organization=#{taxonomies(:organization1)}",
590
- value: 'org',
591
- omit: true
551
+ match: "organization=#{taxonomies(:organization1)}",
552
+ value: 'org',
553
+ omit: true
592
554
  LookupValue.create! lookup_key_id: key.id,
593
- match: "location=#{child_loc}",
594
- value: 'child',
595
- omit: false
555
+ match: "location=#{child_loc}",
556
+ value: 'child',
557
+ omit: false
596
558
  end
597
559
 
598
560
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -608,13 +570,13 @@ module ForemanPuppet
608
570
 
609
571
  value2 = as_admin do
610
572
  LookupValue.create! lookup_key_id: key.id,
611
- match: "location=#{taxonomies(:location1)}",
612
- value: 'test_incorrect',
613
- omit: false
573
+ match: "location=#{taxonomies(:location1)}",
574
+ value: 'test_incorrect',
575
+ omit: false
614
576
  LookupValue.create! lookup_key_id: key.id,
615
- match: "organization=#{taxonomies(:organization1)},location=#{taxonomies(:location1)}",
616
- value: 'test_correct',
617
- omit: false
577
+ match: "organization=#{taxonomies(:organization1)},location=#{taxonomies(:location1)}",
578
+ value: 'test_correct',
579
+ omit: false
618
580
  end
619
581
  enc = HostInfoProviders::PuppetInfo.new(@host).puppetclass_parameters
620
582
  key.reload
@@ -630,15 +592,15 @@ module ForemanPuppet
630
592
 
631
593
  value = as_admin do
632
594
  LookupValue.create! lookup_key_id: key.id,
633
- match: "organization=#{taxonomies(:organization1)},location=#{taxonomies(:location1)}",
634
- value: 'test_correct',
635
- omit: false
595
+ match: "organization=#{taxonomies(:organization1)},location=#{taxonomies(:location1)}",
596
+ value: 'test_correct',
597
+ omit: false
636
598
  end
637
599
  as_admin do
638
600
  LookupValue.create! lookup_key_id: key.id,
639
- match: "organization=#{taxonomies(:organization1)}",
640
- value: 'test_incorrect',
641
- omit: false
601
+ match: "organization=#{taxonomies(:organization1)}",
602
+ value: 'test_incorrect',
603
+ omit: false
642
604
  end
643
605
  enc = HostInfoProviders::PuppetInfo.new(@host).puppetclass_parameters
644
606
 
@@ -662,22 +624,22 @@ module ForemanPuppet
662
624
 
663
625
  as_admin do
664
626
  LookupValue.create! lookup_key_id: key.id,
665
- match: "hostgroup=#{parent_hostgroup},organization=#{taxonomies(:organization1)}",
666
- value: 'parent',
667
- omit: false
627
+ match: "hostgroup=#{parent_hostgroup},organization=#{taxonomies(:organization1)}",
628
+ value: 'parent',
629
+ omit: false
668
630
  end
669
631
  value2 = as_admin do
670
632
  LookupValue.create! lookup_key_id: key.id,
671
- match: "hostgroup=#{child_hostgroup},organization=#{taxonomies(:organization1)}",
672
- value: 'child',
673
- omit: false
633
+ match: "hostgroup=#{child_hostgroup},organization=#{taxonomies(:organization1)}",
634
+ value: 'child',
635
+ omit: false
674
636
  end
675
637
 
676
638
  as_admin do
677
639
  LookupValue.create! lookup_key_id: key.id,
678
- match: "location=#{taxonomies(:location1)}",
679
- value: 'loc',
680
- omit: false
640
+ match: "location=#{taxonomies(:location1)}",
641
+ value: 'loc',
642
+ omit: false
681
643
  end
682
644
 
683
645
  enc = HostInfoProviders::PuppetInfo.new(host).puppetclass_parameters
@@ -694,21 +656,21 @@ module ForemanPuppet
694
656
 
695
657
  as_admin do
696
658
  LookupValue.create! lookup_key_id: key.id,
697
- match: "location=#{taxonomies(:location1)}",
698
- value: '<%= [2,3] %>',
699
- omit: false
659
+ match: "location=#{taxonomies(:location1)}",
660
+ value: '<%= [2,3] %>',
661
+ omit: false
700
662
  end
701
663
  as_admin do
702
664
  LookupValue.create! lookup_key_id: key.id,
703
- match: "organization=#{taxonomies(:organization1)}",
704
- value: '<%= [3,4] %>',
705
- omit: false
665
+ match: "organization=#{taxonomies(:organization1)}",
666
+ value: '<%= [3,4] %>',
667
+ omit: false
706
668
  end
707
669
  as_admin do
708
670
  LookupValue.create! lookup_key_id: key.id,
709
- match: "os=#{operatingsystems(:redhat)}",
710
- value: '<%= [4,5] %>',
711
- omit: false
671
+ match: "os=#{operatingsystems(:redhat)}",
672
+ value: '<%= [4,5] %>',
673
+ omit: false
712
674
  end
713
675
 
714
676
  key.reload
@@ -764,9 +726,9 @@ module ForemanPuppet
764
726
 
765
727
  as_admin do
766
728
  LookupValue.create! lookup_key_id: key.id,
767
- match: "location=#{taxonomies(:location1)}",
768
- value: '<%= "c" %>',
769
- omit: false
729
+ match: "location=#{taxonomies(:location1)}",
730
+ value: '<%= "c" %>',
731
+ omit: false
770
732
  end
771
733
 
772
734
  key.reload