Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Puppet 5, add Puppet 7 and allow puppetlabs-concat 7.x #96

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions manifests/client.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class amanda::client (
$remote_user = undef,
$server = "backup.${facts['networking']['domain']}",
$xinetd = true,
$export_host_keys = false,
Enum['present', 'absent'] $ensure = 'present',
Optional[String] $remote_user = undef,
String[1] $server = "backup.${facts['networking']['domain']}",
Boolean $xinetd = true,
Boolean $export_host_keys = false,
) {
include amanda
include amanda::params
Expand All @@ -28,14 +29,15 @@
}

amanda::amandahosts { "amanda::client::amdump_${remote_user_real}@${server}":
ensure => $ensure,
content => "${server} ${remote_user_real} amdump",
order => '00';
}

if ($export_host_keys) {
## export our ssh host keys
@@sshkey { "${::clientcert}_amanda": # lint:ignore:legacy_facts
ensure => present,
ensure => $ensure,
host_aliases => [$facts['networking']['fqdn'],$facts['networking']['ip']],
key => $::sshrsakey, # lint:ignore:legacy_facts
type => 'ssh-rsa',
Expand Down
26 changes: 14 additions & 12 deletions manifests/server.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
class amanda::server (
Array[String] $configs = [],
Optional[Boolean] $configs_directory = undef,
Boolean $manage_configs_directory = true,
Boolean $manage_configs_source = true,
String $configs_source = 'modules/amanda/server/example',
String $mode = '0644',
Optional[Boolean] $group = undef,
Optional[Boolean] $owner = undef,
Boolean $xinetd = true,
Boolean $manage_dle = false,
Boolean $export_host_keys = false,
Enum['present', 'absent'] $ensure = 'present',
Array[String] $configs = [],
Optional[Boolean] $configs_directory = undef,
Boolean $manage_configs_directory = true,
Boolean $manage_configs_source = true,
String $configs_source = 'modules/amanda/server/example',
String $mode = '0644',
Optional[Boolean] $group = undef,
Optional[Boolean] $owner = undef,
Boolean $xinetd = true,
Boolean $manage_dle = false,
Boolean $export_host_keys = false,
) {
include amanda
include amanda::params
Expand Down Expand Up @@ -50,12 +51,13 @@
}

amanda::amandahosts { 'amanda::server::server_root@localhost':
ensure => $ensure,
content => 'localhost root amindexd amidxtaped',
order => '10';
}

amanda::config { $configs:
ensure => present,
ensure => $ensure,
manage_configs_directory => $manage_configs_directory,
configs_directory => $configs_directory,
manage_configs_source => $manage_configs_source,
Expand Down
17 changes: 17 additions & 0 deletions manifests/virtual.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
class amanda::virtual {
include amanda::params

if $amanda::client::ensure == 'absent' {
$client_ensure = 'absent'
} else {
$client_ensure = 'present'
}
if $amanda::server::ensure == 'absent' {
$server_ensure = 'absent'
} else {
$server_ensure = 'present'
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to access $amanda::client::ensure and $amanda::server::ensure we must include amanda::client and include amanda::server first.

Copy link
Contributor Author

@markruys markruys Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm not sure about this. I've tested (with Puppet 7), and the additional includes doesn't seem to be needed. Also, adding these includes changes the Amanda module behavior as the defaults are set to 'present'.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well my point is that if the class amanda::server is not included, $amanda::server::ensure will be undef while the default value is 'present' when amanda::server is included… that's weird and seems fragile:

class { 'amanda::client':
}
# amanda::client include amanda
# `-> amanda include amanda::virtual
#     `-> amanda::virtual sees $amanda::server::ensure == undef
#                          and $amanda::client::ensure == 'present'
class { 'amanda::server':
}
class { 'amanda::server':
}
# amanda::server include amanda
# `-> amanda include amanda::virtual
#     `-> amanda::virtual sees $amanda::server::ensure == 'present'
#                          and $amanda::client::ensure == undef
class { 'amanda::client':
}
class { 'amanda':
}
# amanda include amanda::virtual
# `-> amanda::virtual sees $amanda::server::ensure == undef
#                      and $amanda::client::ensure == undef
class { 'amanda::client':
}
class { 'amanda::server':
}

I have no experience with amanda, but this does not look right 😨


case $facts['os']['name'] {
'Solaris': { include amanda::virtual::solaris }
default: {} # do nothing
Expand Down Expand Up @@ -72,10 +83,12 @@
}
} else {
@package { 'amanda/client':
ensure => $client_ensure,
name => $amanda::params::client_package,
before => $post_package,
}
@package { 'amanda/server':
ensure => $server_ensure,
name => $amanda::params::server_package,
before => $post_package,
}
Expand All @@ -96,6 +109,7 @@
}

@xinetd::service { 'amanda_udp':
ensure => $client_ensure,
service_name => 'amanda',
socket_type => 'dgram',
protocol => 'udp',
Expand All @@ -106,6 +120,7 @@
server_args => "-auth=bsd ${amanda::params::client_daemons}",
}
@xinetd::service { 'amanda_tcp':
ensure => $client_ensure,
service_name => 'amanda',
socket_type => 'stream',
protocol => 'tcp',
Expand All @@ -116,6 +131,7 @@
server_args => "-auth=bsdtcp ${amanda::params::client_daemons}",
}
@xinetd::service { 'amanda_indexd':
ensure => $server_ensure,
service_name => 'amandaidx',
socket_type => 'stream',
protocol => 'tcp',
Expand All @@ -128,6 +144,7 @@
server_args => "-auth=bsdtcp ${amanda::params::server_daemons}",
}
@xinetd::service { 'amanda_taped':
ensure => $server_ensure,
service_name => 'amidxtape',
socket_type => 'stream',
protocol => 'tcp',
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": [
{
"name": "puppetlabs/concat",
"version_requirement": ">= 4.1.0 < 7.0.0"
"version_requirement": ">= 4.1.0 < 8.0.0"
},
{
"name": "puppetlabs/stdlib",
Expand All @@ -28,7 +28,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 5.5.8 < 7.0.0"
"version_requirement": ">= 6.1.0 < 8.0.0"
}
]
}