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

fix puppet-lint warnings / switch to facts hash / drop legacy gluster versions 4.0 and older #203

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$client_package = $gluster::params::client_package,
$pool = $gluster::params::pool,
$repo = $gluster::params::repo,
$release = $gluster::params::release,
String $release = $gluster::params::release,
$server = $gluster::params::install_server,
$server_package = $gluster::params::server_package,
$use_exported_resources = $gluster::params::export_resources,
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# parameters dealing with installation
$install_server = true
$install_client = true
$release = '3.12'
$release = '6'
$version = 'LATEST'

# we explicitly do NOT set a priority here. The user must define
Expand Down
36 changes: 12 additions & 24 deletions manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,17 @@
# @note Copyright 2015 RL Solutions, unless otherwise noted
#
class gluster::repo::apt (
$version = $gluster::params::version,
$release = $gluster::params::release,
$priority = $gluster::params::repo_priority,
$version = $gluster::version,
String[1] $release = $gluster::release,
$priority = $gluster::repo_priority,
) {
include 'apt'

$repo_key_name = $release ? {
'3.10' => 'C784DD0FD61E38B8B1F65E10DAD761554A72C1DF',
'3.11' => 'DE82F0BACC4DB70DBEF95CA65EC2255642304A6E',
'3.12' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
'3.13' => '9B5AE8E6FD2581F293104ACC38675E5F30F779AF',
'4.0' => '55F839E173AC06F364120D46FA86EEACB306CEE1',
'4.1' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
'^5\.(\d)+$' => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'^5\.(\d)+$' => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
default => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',

/^6/ => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
/^7/ => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
default => '849512C2CA648EF425048F55C883F50CB2289A17',
}

Expand All @@ -55,36 +52,27 @@
}

# the Gluster repo only supports x86_64 (amd64) and arm64. The Ubuntu PPA also supports armhf and arm64.
case $::operatingsystem {
case $facts['os']['name'] {
'Debian': {
case $::lsbdistcodename {
'jessie', 'stretch': {
$arch = $::architecture ? {
'amd64' => 'amd64',
'arm64' => 'arm64',
default => false,
}
if versioncmp($release, '3.12') < 0 {
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/apt/"
} else {
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/${arch}/apt/"
}
}
$arch = $facts['architecture'] ? {
'amd64' => 'amd64',
'arm64' => 'arm64',
default => false,
}
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${facts['lsbdistcodename']}/${arch}/apt/"
}
default: {
fail('gluster::repo::apt currently only works on Debian')
}
}
if ! $arch {
fail("Architecture ${::architecture} not yet supported for ${::operatingsystem}.")
fail("Architecture ${facts['architecture']} not yet supported for ${facts['operatingsystem']}.")
}

$repo = {
bastelfreak marked this conversation as resolved.
Show resolved Hide resolved
"glusterfs-${version}" => {
ensure => present,
location => $repo_url,
release => $::lsbdistcodename,
repos => 'main',
key => {
id => $repo_key_name,
Expand Down
4 changes: 2 additions & 2 deletions manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
Boolean $rebalance = true,
Boolean $heal = true,
Boolean $remove_options = false,
Optional[Array] $options = undef,
Array[String[1]] $options = [],
Optional[Integer] $stripe = undef,
Optional[Integer] $replica = undef,
Optional[Integer] $arbiter = undef,
Expand All @@ -74,7 +74,7 @@

$_transport = "transport ${transport}"

if $options and ! empty( $options ) {
if ! empty( $options ) {
Copy link
Member

Choose a reason for hiding this comment

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

Later there's another if $_options. Perhaps you can combine those?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should leave this pull request as it is, because many others depend on it and we need a working CI pipeline.

$_options = sort( $options )
} else {
$_options = undef
Expand Down
2 changes: 1 addition & 1 deletion manifests/volume/option.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# @note Copyright 2014 CoverMyMeds, unless otherwise noted
#
define gluster::volume::option (
Optional[String] $value = undef,
$value = undef,
Enum['present', 'absent'] $ensure = 'present',
) {

Expand Down
4 changes: 0 additions & 4 deletions spec/classes/repo_apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
it 'installs' do
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/"
)
end
Expand Down Expand Up @@ -46,7 +45,6 @@
it 'installs' do
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
pin: '700'
)
Expand All @@ -63,7 +61,6 @@
it 'installs' do
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
key: {
'id' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/4.1/rsa.pub'
Expand All @@ -83,7 +80,6 @@
it 'installs' do
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
key: {
'id' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.12/rsa.pub'
Expand Down