Hi,

I am using open source puppet 3.7.3 master and client.

I know how to set noop = true in an individual manifest. For example,

file { "/tmp/testfile1" :
       ensure => present,
       noop => true
}

Now I am trying a custom function 
(http://ryanuber.com/11-06-2012/manage-sets-of-packages-in-puppet.html). 
This custom function is called "apply_package_list" and accepts tow 
arguments.

I created a new manifest called "pkgcheck" and placed this 
apply_package_list.rb in its folder 
/etc/puppet/modules/pkgcheck/lib/puppet/parser/functions/

Then I created /etc/puppet/modlues/pkgcheck/manifests/init.pp and 
checkpkg.pp.

In checkpkg.pp:

class pkgcheck::checkpkg inherits pkgcheck  {
    apply_package_list("/root/packagelist","nopurge")     
 }

It works fine when I run "puppet agent -t" on my client machine. It will 
check what package is missing or with incorrect version, then try to update 
that package.

Then I tried to use the noop option to disable the update of the package. I 
only want to be notified, but don't do anything.

class pkgcheck::checkpkg inherits pkgcheck  {
  noop => true  
  apply_package_list("/root/packagelist","nopurge")     
 }

It doesn't work and returns error when I ran "puppet agent -t" on client 
machine:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Syntax error at '=>'; expected '}' at 
/etc/puppet/modules/pkgcheck/manifests/checkpkg.pp:6 on node testclient.

I also tried with "$noop = true". This will not give syntax error, but it 
doesn't have any effect and puppet will still try to update the package.

If I run this command on client machine, it works fine:
puppet apply --noop -e 'apply_package_list("/root/packagelist", "nopurge")'

Please advise how I can set noop = true for this custom function? This 
function has no return value.

Thanks,
Stacey

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5b005c57-d25b-42ef-a88b-bc770dbbb7e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to