From a418738833e00b78bb0cff31c00795e1a0d30115 Mon Sep 17 00:00:00 2001 From: "R.I.Pienaar" Date: Thu, 26 Sep 2019 10:18:08 +0200 Subject: [PATCH] (#241) support setting some files as executable --- data/common.yaml | 1 + data/os/windows.yaml | 1 + manifests/init.pp | 2 ++ manifests/module_plugin.pp | 10 +++++++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/data/common.yaml b/data/common.yaml index 8166f97..9ac407e 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -64,6 +64,7 @@ mcollective::service_enable: true mcollective::plugin_owner: "root" mcollective::plugin_group: "root" mcollective::plugin_mode: "0644" +mcollective::plugin_executable_mode: "0755" mcollective::bindir: "/usr/bin" mcollective::libdir: "/opt/puppetlabs/mcollective/plugins" mcollective::configdir: "/etc/puppetlabs/mcollective" diff --git a/data/os/windows.yaml b/data/os/windows.yaml index 2384ed7..a38737d 100644 --- a/data/os/windows.yaml +++ b/data/os/windows.yaml @@ -1,6 +1,7 @@ mcollective::plugin_owner: ~ mcollective::plugin_group: ~ mcollective::plugin_mode: ~ +mcollective::plugin_executable_mode: ~ mcollective::bindir: "C:/Program Files/Puppet Labs/Puppet/bin" mcollective::libdir: "C:/ProgramData/PuppetLabs/mcollective/plugins" diff --git a/manifests/init.pp b/manifests/init.pp index 9b36839..3d691b4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,6 +19,7 @@ # @param plugin_owner The default user who will own plugin files # @param plugin_group The default group who will own plugin files # @param plugin_mode The default mode plugin files will have +# @param plugin_executable_mode The default mode executable plugin files will have # @param required_directories Any extra directories that should be created before copying plugins and configuration # @param policy_default When managing plugin policies this will be the default allow/deny # @param site_policies Policies to apply to all agents after any module specific policies @@ -56,6 +57,7 @@ Optional[String] $plugin_owner, Optional[String] $plugin_group, Optional[String] $plugin_mode, + Optional[String] $plugin_executable_mode, Array[String] $required_directories = [], Mcollective::Policy_action $policy_default, Array[Mcollective::Policy] $site_policies = [], diff --git a/manifests/module_plugin.pp b/manifests/module_plugin.pp index e34192c..4735b63 100644 --- a/manifests/module_plugin.pp +++ b/manifests/module_plugin.pp @@ -6,6 +6,7 @@ Array[String] $server_directories = [], Array[String] $common_files = [], Array[String] $common_directories = [], + Array[String] $executable_files = [], Boolean $manage_gem_dependencies = true, Hash $gem_dependencies = {}, Boolean $manage_package_dependencies = true, @@ -25,6 +26,7 @@ Optional[String] $owner = $mcollective::plugin_owner, Optional[String] $group = $mcollective::plugin_group, Optional[String] $mode = $mcollective::plugin_mode, + Optional[String] $executable_mode = $mcollective::plugin_executable_mode, Enum["present", "absent"] $ensure = "present" ) { if $client or $server { @@ -118,12 +120,18 @@ $f_tag = undef } + if $file in $executable_files { + $_mode = $executable_mode + } else { + $_mode = $mode + } + file{"${libdir}/mcollective/${file}": ensure => $ensure, source => "puppet:///modules/${caller_module_name}/mcollective/${file}", owner => $owner, group => $group, - mode => $mode, + mode => $_mode, tag => $f_tag }