From e8ea094043d437ed16006953cac9c2aed51a0367 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 10 Feb 2023 13:06:23 +0100 Subject: [PATCH 1/2] Use data types in function arguments --- functions/bool2num_hash_recursive.pp | 5 ++--- spec/functions/bool2num_hash_recursive_spec.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/functions/bool2num_hash_recursive.pp b/functions/bool2num_hash_recursive.pp index 4ede1091..a8c6d5a3 100644 --- a/functions/bool2num_hash_recursive.pp +++ b/functions/bool2num_hash_recursive.pp @@ -26,8 +26,7 @@ # qux => [{ 'c' => true }, { 'd' => false }], # } # -function yum::bool2num_hash_recursive($arg) { - assert_type(Hash, $arg) +function yum::bool2num_hash_recursive(Hash $arg) >> Hash { $arg.map |$key, $value| { $return_value = $value ? { Boolean => bool2num($value), @@ -38,6 +37,6 @@ function yum::bool2num_hash_recursive($arg) { # https://github.com/kuleuven/puppet-lint-manifest_whitespace-check/issues/8 Hash({ $key => $return_value }) }.reduce |$attrs_memo, $kv| { - merge($attrs_memo, $kv) + $attrs_memo + $kv } } diff --git a/spec/functions/bool2num_hash_recursive_spec.rb b/spec/functions/bool2num_hash_recursive_spec.rb index 3a0c75b0..b11ce720 100644 --- a/spec/functions/bool2num_hash_recursive_spec.rb +++ b/spec/functions/bool2num_hash_recursive_spec.rb @@ -36,6 +36,6 @@ end it 'fails on an array' do - is_expected.to run.with_params([true, false]).and_raise_error(Puppet::Error) + is_expected.to run.with_params([true, false]).and_raise_error(ArgumentError) end end From 8d07a8d239aa83bd3729ef0feefe6da68d325e67 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 10 Feb 2023 13:24:06 +0100 Subject: [PATCH 2/2] [WIP] Use my fork of gha-puppet to investigate issue --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a077911..cad3aa61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: ekohl/gha-puppet/.github/workflows/beaker.yml@use-short-domain with: pidfile_workaround: 'false'