# Learning puppet basic master/agent - invalid parameter ensure?

hello! I have gone through the learning puppet training, and I am on the last exercise. however, i need some help. when I do not insert a parameter in the class the agent node runs the puppet agent --test successfully. However, when I insert any parameter under class {'ntp':} the puppet agent --test run fails with invalid parameter. Why am I getting this error. In turn, how can I fix this?

here is what I put in site.pp:

node 'agent1.localdomain' {
include apache
class {'ntp':
enabled => false,
ensure => stopped,
}
}


here is the ntp class:

class ntp ($servers = undef) { if ... edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted I think you missed the passing of parameters for ntp class, here you have to use the concept of parameterized classes. Refer http://docs.puppetlabs.com/guides/parameterized_classes.html for detail concept of parameterized classes. class ntp ($servers = undef,
$ensure = undef, # you can give the default value to$ensure parameters also as stopped,
$enabled = undef, # you can give the default value to$enabled parameters also as false,
)
{
...
}


I hope this will solve your problem.

more

thanks for the feedback. one thing however. I added class parameters to the class definition (i.e. class {ntp: $ensure=running,$enable = false} which allowed the agent to run the ...(more)

( 2013-09-30 13:37:59 -0600 )edit

I got it! i removed the values to the parameters in the class, then I replaced their values withing the manifest with the $ensure and$enable variables. NTP stopped!

( 2013-09-30 13:45:18 -0600 )edit