Ask Your Question
0

must pass error

asked 2014-11-12 06:11:42 -0500

Chutki gravatar image

Hi,

I am getting error Must pass filename to Dummy::Parfil[a] at /etc/dummy/manifests/sys_fil.pp:3 on node

class dummy::sys_fil {
  $filename = ['a','b']
  dummy::parfil{$filename:}
}


define dummy::parfil ($filename){
file {$filename:
ensure => 'file',
path => "/etc/dummy/manifests/${filename}"
}
}

please help me.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-12 13:00:38 -0500

cbarbour gravatar image

dummy::parfil{$filename:} declares a defined type with the title of $filename. In your code example, the type would be defined twice, once with the $title 'a', and once with the $title 'b'.

With a defined type, the title of the resource is assigned to the variable $title and $name. The resource title is not assigned to a parameter.

Your defined type has a required parameter called $filename. You aren't supplying a value for $filename, so a parse error is being raised. Puppet is expecting this:

dummy::parfil { 'a':
  filename => 'a'
}

Try this:

define dummy::parfil (
  $filename = $title,
  ) {
  file {$filename:
    ensure => 'file',
    path => "/etc/dummy/manifests/${filename}"
  }
}

This is also acceptable:

define dummy::parfil ( ) {
  file {$title:
    ensure => 'file',
    path => "/etc/dummy/manifests/${title}"
  }
}

See the defined type documentation for more info.

edit flag offensive delete link more

Comments

Thanks it worked

Chutki gravatar imageChutki ( 2014-11-12 21:56:42 -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

1 follower

Stats

Asked: 2014-11-12 06:11:42 -0500

Seen: 1,741 times

Last updated: Nov 12 '14