Skip to content

Commit

Permalink
11: Support sub collectives
Browse files Browse the repository at this point in the history
This adds handling for collectives and subcollectives via specific
properties
  • Loading branch information
ripienaar committed Jul 8, 2016
1 parent 266a22f commit eec5d36
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.9
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
|Date |Issue|Description |
|----------|-----|---------------------------------------------------------------------------------------------------------|
|2016/07/06|11 |Support collectives |
|2016/06/29|4 |Remove hard coded paths and move them to Hiera |
|2016/06/30|1 |Support actionpolicy |
|2016/06/30|2 |Support Windows |
Expand Down
5 changes: 5 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
mcollective::collectives:
- "mcollective"

mcollective::common_config:
securityprovider: "puppet"
identity: "%{trusted.certname}"
Expand Down Expand Up @@ -42,6 +45,8 @@ mcollective::plugintypes:
- "pluginpackager"

lookup_options:
mcollective::collectives:
merge: "unique"
mcollective::plugin_classes:
merge: "unique"
mcollective::client_config:
Expand Down
22 changes: 22 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
$server_config = $mcollective::common_config + $mcollective::server_config
$client_config = $mcollective::common_config + $mcollective::client_config

if $mcollective::main_collective {
$main_collective = $mcollective::main_collective
} else {
$main_collective = $mcollective::collectives[-1]
}

["server", "client"].each |$cfg| {
ini_setting{"${name}_${cfg}_main_collective":
path => "${mcollective::configdir}/${cfg}.cfg",
setting => "main_collective",
value => $main_collective,
notify => Class["mcollective::service"]
}

ini_setting{"${name}_${cfg}_collectives":
path => "${mcollective::configdir}/${cfg}.cfg",
setting => "collectives",
value => $mcollective::collectives.join(","),
notify => Class["mcollective::service"]
}
}

$server_config.each |$item, $value| {
ini_setting{"${name}_server_${item}":
path => "${mcollective::configdir}/server.cfg",
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# @param common_config A hash of config items to set in both client.cfg and server.cfg
# @param libdir The directory where plugins will go in
# @param configdir Root directory to config files
# @param collectives A list of collectives the node belongs to
# @param main_collective The main collective to use, last in the list of `$collectives` by default
# @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
Expand All @@ -27,6 +29,8 @@
Hash $common_config = {},
String $libdir,
String $configdir,
Array[Mcollective::Collective] $collectives,
Optional[Mcollective::Collective] $main_collective = undef,
Optional[String] $plugin_owner,
Optional[String] $plugin_group,
Optional[String] $plugin_mode,
Expand Down
1 change: 1 addition & 0 deletions types/collective.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Mcollective::Collective = Pattern[/\A[a-zA-Z0-9_]+\Z/]

0 comments on commit eec5d36

Please sign in to comment.