Skip to content

Commit

Permalink
Merge pull request #203 from voxpupuli/modulesync
Browse files Browse the repository at this point in the history
modulesync 9.3.0
  • Loading branch information
bastelfreak authored Nov 1, 2024
2 parents a5a0858 + 1599b9c commit 34dce40
Show file tree
Hide file tree
Showing 26 changed files with 210 additions and 118 deletions.
39 changes: 30 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,29 @@ You can install all needed gems for spec tests into the modules directory by
running:

```sh
bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)"
bundle config set --local path '.vendor/'
bundle config set --local without 'development system_tests release'
bundle install --jobs "$(nproc)"
```

If you also want to run acceptance tests:

```sh
bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"
bundle config set --local path '.vendor/'
bundle config set --local without 'development release'
bundle config set --local with 'system_tests'
bundle install --jobs "$(nproc)"
```

Our all in one solution if you don't know if you need to install or update gems:

```sh
bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean
bundle config set --local path '.vendor/'
bundle config set --local without 'development release'
bundle config set --local with 'system_tests'
bundle install --jobs "$(nproc)"
bundle update
bundle clean
```

As an alternative to the `--jobs "$(nproc)` parameter, you can set an
Expand Down Expand Up @@ -232,18 +242,29 @@ 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.
or

```sh
BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker
```

This latter example will use the distribution's own version of Puppet.

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
* debian12
* centos9
* archlinux
* almalinux8
* almalinux9
* fedora36

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

Expand Down
5 changes: 3 additions & 2 deletions .rspec → .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

--format documentation
--color
skip-changelog:
- head-branch: ['^release-*', 'release']
42 changes: 42 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
exclude:
labels:
- duplicate
- invalid
- modulesync
- question
- skip-changelog
- wont-fix
- wontfix

categories:
- title: Breaking Changes 🛠
labels:
- backwards-incompatible

- title: New Features 🎉
labels:
- enhancement

- title: Bug Fixes 🐛
labels:
- bug

- title: Documentation Updates 📚
labels:
- documentation
- docs

- title: Dependency Updates ⬆️
labels:
- dependencies

- title: Other Changes
labels:
- "*"
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

name: CI

on: pull_request
# yamllint disable-line rule:truthy
on:
pull_request: {}
push:
branches:
- main
- master

concurrency:
group: ${{ github.ref_name }}
Expand All @@ -13,6 +19,4 @@ concurrency:
jobs:
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
with:
pidfile_workaround: 'CentOS'
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3
18 changes: 18 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

name: "Pull Request Labeler"

# yamllint disable-line rule:truthy
on:
pull_request_target: {}

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

name: Release

# yamllint disable-line rule:truthy
on:
push:
tags:
Expand All @@ -12,11 +13,18 @@ on:
jobs:
release:
name: Release
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3
with:
allowed_owner: 'voxpupuli'
secrets:
# Configure secrets here:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}

create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Create GitHub release
uses: voxpupuli/gha-create-a-github-release@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
.*.sw?
/.yardoc/
/Guardfile
bolt-debug.log
.rerun.json
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: '6.0.0'
modulesync_config_version: '9.3.0'
8 changes: 5 additions & 3 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ PreCommit:
enabled: true
description: 'Runs rubocop on modified files only'
command: ['bundle', 'exec', 'rubocop']
PuppetLint:
RakeTarget:
enabled: true
description: 'Runs puppet-lint on modified files only'
command: ['bundle', 'exec', 'puppet-lint']
description: 'Runs lint on modified files only'
targets:
- 'lint'
command: ['bundle', 'exec', 'rake']
YamlSyntax:
enabled: true
JsonSyntax:
Expand Down
2 changes: 2 additions & 0 deletions .pmtignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/.github/
/.librarian/
/Puppetfile.lock
/Puppetfile
*.iml
/.editorconfig
/.fixtures.yml
Expand All @@ -35,3 +36,4 @@
/.yardoc/
/.yardopts
/Dockerfile
/HISTORY.md
3 changes: 3 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

--fail-on-warnings
--no-parameter_documentation-check
--no-parameter_types-check
4 changes: 0 additions & 4 deletions .rspec_parallel

This file was deleted.

1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

inherit_from: .rubocop_todo.yml
inherit_gem:
voxpupuli-test: rubocop.yml
13 changes: 13 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-08-17 21:37:00 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: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/MapToHash:
Exclude:
- 'lib/puppet/provider/proxy_mysql_galera_hostgroup/proxysql.rb'
24 changes: 0 additions & 24 deletions Dockerfile

This file was deleted.

12 changes: 5 additions & 7 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', '~> 6.0', :require => false
gem 'voxpupuli-test', '~> 9.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 3.0', :require => false
gem 'puppet_metadata', '~> 4.0', :require => false
gem 'puppet-lint-param-docs', :require => false
end

Expand All @@ -17,19 +17,17 @@ group :development do
end

group :system_tests do
gem 'voxpupuli-acceptance', '~> 2.0', :require => false
gem 'voxpupuli-acceptance', '~> 3.0', :require => false
end

group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false
gem 'voxpupuli-release', '~> 3.0', :require => false
gem 'faraday-retry', '~> 2.1', :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'] || '~> 7.24'
puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"]
gem 'puppet', puppetversion, :require => false, :groups => [:test]

# vim: syntax=ruby
18 changes: 9 additions & 9 deletions lib/puppet/provider/proxy_cluster/proxysql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def self.instances
# one big swoop.
servers.each do |line|
hostname, port = line.split(%r{\t})
query = 'SELECT `hostname`, `port`, `weight`, `comment`' \
' FROM `proxysql_servers`' \
" WHERE `hostname` = '#{hostname}' AND `port` = #{port}"
query = 'SELECT `hostname`, `port`, `weight`, `comment` ' \
'FROM `proxysql_servers` ' \
"WHERE `hostname` = '#{hostname}' AND `port` = #{port}"

@hostname, @port, @weight, @comment = mysql([defaults_file, '-NBe', query].compact).chomp.split(%r{\t})
name = "#{hostname}:#{port}"
Expand Down Expand Up @@ -58,8 +58,8 @@ def create
weight = @resource.value(:weight) || 0
comment = @resource.value(:comment) || ''

query = 'INSERT INTO proxysql_servers (`hostname`, `port`, `weight`, `comment`)' \
" VALUES ('#{hostname}', #{port}, #{weight}, '#{comment}')"
query = 'INSERT INTO proxysql_servers (`hostname`, `port`, `weight`, `comment`) ' \
"VALUES ('#{hostname}', #{port}, #{weight}, '#{comment}')"
mysql([defaults_file, '-e', query].compact)
@property_hash[:ensure] = :present

Expand All @@ -69,8 +69,8 @@ def create
def destroy
hostname = @property_hash[:hostname]
port = @property_hash[:port]
query = 'DELETE FROM `proxysql_servers`' \
" WHERE `hostname` = '#{hostname}' AND `port` = #{port}"
query = 'DELETE FROM `proxysql_servers` ' \
"WHERE `hostname` = '#{hostname}' AND `port` = #{port}"
mysql([defaults_file, '-e', query].compact)

@property_hash.clear
Expand Down Expand Up @@ -108,8 +108,8 @@ def update_server(properties)
values.push("`#{field}` = '#{value}'")
end

query = "UPDATE proxysql_servers SET #{values.join(', ')}" \
" WHERE `hostname` = '#{hostname}' AND `port` = #{port}"
query = "UPDATE proxysql_servers SET #{values.join(', ')} " \
"WHERE `hostname` = '#{hostname}' AND `port` = #{port}"
mysql([defaults_file, '-e', query].compact)

@property_hash.clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def self.prefetch(resources)
end

def create
query_parameters = self.class.db_fields.map { |param| [param, resource[param]] }.to_h.compact
query_parameters = self.class.db_fields.to_h { |param| [param, resource[param]] }.compact

columns = query_parameters.keys.map { |k| "`#{k}`" }.join(',')
values = query_parameters.values.map { |value| make_sql_value(value) }.join(',')
Expand Down
Loading

0 comments on commit 34dce40

Please sign in to comment.