Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Puppet 8 support #1196

Merged
merged 6 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ This release also adds the ability to define logging rolling file settings and a
* Recursively create the logdir for elasticsearch when creating multiple instances
* Files and directories with root ownership now specify UID/GID 0 instead to improve compatability with *BSDs.
* Elasticsearch Debian init file changed to avoid throwing errors when DATA_DIR, WORK_DIR and/or LOG_DIR were an empty variable.
* Fixed a broken File dependency when a plugin was set to absent and ::elasticsearch set to present.
* Fixed a broken File dependency when a plugin was set to absent and elasticsearch set to present.
* Fixed issue when using the `proxy` parameter on plugins in Elasticsearch 2.x.

#### Changes
Expand Down
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ This release also adds the ability to define logging rolling file settings and a
* Recursively create the logdir for elasticsearch when creating multiple instances
* Files and directories with root ownership now specify UID/GID 0 instead to improve compatability with *BSDs.
* Elasticsearch Debian init file changed to avoid throwing errors when DATA_DIR, WORK_DIR and/or LOG_DIR were an empty variable.
* Fixed a broken File dependency when a plugin was set to absent and ::elasticsearch set to present.
* Fixed a broken File dependency when a plugin was set to absent and elasticsearch set to present.
* Fixed issue when using the `proxy` parameter on plugins in Elasticsearch 2.x.

#### Changes
Expand Down
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