Skip to content

Commit

Permalink
Update gluster to 3cefb34593f37c9c2c2e93fcb88bee07e335045e
Browse files Browse the repository at this point in the history
3cefb34593f37c9c2c2e93fcb88bee07e335045e Update puppet stdlib submodule for Vagrant users.
223ca32d9eca245642da17bd01d1a71d16b73f37 Transition away from deprected 'type' function.
1215e191ea16e286a446612d0b5fc472a970b54e Fix a deprecation warning with stdlib 4.6.0
  • Loading branch information
xbezdick committed May 11, 2015
1 parent 9063c86 commit 35160a2
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod 'glance',
:git => 'https://github.com/stackforge/puppet-glance.git'

mod 'gluster',
:commit => '4b96b871dc414727160b51a7a454c518382ea9aa',
:commit => '3cefb34593f37c9c2c2e93fcb88bee07e335045e',
:git => 'https://github.com/purpleidea/puppet-gluster.git'

mod 'gnocchi',
Expand Down
10 changes: 5 additions & 5 deletions gluster/manifests/brick.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
}

# you might see this on first run if the fsuuid isn't generated yet
if (type($dev) != 'boolean') and ("${valid_fsuuid}" == '') {
if (type3x($dev) != 'boolean') and ("${valid_fsuuid}" == '') {
warning('An $fsuuid must be specified or generated.')
}

Expand All @@ -124,7 +124,7 @@
# TODO: maybe we can detect these altogether from the raid set!
if "${raid_su}" == '' and "${raid_sw}" == '' {
# if we are not using a real device, we should ignore warnings!
if type($dev) != 'boolean' { # real devices!
if type3x($dev) != 'boolean' { # real devices!
if $lvm or "${fstype}" == 'xfs' {
warning('Setting $raid_su and $raid_sw is recommended.')
}
Expand Down Expand Up @@ -239,7 +239,7 @@
}

# if $dev is false, we assume we're using a path backing store on brick
$valid_fstype = type($dev) ? {
$valid_fstype = type3x($dev) ? {
'boolean' => $dev ? {
false => 'path', # no dev, just a path spec
default => '', # invalid type
Expand Down Expand Up @@ -381,7 +381,7 @@
}

# if we're on itself, and we have a real device to work with
if (type($dev) != 'boolean') and ("${fqdn}" == "${host}") {
if (type3x($dev) != 'boolean') and ("${fqdn}" == "${host}") {

# partitioning...
if $partition {
Expand Down Expand Up @@ -521,7 +521,7 @@
}
}

} elsif ((type($dev) == 'boolean') and (! $dev)) and ("${fqdn}" == "${host}") {
} elsif ((type3x($dev) == 'boolean') and (! $dev)) and ("${fqdn}" == "${host}") {

# ensure the full path exists!
# TODO: is the mkdir needed ?
Expand Down
2 changes: 1 addition & 1 deletion gluster/manifests/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@

#$other_host_ips = inline_template("<%= ips.delete_if {|x| x == '${ipaddress}' }.join(',') %>") # list of ips except myself
#$all_ips = inline_template("<%= (ips+[vip]+clients).uniq.delete_if {|x| x.empty? }.join(',') %>")
$source_ips = type($ips) ? {
$source_ips = type3x($ips) ? {
'array' => inline_template("<%= (ips+[]).uniq.delete_if {|x| x.empty? }.join(',') %>"),
default => ["${valid_ip}"],
}
Expand Down
2 changes: 1 addition & 1 deletion gluster/manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

if $shorewall {
# XXX: WIP
#if type($ips) == 'array' {
#if type3x($ips) == 'array' {
# #$other_host_ips = inline_template("<%= ips.delete_if {|x| x == '${ipaddress}' }.join(',') %>") # list of ips except myself
# $source_ips = inline_template("<%= (ips+clients).uniq.delete_if {|x| x.empty? }.join(',') %>")
# #$all_ips = inline_template("<%= (ips+[vip]+clients).uniq.delete_if {|x| x.empty? }.join(',') %>")
Expand Down
4 changes: 3 additions & 1 deletion gluster/manifests/simple.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@

$valid_path = sprintf("%s/", regsubst($chosen_path, '\/$', ''))

$valid_volumes = type($volume) ? { # always an array of volumes...
# Stdlib 4.6.0 deprecates 'type' in favor of 'type3x'.
# Ensure $valid_volumes is always an array.
$valid_volumes = type3x($volume) ? {
'array' => $volume,
default => ["${volume}"],
}
Expand Down
6 changes: 3 additions & 3 deletions gluster/manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if $maxlength < $settle_count {
fail('The $maxlength needs to be greater than or equal to the $settle_count.')
}
$are_bricks_collected = (type($bricks) == 'boolean' and ($bricks == true))
$are_bricks_collected = (type3x($bricks) == 'boolean' and ($bricks == true))
# NOTE: settle checks are still useful even if we are using ping checks
# the reason why they are still useful, is that they can detect changes
# in the bricks, which might propagate slowly because of exported types
Expand Down Expand Up @@ -89,7 +89,7 @@
default => brick_layout_simple($replica, $collected_bricks),
}

$valid_bricks = type($bricks) ? {
$valid_bricks = type3x($bricks) ? {
'boolean' => $bricks ? {
true => $ordered_brick_layout, # an array...
default => [], # invalid type
Expand Down Expand Up @@ -341,7 +341,7 @@

$ips = $::gluster::server::ips # override host ip list
$ip = $::gluster::host::data::ip # ip of brick's host...
$source_ips = type($ips) ? {
$source_ips = type3x($ips) ? {
'array' => inline_template("<%= (@ips+[]).uniq.delete_if {|x| x.empty? }.join(',') %>"),
default => ["${ip}"],
}
Expand Down
22 changes: 11 additions & 11 deletions gluster/manifests/volume/property.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@
}

if (! $autotype) {
if type($value) != 'string' {
fail('Expecting type(string) if autotype is disabled.')
if type3x($value) != 'string' {
fail('Expecting type3x(string) if autotype is disabled.')
}
$safe_value = shellquote($value) # TODO: is this the safe thing?

# if it's a special offon type and of an acceptable value
} elsif ($etype == 'offon') { # default is off
if type($value) == 'boolean' {
if type3x($value) == 'boolean' {
$safe_value = $value ? {
true => 'on',
default => 'off',
}

} elsif type($value) == 'string' {
} elsif type3x($value) == 'string' {
$downcase_value = inline_template('<%= @value.downcase %>')
$safe_value = $downcase_value ? {
'on' => 'on',
Expand All @@ -99,13 +99,13 @@

# if it's a special onoff type and of an acceptable value
} elsif ($etype == 'onoff') { # default is on
if type($value) == 'boolean' {
if type3x($value) == 'boolean' {
$safe_value = $value ? {
false => 'off',
default => 'on',
}

} elsif type($value) == 'string' {
} elsif type3x($value) == 'string' {
$downcase_value = inline_template('<%= @value.downcase %>')
$safe_value = $downcase_value ? {
'off' => 'off',
Expand All @@ -119,13 +119,13 @@

# if it's a special truefalse type and of an acceptable value
} elsif ($etype == 'truefalse') { # default is true
if type($value) == 'boolean' {
if type3x($value) == 'boolean' {
$safe_value = $value ? {
false => 'false',
default => 'true',
}

} elsif type($value) == 'string' {
} elsif type3x($value) == 'string' {
$downcase_value = inline_template('<%= @value.downcase %>')
$safe_value = $downcase_value ? {
'false' => 'false',
Expand All @@ -138,13 +138,13 @@

# if it's a special falsetrue type and of an acceptable value
} elsif ($etype == 'falsetrue') { # default is false
if type($value) == 'boolean' {
if type3x($value) == 'boolean' {
$safe_value = $value ? {
true => 'true',
default => 'false',
}

} elsif type($value) == 'string' {
} elsif type3x($value) == 'string' {
$downcase_value = inline_template('<%= @value.downcase %>')
$safe_value = $downcase_value ? {
'true' => 'true',
Expand All @@ -166,7 +166,7 @@
$safe_value = shellquote($value) # TODO: is this the safe thing?

# if it's not a string and it's not the expected type, fail
} elsif ( type($value) != $etype ) { # type() from puppetlabs-stdlib
} elsif ( type3x($value) != $etype ) { # type3x() from puppetlabs-stdlib
fail("Gluster::Volume::Property[${key}] must be type: ${etype}.")

# convert to correct type
Expand Down
4 changes: 2 additions & 2 deletions gluster/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "purpleidea-gluster",
"version": "0.0.5",
"version": "0.1.0",
"author": "James Shubin",
"summary": "A Puppet module for GlusterFS",
"license": "GNU Affero General Public License, Version 3.0+",
Expand All @@ -9,7 +9,7 @@
"issues_url": null,
"description": "UNKNOWN",
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.0.0" }
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0" }
]
}

2 changes: 1 addition & 1 deletion gluster/vagrant/puppet/modules/stdlib
Submodule stdlib updated from 44c181 to c7a23b

0 comments on commit 35160a2

Please sign in to comment.