From 3b059e93ef93faca69402140010251ec1bc0d88c Mon Sep 17 00:00:00 2001 From: "R.I.Pienaar" Date: Tue, 29 Dec 2020 13:27:44 +0100 Subject: [PATCH] (#207) move dependencies to this module Also remove the notion of the mcollective config dir and create some more required directories Signed-off-by: R.I.Pienaar --- data/common.yaml | 1 - data/os/FreeBSD.yaml | 1 - data/os/OpenBSD.yaml | 1 - manifests/config.pp | 19 ++++++------------- manifests/init.pp | 2 -- metadata.json | 12 +++++++++--- spec/classes/init_spec.rb | 13 +++++++++---- 7 files changed, 24 insertions(+), 25 deletions(-) diff --git a/data/common.yaml b/data/common.yaml index dfb872a..0887196 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -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 diff --git a/data/os/FreeBSD.yaml b/data/os/FreeBSD.yaml index 00bff51..8e5bc8b 100644 --- a/data/os/FreeBSD.yaml +++ b/data/os/FreeBSD.yaml @@ -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 diff --git a/data/os/OpenBSD.yaml b/data/os/OpenBSD.yaml index fb58d79..161dc15 100644 --- a/data/os/OpenBSD.yaml +++ b/data/os/OpenBSD.yaml @@ -1,3 +1,2 @@ --- -choria::mcollective_config_dir: "/etc/mcollective" choria::manage_package_repo: false diff --git a/manifests/config.pp b/manifests/config.pp index 7c03467..9de3697 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -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| { diff --git a/manifests/init.pp b/manifests/init.pp index d89e746..10f3deb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 @@ -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, diff --git a/metadata.json b/metadata.json index 3ca7b54..0439ce8 100644 --- a/metadata.json +++ b/metadata.json @@ -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" ] }, { diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 2f2b07a..110868a 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -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 @@ -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