Remove params classes

Usage of params classes is legacy and is rejected by recent lint rules.
Because we implement multiple repos classes for individual os family
and name, the params classese are not really useful, and can be
removed.

Change-Id: Ic80b17e2e374c7ddb651324c89318a5f128fe052
This commit is contained in:
Takashi Kajinami 2023-10-18 14:55:22 +09:00
parent 59af76ca34
commit 86cd3d89f0
5 changed files with 36 additions and 66 deletions

View File

@ -8,7 +8,7 @@
# [*release*]
# (optional) The OpenStack release to add a
# Debian apt source for.
# Defaults to $::openstack_extras::repo::debian::params::release
# Defaults to 'bobcat'
#
# [*manage_deb*]
# (optional) Whether or not to add the default
@ -41,7 +41,7 @@
# Defaults to "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian"
#
class openstack_extras::repo::debian::debian(
String[1] $release = $::openstack_extras::repo::debian::params::release,
String[1] $release = 'bobcat',
Boolean $manage_deb = true,
Boolean $package_require = false,
Boolean $use_extrepo = true,
@ -49,7 +49,7 @@ class openstack_extras::repo::debian::debian(
Hash $source_hash = {},
Hash $source_defaults = {},
String[1] $deb_location = "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian",
) inherits openstack_extras::repo::debian::params {
) {
$lowercase_release = downcase($release)
@ -93,18 +93,18 @@ apt-get update
tries => 3,
try_sleep => 1,
refreshonly => true,
subscribe => File["/etc/apt/sources.list.d/${::openstack_extras::repo::debian::params::deb_name}.list"],
subscribe => File['/etc/apt/sources.list.d/debian-openstack-backports.list'],
notify => Exec['apt_update'],
}
apt::source { $::openstack_extras::repo::debian::params::deb_name:
apt::source { 'debian-openstack-backports':
location => $deb_location,
release => "${facts['os']['distro']['codename']}-${lowercase_release}-backports",
repos => $::openstack_extras::repo::debian::params::deb_repos,
repos => 'main',
}
-> apt::source { "${::openstack_extras::repo::debian::params::deb_name}-nochange":
-> apt::source { 'debian-openstack-backports-nochange':
location => $deb_location,
release => "${facts['os']['distro']['codename']}-${lowercase_release}-backports-nochange",
repos => $::openstack_extras::repo::debian::params::deb_repos,
repos => 'main',
}
}
create_resources('apt::source', $source_hash, $source_defaults)

View File

@ -1,17 +0,0 @@
# == Class: openstack_extras::repo::debian::params
#
# This repo sets defaults for the debian osfamily
#
class openstack_extras::repo::debian::params
{
$release = 'bobcat'
$uca_name = 'ubuntu-cloud-archive'
$uca_location = 'http://ubuntu-cloud.archive.canonical.com/ubuntu'
$uca_repos = 'main'
$uca_required_packages = 'ubuntu-cloud-keyring'
$deb_name = 'debian-openstack-backports'
$deb_repos = 'main'
$deb_required_packages = 'openstack-backports-archive-keyring'
}

View File

@ -8,7 +8,7 @@
# [*release*]
# (optional) The OpenStack release to add an
# Ubuntu Cloud Archive APT source for.
# Defaults to $::openstack_extras::repo::debian::params::release
# Defaults to 'bobcat'
#
# [*manage_uca*]
# (optional) Whether or not to add the default
@ -42,14 +42,14 @@
# Defaults to $::openstack_extras::repo::debian::params::uca_location
#
class openstack_extras::repo::debian::ubuntu(
String[1] $release = $::openstack_extras::repo::debian::params::release,
String[1] $release = 'bobcat',
Boolean $manage_uca = true,
String[1] $repo = 'updates',
Hash $source_hash = {},
Hash $source_defaults = {},
Boolean $package_require = false,
String[1] $uca_location = $::openstack_extras::repo::debian::params::uca_location,
) inherits openstack_extras::repo::debian::params {
String[1] $uca_location = 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
) {
if $manage_uca {
exec { 'installing ubuntu-cloud-keyring':
@ -58,13 +58,13 @@ class openstack_extras::repo::debian::ubuntu(
tries => 3,
try_sleep => 1,
refreshonly => true,
subscribe => File["/etc/apt/sources.list.d/${::openstack_extras::repo::debian::params::uca_name}.list"],
subscribe => File['/etc/apt/sources.list.d/ubuntu-cloud-archive.list'],
notify => Exec['apt_update'],
}
apt::source { $::openstack_extras::repo::debian::params::uca_name:
apt::source { 'ubuntu-cloud-archive':
location => $uca_location,
release => "${facts['os']['distro']['codename']}-${repo}/${release}",
repos => $::openstack_extras::repo::debian::params::uca_repos,
repos => 'main',
}
}

View File

@ -1,25 +0,0 @@
# == Class: openstack_extras::repo::redhat::params
#
# This repo sets defaults for use with the redhat
# OS family repo classes.
#
class openstack_extras::repo::redhat::params {
$release = 'bobcat'
$centos_mirror_url = 'http://mirror.stream.centos.org'
$repo_defaults = {
'enabled' => '1',
'gpgcheck' => '1',
'mirrorlist' => 'absent',
'notify' => 'Exec[yum_refresh]',
'require' => 'Anchor[openstack_extras_redhat]',
}
$gpgkey_defaults = {
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'before' => 'Anchor[openstack_extras_redhat]',
}
}

View File

@ -7,7 +7,7 @@
#
# [*release*]
# (Optional) The OpenStack release to use.
# Defaults to $openstack_extras::repo::redhat::params::release
# Defaults to 'bobcat'
#
# [*manage_rdo*]
# (Optional) Whether to create a yumrepo resource for the
@ -36,7 +36,7 @@
# [*repo_defaults*]
# (Optional) The defaults for the yumrepo resources that will be
# created using create_resource.
# Defaults to $openstack_extras::repo::redhat::params::repo_defaults
# Defaults to {}
#
# [*gpgkey_hash*]
# (Optional) A hash of file resources that will be passed to
@ -45,7 +45,7 @@
#
# [*gpgkey_defaults*]
# (Optional) The default resource attributes to create gpgkeys with.
# Defaults to $openstack_extras::repo::redhat::params::gpgkey_defaults
# Defaults to {}
#
# [*purge_unmanaged*]
# (Optional) Purge the yum.repos.d directory of all repositories
@ -58,7 +58,7 @@
#
# [*centos_mirror_url*]
# (Optional) URL of CentOS mirror.
# Defaults to $openstack_extras::repo::redhat::params::centos_mirror_url
# Defaults to 'http://mirror.stream.centos.org'
#
# [*update_packages*]
# (Optional) Whether to update all packages after yum repositories are
@ -70,7 +70,7 @@
# Defaults to 600
#
class openstack_extras::repo::redhat::redhat (
String[1] $release = $openstack_extras::repo::redhat::params::release,
String[1] $release = 'bobcat',
Boolean $manage_rdo = true,
Boolean $manage_epel = false,
Hash $repo_hash = {},
@ -81,15 +81,27 @@ class openstack_extras::repo::redhat::redhat (
Hash $gpgkey_defaults = {},
Boolean $purge_unmanaged = false,
Boolean $package_require = false,
String[1] $centos_mirror_url = $openstack_extras::repo::redhat::params::centos_mirror_url,
String[1] $centos_mirror_url = 'http://mirror.stream.centos.org',
Boolean $update_packages = false,
Integer[0] $update_timeout = 600,
) inherits openstack_extras::repo::redhat::params {
) {
validate_yum_hash($repo_hash)
$_repo_defaults = merge($openstack_extras::repo::redhat::params::repo_defaults, $repo_defaults)
$_gpgkey_defaults = merge($openstack_extras::repo::redhat::params::gpgkey_defaults, $gpgkey_defaults)
$_repo_defaults = merge({
'enabled' => '1',
'gpgcheck' => '1',
'mirrorlist' => 'absent',
'notify' => 'Exec[yum_refresh]',
'require' => 'Anchor[openstack_extras_redhat]',
}, $repo_defaults)
$_gpgkey_defaults = merge({
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'before' => 'Anchor[openstack_extras_redhat]',
}, $gpgkey_defaults)
anchor { 'openstack_extras_redhat': }