puppet-gluster
puppet-gluster copied to clipboard
Volume name case issue
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 4.8.2 on client, 5.5 on server
- Ruby: 2.3.3p222 on client
- Distribution: Proxmox 5.2 (which is Debian GNU/Linux 9 (stretch)) on client, Ubuntu 18.04 on server
- Module version: v4.0.0
How to reproduce (e.g Puppet code you use)
Hiera:
gluster::repo: false
gluster::server: true
gluster::client: false
gluster::use_exported_resources: true
gluster::pool: 'proxmox'
gluster::volumes:
'proxmoxVMs':
replica: 2
bricks:
- 'xs1.93.lan:/data/glusterfs/proxmoxVMs/brick1/brick'
- 'xs2.93.lan:/data/glusterfs/proxmoxVMs/brick1/brick'
options:
- 'nfs.disable: on'
gluster::service::service_name: glusterfs-server
gluster::service::ensure: running
What are you seeing
When running puppet agent -t after the volume is created I get the following error message:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, 's
plit' parameter 'str' expects a String value, got Undef (file: /etc/puppetlabs/code/modules/gluster/manifests/volume.pp, line: 180, column: 21) (file: /etc/puppetlabs/code/modules/gluster/manifests/init.pp, line:
83) on node xs1.93.lan
What behaviour did you expect instead
No errors. =)
Any additional information you'd like to impart
When I run facter -p on my Proxmox server I can see that it is returning the gluster volume bricks value name in all lower case, but the volume has two uppercase letters in it:
gluster_volume_proxmoxvms_bricks => ...
The line of code mentioned in the error message (line 180 in my version of volume.pp, line 160 in the current version) is using the original name:
$vol_bricks = split( getvar( "::gluster_volume_${title}_bricks" ), ',')
...appears to be failing to find the volume because it is using the actual name which has uppercase letters:
gluster_volume_proxmoxVMs_bricks
I have worked around this in my copy of the module by changing that line to this:
$title_downcase = downcase( $title )
$vol_bricks = split( getvar( "::gluster_volume_${title_downcase}_bricks" ), ',')
I would submit this code change, but I have a feeling this is not the right solution. ...I find it hard to imagine I'm the first person to have some uppercase letters in their volume name.