Skip to content

Commit

Permalink
Revert "(choria-io#229) avoid duplicate resources"
Browse files Browse the repository at this point in the history
This reverts commit f428883.
  • Loading branch information
ripienaar committed Sep 19, 2019
1 parent 77e13a6 commit 6d27acc
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions manifests/module_plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,25 @@
Optional[String] $owner = $mcollective::plugin_owner,
Optional[String] $group = $mcollective::plugin_group,
Optional[String] $mode = $mcollective::plugin_mode,
Enum["present", "absent"] $ensure = "present",
Boolean $activate_agent = true,
Enum["present", "absent"] $ensure = "present"
Boolean $activate_agent = true
Boolean $activate_client = true
) {
$_agent = $name =~ /^mcollective_agent_/

if $client or $server {
if ($server and $client) {
$activate_config = $_agent ? {true => {"activate_agent" => $activate_agent, "activate_client" => $activate_client}, false => {}}
$activate_config = {"activate_agent" => $activate_agent, "activate_client" => $activate_client}
$merged_conf = $config.deep_merge($client_config).deep_merge($server_config) + $activate_config
$merged_files = $common_files + $server_files + $client_files
$merged_directories = $common_directories + $server_directories + $client_directories

} elsif ($server) {
$activate_config = $_agent ? {true => {"activate_agent" => $activate_agent, "activate_client" => false}, false => {}}
$activate_config = {"activate_agent" => $activate_agent, "activate_client" => false}
$merged_conf = $config.deep_merge($server_config) + $activate_config
$merged_files = $common_files + $server_files
$merged_directories = $common_directories + $server_directories

} elsif ($client) {
$activate_config = $_agent ? {true => {"activate_agent" => false, "activate_client" => $activate_client}, false => {}}
$activate_config = {"activate_agent" => false, "activate_client" => $activate_client}
$merged_conf = $config.deep_merge($client_config) + $activate_config
$merged_files = $common_files + $client_files
$merged_directories = $common_directories + $client_directories
Expand Down Expand Up @@ -96,17 +94,12 @@
}

unless $merged_conf.empty {
# the bolt agent and main choria coded both use choria as plugin name which breaks this
# we have to fix that when moving to the new model for distributing plugins for now
# this is the only way
unless defined(Mcollective::Config_file["${configdir}/plugin.d/${config_name}.cfg"]) {
mcollective::config_file{"${configdir}/plugin.d/${config_name}.cfg":
ensure => $ensure,
settings => $merged_conf,
owner => $owner,
group => $group,
mode => $mode
}
mcollective::config_file { "${configdir}/plugin.d/${config_name}.cfg":
ensure => $ensure,
settings => $merged_conf,
owner => $owner,
group => $group,
mode => $mode
}
}

Expand Down

0 comments on commit 6d27acc

Please sign in to comment.