Skip to content

Commit

Permalink
Merge pull request #1196 from voxpupuli/puppet8_20230723
Browse files Browse the repository at this point in the history
Add Puppet 8 support
  • Loading branch information
h-haaks authored Feb 20, 2024
2 parents 299c4fc + 3e6af08 commit 0390edc
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions lib/puppet/provider/elastic_rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def self.api_objects(protocol = 'http',
password = nil,
ca_file = nil,
ca_path = nil,
validate_tls: true)
validate_tls = true)

uri = URI("#{protocol}://#{host}:#{port}/#{format_uri(api_discovery_uri)}")
http = Net::HTTP.new uri.host, uri.port
Expand Down Expand Up @@ -158,7 +158,7 @@ def self.prefetch(resources)
(p.key?(:password) ? p[:password].value : nil),
(p.key?(:ca_file) ? p[:ca_file].value : nil),
(p.key?(:ca_path) ? p[:ca_path].value : nil),
{ validate_tls: p[:validate_tls].value },
(p.key?(:validate_tls) ? p[:validate_tls].value : true),
]
# Deduplicate identical settings, and fetch templates
end.uniq
Expand Down Expand Up @@ -264,7 +264,7 @@ def flush
resource[:password],
resource[:ca_file],
resource[:ca_path],
validate_tls: resource[:validate_tls]
resource[:validate_tls].nil? ? true : resource[:validate_tls]
).find do |t|
t[:name] == resource[:name]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/elasticsearch_component_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def insync?(value)

fail(format('Could not find any content at %s', self[:source])) unless tmp

self[:content] = PSON.load(tmp.content)
self[:content] = JSON.parse(tmp.content)
end
end
# rubocop:enable Style/SignalException
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/elasticsearch_ilm_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def insync?(value)

fail(format('Could not find any content at %s', self[:source])) unless tmp

self[:content] = PSON.load(tmp.content)
self[:content] = JSON.parse(tmp.content)
end
end
# rubocop:enable Style/SignalException
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/elasticsearch_index_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def insync?(value)

fail(format('Could not find any content at %s', self[:source])) unless tmp

self[:content] = PSON.load(tmp.content)
self[:content] = JSON.parse(tmp.content)
end
end
# rubocop:enable Style/SignalException
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/elasticsearch_slm_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def insync?(value)

fail(format('Could not find any content at %s', self[:source])) unless tmp

self[:content] = PSON.load(tmp.content)
self[:content] = JSON.parse(tmp.content)
end
end
# rubocop:enable Style/SignalException
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/elasticsearch_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def insync?(value)

fail(format('Could not find any content at %s', self[:source])) unless tmp

self[:content] = PSON.load(tmp.content)
self[:content] = JSON.parse(tmp.content)
end
end
# rubocop:enable Style/SignalException
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 7.0.0 < 8.0.0"
"version_requirement": ">= 7.0.0 < 9.0.0"
}
]
}
2 changes: 0 additions & 2 deletions spec/helpers/acceptance/tests/package_url_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<<-MANIFEST
api_timeout => 60,
config => {
'cluster.name' => '#{v[:cluster_name]}',
'http.bind_host' => '0.0.0.0',
#{es_config.map { |k, v| " '#{k}' => '#{v}'," }.join("\n")}
},
jvm_options => [
Expand Down
2 changes: 0 additions & 2 deletions spec/helpers/acceptance/tests/slm_policy_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
<<-MANIFEST
api_timeout => 60,
config => {
'cluster.name' => '#{v[:cluster_name]}',
'http.bind_host' => '0.0.0.0',
#{es_config.map { |k, v| " '#{k}' => '#{v}'," }.join("\n")}
},
jvm_options => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<<-MANIFEST
api_timeout => 60,
config => {
'cluster.name' => '#{v[:cluster_name]}',
'http.bind_host' => '0.0.0.0',
#{es_config.map { |k, v| " '#{k}' => '#{v}'," }.join("\n")}
},
jvm_options => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
end.not_to raise_error
end

it 'parses PSON-like values for certain types' do
it 'parses JSON-like values for certain types' do
expect(described_class.new(
:name => resource_name,
meta_property => { 'key' => { 'value' => '0', 'other' => true } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@
to receive(:execute).
with(
[executable, 'list'],
custom_environment: {
'ES_INCLUDE' => defaults_file,
'ES_PATH_CONF' => "/etc/elasticsearch/#{instance}"
},
uid: 'elasticsearch',
gid: 'elasticsearch',
failonfail: true
{
custom_environment: {
'ES_INCLUDE' => defaults_file,
'ES_PATH_CONF' => "/etc/elasticsearch/#{instance}"
},
uid: 'elasticsearch',
gid: 'elasticsearch',
failonfail: true
}
).
and_return(
Puppet::Util::Execution::ProcessOutput.new(
Expand Down Expand Up @@ -118,13 +120,15 @@
receive(:execute).
with(
[executable, 'create'],
custom_environment: {
'ES_INCLUDE' => '/etc/default/elasticsearch-es-03',
'ES_PATH_CONF' => '/etc/elasticsearch/es-03'
},
uid: 'elasticsearch',
gid: 'elasticsearch',
failonfail: true
{
custom_environment: {
'ES_INCLUDE' => '/etc/default/elasticsearch-es-03',
'ES_PATH_CONF' => '/etc/elasticsearch/es-03'
},
uid: 'elasticsearch',
gid: 'elasticsearch',
failonfail: true
}
).
and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
)
Expand All @@ -135,13 +139,15 @@
have_received(:execute).
with(
[executable, 'create'],
custom_environment: {
'ES_INCLUDE' => '/etc/default/elasticsearch-es-03',
'ES_PATH_CONF' => '/etc/elasticsearch/es-03'
},
uid: 'elasticsearch',
gid: 'elasticsearch',
failonfail: true
{
custom_environment: {
'ES_INCLUDE' => '/etc/default/elasticsearch-es-03',
'ES_PATH_CONF' => '/etc/elasticsearch/es-03'
},
uid: 'elasticsearch',
gid: 'elasticsearch',
failonfail: true
}
)
)
end
Expand Down

0 comments on commit 0390edc

Please sign in to comment.