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

Port code to Puppet 7 and 8 #5

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
fixtures:
repositories:
stdlib:
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,12 @@

name: CI

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

concurrency:
group: ${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '7.2.0'
modulesync_config_version: '7.3.0'
10 changes: 5 additions & 5 deletions manifests/files.pp
Original file line number Diff line number Diff line change
@@ -33,15 +33,15 @@
#
define swap_file::files (
Enum['absent','present'] $ensure = 'present',
Stdlib::Unixpath $swapfile = '/mnt/swap.1',
Stdlib::Absolutepath $swapfile = '/mnt/swap.1',
$swapfilesize = $facts['memory']['system']['total'],
Boolean $add_mount = true,
$options = 'defaults',
String $options = 'defaults',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good but we should re-enable the tests which are disabled in puppet-lint.rc or whatever it is... Actually am a bit confused why the modulesync did not fix the file.

$timeout = 300,
$cmd = 'dd',
$resize_existing = false,
String $cmd = 'dd',
Bootlan $resize_existing = false,
$resize_margin = '50MB',
$resize_verbose = false,
Boolean $resize_verbose = false,
) {
# Parameter validation
$swapfilesize_mb = to_bytes($swapfilesize) / 1048576
15 changes: 4 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -40,19 +40,12 @@
# @author - Peter Souter
#
class swap_file (
Hash $files = {},
Variant[Boolean,Enum['true','false']] $files_hiera_merge = false,
Hash $files = {},
Boolean $files_hiera_merge = false,
) {
# variable handling
if $files_hiera_merge =~ Boolean {
$files_hiera_merge_bool = $files_hiera_merge
} else {
$files_hiera_merge_bool = str2bool($files_hiera_merge)
}

# functionality
if $files_hiera_merge_bool == true {
$files_real = lookup('swap_file::files', Hash, 'deep', {})
if $files_hiera_merge {
$files_real = hiera_hash('swap_file::files', {})
} else {
$files_real = $files
}
6 changes: 3 additions & 3 deletions manifests/resize.pp
Original file line number Diff line number Diff line change
@@ -16,11 +16,11 @@
# @author - Peter Souter
#
define swap_file::resize (
$swapfile_path,
Stdlib::Absolutepath $swapfile_path,
$expected_swapfile_size,
$actual_swapfile_size,
$margin = '50MB',
$verbose = false,
$margin = '50MB',
Boolean $verbose = false,
) {
$margin_bytes = to_bytes($margin)
$existing_swapfile_bytes = to_bytes("${actual_swapfile_size}kb")
22 changes: 15 additions & 7 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -11,23 +11,31 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"5",
"6",
"7"
"7",
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8",
"9"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
"7"
"11",
"12"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"12.04",
"14.04"
"20.04",
"22.04"
]
}
],
Loading