Ask Your Question
1

Does Puppet support define parameter referencing within define signature?

asked 2013-10-23 09:59:43 -0500

updated 2013-10-23 17:43:26 -0500

I stummbled upon the following code:

define rbenv::plugin::rbenvvars(
  $user   = $title,
  $source = 'https://github.com/sstephenson/rbenv-vars.git',
  $group  = $user,
  $home   = '',
  $root   = ''
) {
...

I'm using Geppetto and it's complaining about the line $group = $user. $user is not defined anywhere else in the upper scopes except as the other parameter of the define. Is this allowed in Puppet? And if yes, from which version? As far as I remember at some point Puppet didn't support it.

Will it be valid to replace that line with $group = $::user ?

UPDATE: That's what I found in Puppet documentation for defined ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-10-23 13:26:19 -0500

ramindk gravatar image

updated 2013-10-23 17:34:53 -0500

Without seeing the rest of the module I'm assuming $user is specified somewhere as the user that will install rbenv locally. I'm not sure why Gepetto is complaining, but the code you've posted looks correct. You might try replacing $title with $name and see if they clears the warning.

fwiw, puppet-lint and puppet parser validate don't kick out any errors or warnings.

EDIT: The problem is that $name (or $title) is an internal variable on the resource. Here's a simple example. $name is www.example.com all the way through the example.

node www

apache ...
(more)
edit flag offensive delete link more

Comments

Full module code is here: https://github.com/alup/puppet-rbenv

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-10-23 15:21:03 -0500 )edit

$user is only specified as a parameter $user = $title. changing it to $user = $name does not help.

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-10-23 15:21:28 -0500 )edit

Is $group = $::user a valid way or is it wrong?

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-10-23 15:21:49 -0500 )edit

puppet parser is fine with the code, but the thing is that it's not the first time when Geppetto actually identifies valid error when puppet parser remains silent

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-10-23 15:31:24 -0500 )edit

my problem is not in understanding how $title or $name works, because they are special. I would like to understand if it is legal to use something different than $title ...(more)

Andrey Adamovich gravatar imageAndrey Adamovich ( 2013-10-23 17:13:40 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-10-23 09:59:43 -0500

Seen: 185 times

Last updated: Oct 23 '13