Skip to content

Commit

Permalink
(#241) support setting some files as executable
Browse files Browse the repository at this point in the history
  • Loading branch information
ripienaar committed Sep 26, 2019
1 parent a71c952 commit a418738
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions data/os/windows.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = [],
Expand Down
10 changes: 9 additions & 1 deletion manifests/module_plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit a418738

Please sign in to comment.