Merge "Remove params classes"

This commit is contained in:
Zuul 2023-10-18 19:42:53 +00:00 committed by Gerrit Code Review
commit 81d4ce316c
5 changed files with 36 additions and 66 deletions

View File

@ -8,7 +8,7 @@
# [*release*] # [*release*]
# (optional) The OpenStack release to add a # (optional) The OpenStack release to add a
# Debian apt source for. # Debian apt source for.
# Defaults to $::openstack_extras::repo::debian::params::release # Defaults to 'bobcat'
# #
# [*manage_deb*] # [*manage_deb*]
# (optional) Whether or not to add the default # (optional) Whether or not to add the default
@ -41,7 +41,7 @@
# Defaults to "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian" # Defaults to "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian"
# #
class openstack_extras::repo::debian::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 $manage_deb = true,
Boolean $package_require = false, Boolean $package_require = false,
Boolean $use_extrepo = true, Boolean $use_extrepo = true,
@ -49,7 +49,7 @@ class openstack_extras::repo::debian::debian(
Hash $source_hash = {}, Hash $source_hash = {},
Hash $source_defaults = {}, Hash $source_defaults = {},
String[1] $deb_location = "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian", String[1] $deb_location = "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian",
) inherits openstack_extras::repo::debian::params { ) {
$lowercase_release = downcase($release) $lowercase_release = downcase($release)
@ -93,18 +93,18 @@ apt-get update
tries => 3, tries => 3,
try_sleep => 1, try_sleep => 1,
refreshonly => true, 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'], notify => Exec['apt_update'],
} }
apt::source { $::openstack_extras::repo::debian::params::deb_name: apt::source { 'debian-openstack-backports':
location => $deb_location, location => $deb_location,
release => "${facts['os']['distro']['codename']}-${lowercase_release}-backports", 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, location => $deb_location,
release => "${facts['os']['distro']['codename']}-${lowercase_release}-backports-nochange", 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) 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*] # [*release*]
# (optional) The OpenStack release to add an # (optional) The OpenStack release to add an
# Ubuntu Cloud Archive APT source for. # Ubuntu Cloud Archive APT source for.
# Defaults to $::openstack_extras::repo::debian::params::release # Defaults to 'bobcat'
# #
# [*manage_uca*] # [*manage_uca*]
# (optional) Whether or not to add the default # (optional) Whether or not to add the default
@ -42,14 +42,14 @@
# Defaults to $::openstack_extras::repo::debian::params::uca_location # Defaults to $::openstack_extras::repo::debian::params::uca_location
# #
class openstack_extras::repo::debian::ubuntu( class openstack_extras::repo::debian::ubuntu(
String[1] $release = $::openstack_extras::repo::debian::params::release, String[1] $release = 'bobcat',
Boolean $manage_uca = true, Boolean $manage_uca = true,
String[1] $repo = 'updates', String[1] $repo = 'updates',
Hash $source_hash = {}, Hash $source_hash = {},
Hash $source_defaults = {}, Hash $source_defaults = {},
Boolean $package_require = false, Boolean $package_require = false,
String[1] $uca_location = $::openstack_extras::repo::debian::params::uca_location, String[1] $uca_location = 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
) inherits openstack_extras::repo::debian::params { ) {
if $manage_uca { if $manage_uca {
exec { 'installing ubuntu-cloud-keyring': exec { 'installing ubuntu-cloud-keyring':
@ -58,13 +58,13 @@ class openstack_extras::repo::debian::ubuntu(
tries => 3, tries => 3,
try_sleep => 1, try_sleep => 1,
refreshonly => true, 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'], notify => Exec['apt_update'],
} }
apt::source { $::openstack_extras::repo::debian::params::uca_name: apt::source { 'ubuntu-cloud-archive':
location => $uca_location, location => $uca_location,
release => "${facts['os']['distro']['codename']}-${repo}/${release}", 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*] # [*release*]
# (Optional) The OpenStack release to use. # (Optional) The OpenStack release to use.
# Defaults to $openstack_extras::repo::redhat::params::release # Defaults to 'bobcat'
# #
# [*manage_rdo*] # [*manage_rdo*]
# (Optional) Whether to create a yumrepo resource for the # (Optional) Whether to create a yumrepo resource for the
@ -36,7 +36,7 @@
# [*repo_defaults*] # [*repo_defaults*]
# (Optional) The defaults for the yumrepo resources that will be # (Optional) The defaults for the yumrepo resources that will be
# created using create_resource. # created using create_resource.
# Defaults to $openstack_extras::repo::redhat::params::repo_defaults # Defaults to {}
# #
# [*gpgkey_hash*] # [*gpgkey_hash*]
# (Optional) A hash of file resources that will be passed to # (Optional) A hash of file resources that will be passed to
@ -45,7 +45,7 @@
# #
# [*gpgkey_defaults*] # [*gpgkey_defaults*]
# (Optional) The default resource attributes to create gpgkeys with. # (Optional) The default resource attributes to create gpgkeys with.
# Defaults to $openstack_extras::repo::redhat::params::gpgkey_defaults # Defaults to {}
# #
# [*purge_unmanaged*] # [*purge_unmanaged*]
# (Optional) Purge the yum.repos.d directory of all repositories # (Optional) Purge the yum.repos.d directory of all repositories
@ -58,7 +58,7 @@
# #
# [*centos_mirror_url*] # [*centos_mirror_url*]
# (Optional) URL of CentOS mirror. # (Optional) URL of CentOS mirror.
# Defaults to $openstack_extras::repo::redhat::params::centos_mirror_url # Defaults to 'http://mirror.stream.centos.org'
# #
# [*update_packages*] # [*update_packages*]
# (Optional) Whether to update all packages after yum repositories are # (Optional) Whether to update all packages after yum repositories are
@ -70,7 +70,7 @@
# Defaults to 600 # Defaults to 600
# #
class openstack_extras::repo::redhat::redhat ( 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_rdo = true,
Boolean $manage_epel = false, Boolean $manage_epel = false,
Hash $repo_hash = {}, Hash $repo_hash = {},
@ -81,15 +81,27 @@ class openstack_extras::repo::redhat::redhat (
Hash $gpgkey_defaults = {}, Hash $gpgkey_defaults = {},
Boolean $purge_unmanaged = false, Boolean $purge_unmanaged = false,
Boolean $package_require = 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, Boolean $update_packages = false,
Integer[0] $update_timeout = 600, Integer[0] $update_timeout = 600,
) inherits openstack_extras::repo::redhat::params { ) {
validate_yum_hash($repo_hash) validate_yum_hash($repo_hash)
$_repo_defaults = merge($openstack_extras::repo::redhat::params::repo_defaults, $repo_defaults) $_repo_defaults = merge({
$_gpgkey_defaults = merge($openstack_extras::repo::redhat::params::gpgkey_defaults, $gpgkey_defaults) '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': } anchor { 'openstack_extras_redhat': }