From bd9b55cc71a6c54d2a27348aec601f8fe7b65bfe Mon Sep 17 00:00:00 2001 From: Robin Barling Date: Thu, 11 Nov 2021 08:40:17 +1300 Subject: [PATCH] Add muna version parameter --- .gitignore | 1 + manifests/init.pp | 3 ++- manifests/install.pp | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..757fee3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea \ No newline at end of file diff --git a/manifests/init.pp b/manifests/init.pp index c2d0e9b..2fa4b83 100755 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,5 +1,6 @@ class muna ( $download_link, + $muna_binary_version = undef, $enabled = false, $aws_key = undef, $aws_secret = undef, @@ -10,4 +11,4 @@ ) { class { 'muna::install': } -> class { 'muna::config': } -} +} \ No newline at end of file diff --git a/manifests/install.pp b/manifests/install.pp index 2824c69..35380ee 100755 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -19,11 +19,18 @@ $proxy_environment = [] } + # default to previous test if version not available + if $muna_binary_version { + $exec_test = "[ ! -f /opt/muna/bin/muna ] || [ ${muna_binary_version} != `/opt/muna/bin/muna version | head -n 1 | cut -d ' ' -f2` ]" + } else { + $exec_test = "test ! -f /opt/muna/bin/muna" + } + exec { "muna_download": command => "curl -s -f ${download_link} -o /opt/muna/bin/muna", path => '/usr/bin:/usr/sbin:/bin', environment => $proxy_environment, - onlyif => "test ! -f /opt/muna/bin/muna", + onlyif => $exec_test, require => File["/opt/muna/bin"] }