purpleidea / puppet-gluster

puppet module for gluster
https://ttboj.wordpress.com/code/puppet-gluster/
GNU Affero General Public License v3.0
101 stars 51 forks source link

function 'split' called with mis-matched arguments #63

Open cova-fe opened 9 years ago

cova-fe commented 9 years ago

Hi all, tring to run this module I'm getting this error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, function 'split' called with mis-matched arguments expected one of: split(String str, String pattern) - arg count {2} split(String str, Regexp pattern) - arg count {2} split(String str, Type[Regexp] pattern) - arg count {2} actual: split(Undef, String) - arg count {2} at modules/gluster/manifests/volume.pp:85:22 on node

looking at the code, gluster_brick_group_fact is the variable used and indeed it seems empty.

looking also in facts directory, (tmp/gluster/brick/fsuuid), it contains no files, thus the error.

Unfortunately, I can't understand where can it be the problem. Any hint about where to look? (glusterfs 3.4)

Many thanks.

purpleidea commented 9 years ago

@cova-fe Looking at the code, it's actually line 86, so first please check you're running git master. Secondly, it's this:

    $gluster_brick_group_fact = getvar("gluster_brick_group_${group}")
    $collected_bricks = split($gluster_brick_group_fact, ',')

If this is throwing an error, this looks like it could be different behaviour in puppet4. Can you confirm what versions of things you're using please?

If that's the case, please compare what puppet4 and puppet3.x return for these two variables, and chances are we'd need to add a simple conditional for the split if the empty values are now different.

HTH and looking forward to your detective work and patch! Cheers, James

cova-fe commented 9 years ago

Thanks for reply. I'll check asap the puppet4 behaviour, in fact I'm using puppet 4.2.1, and I'll report back. the line number difference is due to a leftover from some previous debug lines I added trying to understand the situation.

cova-fe commented 9 years ago

One thing that is not clear to me is how the fact about brick is collected. In the machine throwing the error above, there is no volume defined, so I'm perplexed to see an error related to bricks. Moreover, the only thing set up in manifest is this:

class { '::gluster::simple':
  setgroup => 'virt',       # or: 'small-file-perf', or others too!
  repo => false,
  shorewall => false,
}

I'm not sure where facter collects volume and bricks info, can you point me in the right direction?

Thanks.

purpleidea commented 9 years ago

@cova-fe Sure!

The fact is here: https://github.com/purpleidea/puppet-gluster/blob/master/lib/facter/gluster_bricks.rb#L97

Basically when a type runs, in this case, the brick type, it puts little text files in some dir, which are then later read in by the fact. See here: https://github.com/purpleidea/puppet-gluster/blob/master/manifests/brick.pp#L73

When there are no files yet, you get your error. But you don't need to figure out any of that to fix the bug. Just concentrate on the part I pointed you at in my first comment.

HTH