From 86cd3d89f0b85d759d7359b4fe8cafaa35968bf2 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 18 Oct 2023 14:55:22 +0900 Subject: [PATCH] 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 --- manifests/repo/debian/debian.pp | 16 ++++++++-------- manifests/repo/debian/params.pp | 17 ----------------- manifests/repo/debian/ubuntu.pp | 14 +++++++------- manifests/repo/redhat/params.pp | 25 ------------------------- manifests/repo/redhat/redhat.pp | 30 +++++++++++++++++++++--------- 5 files changed, 36 insertions(+), 66 deletions(-) delete mode 100644 manifests/repo/debian/params.pp delete mode 100644 manifests/repo/redhat/params.pp diff --git a/manifests/repo/debian/debian.pp b/manifests/repo/debian/debian.pp index 07a823a..b523c5e 100644 --- a/manifests/repo/debian/debian.pp +++ b/manifests/repo/debian/debian.pp @@ -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) diff --git a/manifests/repo/debian/params.pp b/manifests/repo/debian/params.pp deleted file mode 100644 index 12ae8a7..0000000 --- a/manifests/repo/debian/params.pp +++ /dev/null @@ -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' -} diff --git a/manifests/repo/debian/ubuntu.pp b/manifests/repo/debian/ubuntu.pp index 0666717..b7a3101 100644 --- a/manifests/repo/debian/ubuntu.pp +++ b/manifests/repo/debian/ubuntu.pp @@ -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', } } diff --git a/manifests/repo/redhat/params.pp b/manifests/repo/redhat/params.pp deleted file mode 100644 index 0ed076b..0000000 --- a/manifests/repo/redhat/params.pp +++ /dev/null @@ -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]', - } -} diff --git a/manifests/repo/redhat/redhat.pp b/manifests/repo/redhat/redhat.pp index 2882a41..5bad67c 100644 --- a/manifests/repo/redhat/redhat.pp +++ b/manifests/repo/redhat/redhat.pp @@ -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': }