Skip to content

Commit

Permalink
Merge branch 'master' into update_stdlib_puppet
Browse files Browse the repository at this point in the history
  • Loading branch information
ggabijaa authored Feb 21, 2024
2 parents c3a2f8c + 167ea14 commit 147c743
Show file tree
Hide file tree
Showing 42 changed files with 165 additions and 122 deletions.
11 changes: 7 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this
with:

```sh
BEAKER_setfile=debian11-64 bundle exec rake beaker
BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
You can replace the string `debian11` with any common operating system.
The following strings are known to work:

* ubuntu1804
* ubuntu2004
* debian10
* ubuntu2204
* debian11
* centos7
* centos8
* centos9
* almalinux8
* almalinux9
* fedora36

For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests).

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

name: CI

on: pull_request
on:
pull_request: {}
push:
branches:
- main
- master

concurrency:
group: ${{ github.ref_name }}
Expand All @@ -13,6 +18,6 @@ concurrency:
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2
with:
pidfile_workaround: 'false'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
release:
name: Release
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2
with:
allowed_owner: 'voxpupuli'
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '5.5.0'
modulesync_config_version: '7.3.0'
1 change: 1 addition & 0 deletions .pmtignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
/.yardoc/
/.yardopts
/Dockerfile
/HISTORY.md
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
inherit_from: .rubocop_todo.yml

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

Expand Down
20 changes: 20 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-02-11 16:22:05 UTC using RuboCop version 1.50.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 32
# Configuration parameters: Max.
RSpec/IndexedLet:
Exclude:
- 'spec/unit/provider/elasticsearch_component_template/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_ilm_policy/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_index/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_index_template/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_pipeline/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_slm_policy/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_snapshot_repository/ruby_spec.rb'
- 'spec/unit/provider/elasticsearch_template/ruby_spec.rb'
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
11 changes: 5 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 5.4', :require => false
gem 'voxpupuli-test', '~> 7.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 2.0', :require => false
gem 'puppet_metadata', '~> 3.5', :require => false
gem 'bcrypt', :require => false
gem 'webmock', :require => false
end
Expand All @@ -18,21 +18,20 @@ group :development do
end

group :system_tests do
gem 'voxpupuli-acceptance', '~> 1.0', :require => false
gem 'voxpupuli-acceptance', '~> 3.0', :require => false
gem 'bcrypt', :require => false
gem 'rspec-retry', :require => false
gem 'simp-beaker-helpers', :require => false
end

group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
gem 'voxpupuli-release', '~> 2.0', :require => false
gem 'voxpupuli-release', '~> 3.0', :require => false
end

gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]

puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0'
puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24'
gem 'puppet', puppetversion, :require => false, :groups => [:test]

# vim: syntax=ruby
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ elasticsearch::slm_policy { 'policiyname':

#### Add a new SLM policy using a file

This will install and/or replace the SLM ploicy in Elasticsearch:
This will install and/or replace the SLM policy in Elasticsearch:

```puppet
elasticsearch::slm_policy { 'policyname':
Expand Down Expand Up @@ -495,7 +495,7 @@ elasticsearch::ilm_policy { 'policiyname':

#### Add a new ILM policy using a file

This will install and/or replace the ILM ploicy in Elasticsearch:
This will install and/or replace the ILM policy in Elasticsearch:

```puppet
elasticsearch::ilm_policy { 'policyname':
Expand Down Expand Up @@ -526,7 +526,7 @@ elasticsearch::ilm_policy { 'policyname':
```
#### Delete an ILM policy

This will install and/or replace the ILM ploicy in Elasticsearch:
This will install and/or replace the ILM policy in Elasticsearch:

```puppet
elasticsearch::ilm_policy { 'policyname':
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/concat_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Puppet::Parser::Functions
newfunction(
:concat_merge,
type: :rvalue,
doc: <<-'ENDHEREDOC') do |args|
doc: <<-ENDHEREDOC) do |args|
Merges two or more hashes together concatenating duplicate keys
with array values and returns the resulting hash.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/deep_implode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Puppet::Parser::Functions
newfunction(
:deep_implode,
type: :rvalue,
doc: <<-'ENDHEREDOC') do |args|
doc: <<-ENDHEREDOC) do |args|
Recursively flattens all keys of a hash into a dot-notated
hash, deeply merging duplicate key values by natively combining
them and returns the resulting hash.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/es_plugin_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Puppet::Parser::Functions
newfunction(
:es_plugin_name,
type: :rvalue,
doc: <<-'ENDHEREDOC') do |args|
doc: <<-ENDHEREDOC) do |args|
Given a string, return the best guess at what the directory name
will be for the given plugin. Any arguments past the first will
be fallbacks (using the same logic) should the first fail.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/elastic_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def with_environment(&block)
env_vars['ES_JAVA_OPTS'] = env_vars['ES_JAVA_OPTS'].join(' ')

env_vars.each do |env_var, value|
saved_vars[env_var] = ENV[env_var]
saved_vars[env_var] = ENV.fetch(env_var, nil)
ENV[env_var] = value
end

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
4 changes: 2 additions & 2 deletions lib/puppet/type/elasticsearch_component_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def insync?(value)
val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index'
(val['template']['settings'].keys - ['index']).each do |setting|
new_key = if setting.start_with? 'index.'
setting[6..-1]
setting[6..]
else
setting
end
Expand Down 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
4 changes: 2 additions & 2 deletions lib/puppet/type/elasticsearch_ilm_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
end

def insync?(value)
Puppet_X::Elastic.deep_implode(value) == \
Puppet_X::Elastic.deep_implode(value) ==
Puppet_X::Elastic.deep_implode(should)
end

Expand Down 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
4 changes: 2 additions & 2 deletions lib/puppet/type/elasticsearch_index_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def insync?(value)
val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index'
(val['template']['settings'].keys - ['index']).each do |setting|
new_key = if setting.start_with? 'index.'
setting[6..-1]
setting[6..]
else
setting
end
Expand Down 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
4 changes: 2 additions & 2 deletions lib/puppet/type/elasticsearch_license.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def insync?(value)
def should_to_s(newvalue)
newvalue.transform_values do |license_data|
if license_data.is_a? Hash
license_data.map do |field, value|
license_data.to_h do |field, value|
[field, field == 'signature' ? '[redacted]' : value]
end.to_h
end
else
v
end
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/type/elasticsearch_slm_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
end

def insync?(value)
Puppet_X::Elastic.deep_implode(value) == \
Puppet_X::Elastic.deep_implode(value) ==
Puppet_X::Elastic.deep_implode(should)
end

Expand Down 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
4 changes: 2 additions & 2 deletions lib/puppet/type/elasticsearch_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
val['settings']['index'] = {} unless val['settings'].key? 'index'
(val['settings'].keys - ['index']).each do |setting|
new_key = if setting.start_with? 'index.'
setting[6..-1]
setting[6..]
else
setting
end
Expand Down 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
37 changes: 23 additions & 14 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,29 @@
mode => '0440',
}

if ($elasticsearch::version != false and versioncmp($elasticsearch::version, '7.7.0') >= 0) {
file { "${elasticsearch::configdir}/jvm.options":
ensure => 'file',
notify => $elasticsearch::_notify_service,
require => Class['elasticsearch::package'],
owner => 'root',
group => $elasticsearch::elasticsearch_group,
mode => '0640',
}

if ($elasticsearch::version != false and versioncmp($elasticsearch::version, '7.7.0') < 0) {
# Add any additional JVM options
$elasticsearch::jvm_options.each |String $jvm_option| {
$split_jvm_option = split($jvm_option, '=')
file_line { "jvm_option_${jvm_option}":
ensure => present,
path => "${elasticsearch::configdir}/jvm.options",
match => $split_jvm_option.length ? { 2 => "^${split_jvm_option[0]}=", default => undef, },
line => $jvm_option,
notify => $elasticsearch::_notify_service,
}
}
}
else {
# https://www.elastic.co/guide/en/elasticsearch/reference/master/advanced-configuration.html#set-jvm-options
# https://github.com/elastic/elasticsearch/pull/51882
# >> "Do not modify the root jvm.options file. Use files in jvm.options.d/ instead."
Expand All @@ -197,19 +219,6 @@
notify => $elasticsearch::_notify_service,
}
}
else {
# Add any additional JVM options
$elasticsearch::jvm_options.each |String $jvm_option| {
$split_jvm_option = split($jvm_option, '=')
file_line { "jvm_option_${jvm_option}":
ensure => present,
path => "${elasticsearch::configdir}/jvm.options",
match => $split_jvm_option.length ? { 2 => "^${split_jvm_option[0]}=", default => undef, },
line => $jvm_option,
notify => $elasticsearch::_notify_service,
}
}
}

if $elasticsearch::system_key != undef {
file { "${elasticsearch::configdir}/system_key":
Expand Down
Loading

0 comments on commit 147c743

Please sign in to comment.