From 2cf190f3f528c6d03c83048d1eb305f607031226 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 9 Jun 2023 15:07:17 +0900 Subject: [PATCH] Debian/Ubuntu: Add type validations to repo class We haven't added any validations about these parameters but we inexplicitly required specific types. This adds type validations to avoid users from using wrong types. Change-Id: I672fe9a99598ce40614bdab783f98c441ded7e62 --- manifests/repo/debian/debian.pp | 14 +++++++------- manifests/repo/debian/ubuntu.pp | 15 ++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/manifests/repo/debian/debian.pp b/manifests/repo/debian/debian.pp index 9583055..07a823a 100644 --- a/manifests/repo/debian/debian.pp +++ b/manifests/repo/debian/debian.pp @@ -41,14 +41,14 @@ # Defaults to "http://${facts['os']['distro']['codename']}-${release}.debian.net/debian" # class openstack_extras::repo::debian::debian( - $release = $::openstack_extras::repo::debian::params::release, - $manage_deb = true, - $package_require = false, - $use_extrepo = true, + String[1] $release = $::openstack_extras::repo::debian::params::release, + Boolean $manage_deb = true, + Boolean $package_require = false, + Boolean $use_extrepo = true, # Below params only used if $use_extrepo is set to false - $source_hash = {}, - $source_defaults = {}, - $deb_location = "http://${facts['os']['distro']['codename']}-${release}.debian.net/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) diff --git a/manifests/repo/debian/ubuntu.pp b/manifests/repo/debian/ubuntu.pp index 5ebe4d0..0666717 100644 --- a/manifests/repo/debian/ubuntu.pp +++ b/manifests/repo/debian/ubuntu.pp @@ -42,14 +42,15 @@ # Defaults to $::openstack_extras::repo::debian::params::uca_location # class openstack_extras::repo::debian::ubuntu( - $release = $::openstack_extras::repo::debian::params::release, - $manage_uca = true, - $repo = 'updates', - $source_hash = {}, - $source_defaults = {}, - $package_require = false, - $uca_location = $::openstack_extras::repo::debian::params::uca_location, + String[1] $release = $::openstack_extras::repo::debian::params::release, + 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 { + if $manage_uca { exec { 'installing ubuntu-cloud-keyring': command => '/usr/bin/apt-get -y install ubuntu-cloud-keyring',