Skip to content

Commit 9680701

Browse files
authored
Merge pull request voxpupuli#672 from traylenator/puppet6
Drop EoL Puppet 6
2 parents 37c6b28 + 67f9eb6 commit 9680701

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+459
-425
lines changed

.github/CONTRIBUTING.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet,
124124
you must set an environment variable such as:
125125

126126
```sh
127-
export PUPPET_VERSION="~> 5.5.6"
127+
export PUPPET_GEM_VERSION="~> 6.1.0"
128128
```
129129

130130
You can install all needed gems for spec tests into the modules directory by
@@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this
232232
with:
233233

234234
```sh
235-
BEAKER_setfile=debian10-x64 bundle exec rake beaker
235+
BEAKER_setfile=debian11-64 bundle exec rake beaker
236236
```
237237

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

241-
* ubuntu1604
242241
* ubuntu1804
243242
* ubuntu2004
244-
* debian9
245243
* debian10
244+
* debian11
246245
* centos7
247246
* centos8
248247

.github/SECURITY.md

-3
This file was deleted.

.github/workflows/release.yml

+10-22
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,14 @@ on:
99
tags:
1010
- '*'
1111

12-
env:
13-
BUNDLE_WITHOUT: development:test:system_tests
14-
1512
jobs:
16-
deploy:
17-
name: 'deploy to forge'
18-
runs-on: ubuntu-latest
19-
if: github.repository_owner == 'voxpupuli'
20-
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v2
23-
- name: Setup Ruby
24-
uses: ruby/setup-ruby@v1
25-
with:
26-
ruby-version: '2.7'
27-
bundler-cache: true
28-
- name: Build and Deploy
29-
env:
30-
# Configure secrets here:
31-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
32-
BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
33-
BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}'
34-
run: bundle exec rake module:push
13+
release:
14+
name: Release
15+
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
16+
with:
17+
allowed_owner: 'voxpupuli'
18+
secrets:
19+
# Configure secrets here:
20+
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
21+
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
22+
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}

.gitignore

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Managed by modulesync - DO NOT EDIT
22
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
33

4-
pkg/
5-
Gemfile.lock
6-
Gemfile.local
7-
vendor/
8-
.vendor/
9-
spec/fixtures/manifests/
10-
spec/fixtures/modules/
11-
.vagrant/
12-
.bundle/
13-
.ruby-version
14-
coverage/
15-
log/
16-
.idea/
17-
.dependencies/
18-
.librarian/
19-
Puppetfile.lock
4+
/pkg/
5+
/Gemfile.lock
6+
/Gemfile.local
7+
/vendor/
8+
/.vendor/
9+
/spec/fixtures/manifests/
10+
/spec/fixtures/modules/
11+
/.vagrant/
12+
/.bundle/
13+
/.ruby-version
14+
/coverage/
15+
/log/
16+
/.idea/
17+
/.dependencies/
18+
/.librarian/
19+
/Puppetfile.lock
2020
*.iml
2121
.*.sw?
22-
.yardoc/
23-
Guardfile
22+
/.yardoc/
23+
/Guardfile

.msync.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Managed by modulesync - DO NOT EDIT
33
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
44

5-
modulesync_config_version: '4.2.0'
5+
modulesync_config_version: '6.0.0'

.pmtignore

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
# Managed by modulesync - DO NOT EDIT
22
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
33

4-
docs/
5-
pkg/
6-
Gemfile
7-
Gemfile.lock
8-
Gemfile.local
9-
vendor/
10-
.vendor/
11-
spec/
12-
Rakefile
13-
.vagrant/
14-
.bundle/
15-
.ruby-version
16-
coverage/
17-
log/
18-
.idea/
19-
.dependencies/
20-
.github/
21-
.librarian/
22-
Puppetfile.lock
4+
/docs/
5+
/pkg/
6+
/Gemfile
7+
/Gemfile.lock
8+
/Gemfile.local
9+
/vendor/
10+
/.vendor/
11+
/spec/
12+
/Rakefile
13+
/.vagrant/
14+
/.bundle/
15+
/.ruby-version
16+
/coverage/
17+
/log/
18+
/.idea/
19+
/.dependencies/
20+
/.github/
21+
/.librarian/
22+
/Puppetfile.lock
2323
*.iml
24-
.editorconfig
25-
.fixtures.yml
26-
.gitignore
27-
.msync.yml
28-
.overcommit.yml
29-
.pmtignore
30-
.rspec
31-
.rspec_parallel
32-
.rubocop.yml
33-
.sync.yml
24+
/.editorconfig
25+
/.fixtures.yml
26+
/.gitignore
27+
/.msync.yml
28+
/.overcommit.yml
29+
/.pmtignore
30+
/.rspec
31+
/.rspec_parallel
32+
/.rubocop.yml
33+
/.sync.yml
3434
.*.sw?
35-
.yardoc/
36-
.yardopts
37-
Dockerfile
35+
/.yardoc/
36+
/.yardopts
37+
/Dockerfile

.puppet-lint.rc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--fail-on-warnings
2+
--no-parameter_documentation-check
3+
--no-parameter_types-check

Gemfile

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Managed by modulesync - DO NOT EDIT
22
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
33

4-
source ENV['GEM_SOURCE'] || "https://rubygems.org"
4+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
55

66
group :test do
7-
gem 'voxpupuli-test', '~> 2.5', :require => false
7+
gem 'voxpupuli-test', '~> 6.0', :require => false
88
gem 'coveralls', :require => false
99
gem 'simplecov-console', :require => false
10-
gem 'puppet_metadata', '~> 1.0', :require => false
10+
gem 'puppet_metadata', '~> 3.0', :require => false
1111
end
1212

1313
group :development do
@@ -16,19 +16,19 @@ group :development do
1616
end
1717

1818
group :system_tests do
19-
gem 'voxpupuli-acceptance', '~> 1.0', :require => false
19+
gem 'voxpupuli-acceptance', '~> 2.0', :require => false
2020
end
2121

2222
group :release do
23-
gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
24-
gem 'voxpupuli-release', '>= 1.0.2', :require => false
25-
gem 'puppet-strings', '>= 2.2', :require => false
23+
gem 'github_changelog_generator', '>= 1.16.1', :require => false
24+
gem 'voxpupuli-release', '~> 3.0', :require => false
25+
gem 'faraday-retry', '~> 2.1', :require => false
2626
end
2727

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

31-
puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0'
31+
puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24'
3232
gem 'puppet', puppetversion, :require => false, :groups => [:test]
3333

3434
# vim: syntax=ruby

REFERENCE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ Default value: `$mongodb::params::logpath`
14691469

14701470
##### <a name="-mongodb--server--bind_ip"></a>`bind_ip`
14711471

1472-
Data type: `Array[Stdlib::Compat::Ip_address]`
1472+
Data type: `Array[Stdlib::IP::Address]`
14731473

14741474

14751475

Rakefile

+5-33
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Managed by modulesync - DO NOT EDIT
22
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
33

4-
# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
4+
# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper),
55
# otherwise attempt to load it directly.
66
begin
77
require 'voxpupuli/test/rake'
@@ -24,6 +24,10 @@ end
2424
begin
2525
require 'voxpupuli/release/rake_tasks'
2626
rescue LoadError
27+
# voxpupuli-release not present
28+
else
29+
GCGConfig.user = 'voxpupuli'
30+
GCGConfig.project = 'puppet-mongodb'
2731
end
2832

2933
desc "Run main 'test' task and report merged results to coveralls"
@@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do
3741
end
3842
end
3943

40-
desc 'Generate REFERENCE.md'
41-
task :reference, [:debug, :backtrace] do |t, args|
42-
patterns = ''
43-
Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace])
44-
end
45-
46-
begin
47-
require 'github_changelog_generator/task'
48-
require 'puppet_blacksmith'
49-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
50-
metadata = Blacksmith::Modulefile.new
51-
config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/
52-
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
53-
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
54-
config.user = 'voxpupuli'
55-
config.project = metadata.metadata['name']
56-
end
57-
58-
# Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715
59-
require 'rbconfig'
60-
if RbConfig::CONFIG['host_os'] =~ /linux/
61-
task :changelog do
62-
puts 'Fixing line endings...'
63-
changelog_file = File.join(__dir__, 'CHANGELOG.md')
64-
changelog_txt = File.read(changelog_file)
65-
new_contents = changelog_txt.gsub(%r{\r\n}, "\n")
66-
File.open(changelog_file, "w") {|file| file.puts new_contents }
67-
end
68-
end
69-
70-
rescue LoadError
71-
end
7244
# vim: syntax=ruby

lib/facter/is_master.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'json'
24
require 'yaml'
35

lib/facter/mongodb_version.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen_string_literal: true
2+
13
Facter.add(:mongodb_version) do
24
setcode do
35
if Facter::Core::Execution.which('mongo')
46
mongodb_version = Facter::Core::Execution.execute('mongo --version 2>&1')
5-
%r{MongoDB shell version:?\s+v?([\w\.]+)}.match(mongodb_version)[1]
7+
%r{MongoDB shell version:?\s+v?([\w.]+)}.match(mongodb_version)[1]
68
end
79
end
810
end

lib/puppet/functions/mongodb_password.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require_relative File.join('..', 'util', 'mongodb_md5er')
24

35
# Get the mongodb password hash from the clear text password.

lib/puppet/provider/mongodb.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..'))
24
require 'puppet/util/mongodb_output'
35

@@ -110,7 +112,7 @@ def self.conn_string
110112
ip_real = case first_ip_in_list
111113
when '0.0.0.0'
112114
Facter.value(:fqdn)
113-
when %r{\[?::0\]?}
115+
when %r{\[?::0\]?} # rubocop:disable Lint/DuplicateBranch
114116
Facter.value(:fqdn)
115117
else
116118
first_ip_in_list
@@ -163,18 +165,16 @@ def self.mongo_eval(cmd, db = 'admin', retries = 10, host = nil)
163165
else
164166
mongo_cmd(db, conn_string, cmd)
165167
end
166-
rescue => e
168+
rescue StandardError => e
167169
retry_count -= 1
168-
if retry_count > 0
170+
if retry_count.positive?
169171
Puppet.debug "Request failed: '#{e.message}' Retry: '#{retries - retry_count}'"
170172
sleep retry_sleep
171173
retry
172174
end
173175
end
174176

175-
unless out
176-
raise Puppet::ExecutionFailure, "Could not evaluate MongoDB shell command: #{cmd}"
177-
end
177+
raise Puppet::ExecutionFailure, "Could not evaluate MongoDB shell command: #{cmd}" unless out
178178

179179
Puppet::Util::MongodbOutput.sanitize(out)
180180
end

lib/puppet/provider/mongodb_conn_validator/tcp_port.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))
24
require 'puppet/util/mongodb_validator'
35

lib/puppet/provider/mongodb_database/mongodb.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mongodb'))
24
Puppet::Type.type(:mongodb_database).provide(:mongodb, parent: Puppet::Provider::Mongodb) do
35
desc 'Manages MongoDB database.'
@@ -8,7 +10,7 @@ def self.instances
810
require 'json'
911

1012
pre_cmd = 'try { rs.secondaryOk() } catch (err) { rs.slaveOk() }'
11-
dbs = JSON.parse mongo_eval(pre_cmd + ';printjson(db.getMongo().getDBs())')
13+
dbs = JSON.parse mongo_eval("#{pre_cmd};printjson(db.getMongo().getDBs())")
1214

1315
dbs['databases'].map do |db|
1416
new(name: db['name'],
@@ -19,7 +21,7 @@ def self.instances
1921
# Assign prefetched dbs based on name.
2022
def self.prefetch(resources)
2123
dbs = instances
22-
resources.keys.each do |name|
24+
resources.each_key do |name|
2325
provider = dbs.find { |db| db.name == name }
2426
resources[name].provider = provider if provider
2527
end

0 commit comments

Comments
 (0)