From cacc4edc6bc6b73ec0fafaa02482f7de9516901b Mon Sep 17 00:00:00 2001 From: Alessandro Franceschi Date: Mon, 2 Mar 2020 19:04:19 +0100 Subject: [PATCH] Fix 70 (#71) * Ensure we find tp command in task tp::test * Fix for #70 --- functions/ensure2dir.pp | 1 - functions/ensure2file.pp | 11 +++++++++++ manifests/install.pp | 4 ++-- tasks/test.sh | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 functions/ensure2file.pp diff --git a/functions/ensure2dir.pp b/functions/ensure2dir.pp index f492024..b48526e 100644 --- a/functions/ensure2dir.pp +++ b/functions/ensure2dir.pp @@ -1,6 +1,5 @@ function tp::ensure2dir ( Variant[Boolean,String] $input = present, - $default = undef, ) { $output = $input ? { diff --git a/functions/ensure2file.pp b/functions/ensure2file.pp new file mode 100644 index 0000000..0ae81d7 --- /dev/null +++ b/functions/ensure2file.pp @@ -0,0 +1,11 @@ +function tp::ensure2file ( + Variant[Boolean,String] $input = present, +) { + + $output = $input ? { + 'absent' => absent, + false => absent, + default => present, + } + +} diff --git a/manifests/install.pp b/manifests/install.pp index deb4ac4..01303c7 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -291,7 +291,7 @@ # Manage additional tp::conf as in conf_hash $conf_defaults = { - 'ensure' => $ensure, + 'ensure' => tp::ensure2file($ensure), 'settings_hash' => $settings, 'options_hash' => $options_hash, } @@ -305,7 +305,7 @@ # Manage additional tp::dir as in dir_hash $dir_defaults = { - 'ensure' => $ensure, + 'ensure' => tp::ensure2dir($ensure), 'settings_hash' => $settings, } if $dir_hash != {} { diff --git a/tasks/test.sh b/tasks/test.sh index 7688c45..d2d9f5b 100644 --- a/tasks/test.sh +++ b/tasks/test.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash declare tp_options +PATH=$PATH:/usr/local/bin [[ -n "${PT_app}" ]] && tp_options="${PT_app}" tp test $tp_options