Skip to content

Commit

Permalink
(choria-io#207) move dependencies to this module
Browse files Browse the repository at this point in the history
Also remove the notion of the mcollective config dir and create
some more required directories

Signed-off-by: R.I.Pienaar <rip@devco.net>
  • Loading branch information
ripienaar committed Dec 29, 2020
1 parent 274835f commit 3b059e9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
1 change: 0 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ choria::ensure: "present"
choria::version: "present"
choria::log_level: "warn"
choria::srvdomain: "%{facts.networking.domain}"
choria::mcollective_config_dir: "/etc/puppetlabs/mcollective"
choria::broker_config_file: "/etc/choria/broker.conf"
choria::server_config_file: "/etc/choria/server.conf"
choria::manage_server_config: true
Expand Down
1 change: 0 additions & 1 deletion data/os/FreeBSD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ choria::broker_config_file: "/usr/local/etc/choria/broker.conf"
choria::server_config_file: "/usr/local/etc/choria/server.conf"
choria::server_provisioning_token_file: "/usr/local/etc/choria/provisioning.jwt"
choria::config_group: "wheel"
choria::mcollective_config_dir: "/usr/local/etc/mcollective"
choria::manage_package_repo: false
1 change: 0 additions & 1 deletion data/os/OpenBSD.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
choria::mcollective_config_dir: "/etc/mcollective"
choria::manage_package_repo: false
19 changes: 6 additions & 13 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,13 @@
"plugin.choria.srv_domain" => $choria::srvdomain,
}

if $choria::mcollective_config_dir != "" {
$_config_dir = dirname($choria::server_config_file)
$_config_dir = dirname($choria::server_config_file)

if $_config_dir != $choria::mcollective_config_dir {
file{"${_config_dir}/plugin.d":
ensure => link,
target => "${choria::mcollective_config_dir}/plugin.d"
}

file{"${_config_dir}/policies":
ensure => link,
target => "${choria::mcollective_config_dir}/policies"
}
}
file{[$_config_dir, "${_config_dir}/policies", "${_config_dir}/plugin.d"]:
ensure => "directory",
owner => $choria::config_user,
group => $choria::config_group,
mode => "0755",
}

$choria::scout_gossfile.each |$target, $gossfile| {
Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# @param ensure Add or remove the software
# @param repo_baseurl Used to override default packagecloud package source
# @param version The version of Choria to install
# @param mcollective_config_dir Directory where mcollective configuration is stored
# @param broker_config_file The configuration file for the broker
# @param server_config_file The configuration file for the server
# @param server_provisioning_token_file The configuration token to configure server provisioning
Expand Down Expand Up @@ -46,7 +45,6 @@
String $version,
Enum[debug, info, warn, error, fatal] $log_level,
Optional[String] $srvdomain,
Stdlib::Compat::Absolute_path $mcollective_config_dir,
Stdlib::Compat::Absolute_path $broker_config_file,
Stdlib::Compat::Absolute_path $server_config_file,
Stdlib::Compat::Absolute_path $server_provisioning_token_file,
Expand Down
12 changes: 9 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.24.0 < 7.0.0" },
{ "name": "puppetlabs/apt", "version_requirement": ">= 4.5.1 < 8.0.0" },
{ "name": "choria/mcollective_choria", "version_requirement": ">= 0.19.0 < 2.0.0" },
{ "name": "choria/mcollective", "version_requirement": ">= 0.12.0 < 2.0.0" }
{ "name": "choria/mcollective_choria", "version_requirement": ">= 0.20.0 < 2.0.0" },
{ "name": "choria/mcollective", "version_requirement": ">= 0.12.0 < 2.0.0" },
{ "name": "choria/mcollective_agent_puppet", "version_requirement": ">= 2.3.3" },
{ "name": "choria/mcollective_agent_package", "version_requirement": ">= 5.3.0" },
{ "name": "choria/mcollective_agent_service", "version_requirement": ">= 4.0.1" },
{ "name": "choria/mcollective_agent_filemgr", "version_requirement": ">= 2.0.1" },
{ "name": "choria/mcollective_util_actionpolicy", "version_requirement": ">= 3.0.0" }
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7"
"7",
"8"
]
},
{
Expand Down
13 changes: 9 additions & 4 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
context "on Windows", if: facts[:kernel] == "windows" do
it { is_expected.to contain_file("C:/Program Files/choria/bin/choria_mcollective_agent_compat.bat") }
it { is_expected.to contain_file("C:/Program Files/choria/bin/choria_mcollective_agent_compat.rb") }
it { is_expected.to contain_file("C:/ProgramData/choria/etc").with_ensure("directory") }
it { is_expected.to contain_file("C:/ProgramData/choria/etc/machine").with_ensure("directory") }
it { is_expected.to contain_file("C:/ProgramData/choria/etc/policies").with_ensure("directory") }
it { is_expected.to contain_file("C:/ProgramData/choria/etc/plugin.d").with_ensure("directory") }
it { is_expected.to contain_file("C:/ProgramData/choria/etc/overrides.json") }
it { is_expected.to contain_file("C:/ProgramData/choria/etc/server.conf") }
end
Expand All @@ -39,15 +42,17 @@
it { is_expected.to contain_file("/etc/choria/machine") }
it { is_expected.to contain_file("/etc/choria/machine") }
it { is_expected.to contain_file("/etc/choria/overrides.json") }
it { is_expected.to contain_file("/etc/choria/plugin.d").with_ensure("link") }
it { is_expected.to contain_file("/etc/choria/policies").with_ensure("link") }
it { is_expected.to contain_file("/etc/choria").with_ensure("directory") }
it { is_expected.to contain_file("/etc/choria/plugin.d").with_ensure("directory") }
it { is_expected.to contain_file("/etc/choria/policies").with_ensure("directory") }
it { is_expected.to contain_file("/etc/choria/machine").with_ensure("directory") }
end
context "on FreeBSD", if: facts[:os]["name"] == "FreeBSD" do
it { is_expected.to contain_file("/usr/local/bin/choria_mcollective_agent_compat.rb") }
it { is_expected.to contain_file("/usr/local/etc/choria/overrides.json") }
it { is_expected.to contain_file("/usr/local/etc/choria/plugin.d").with_ensure("link") }
it { is_expected.to contain_file("/usr/local/etc/choria/policies").with_ensure("link") }
it { is_expected.to contain_file("/usr/local/etc/choria").with_ensure("directory") }
it { is_expected.to contain_file("/usr/local/etc/choria/plugin.d").with_ensure("directory") }
it { is_expected.to contain_file("/usr/local/etc/choria/policies").with_ensure("directory") }
it { is_expected.to contain_file("/usr/local/etc/choria/server.conf") }
it { is_expected.to contain_file("/usr/local/etc/choria/machine").with_ensure("directory") }
end
Expand Down

0 comments on commit 3b059e9

Please sign in to comment.