Hi Rob,
Thank you for the reply.
The missing comma is a type in the post. In my actual test, I had the comma.
I figured out how to enable noop = true for my custom function.
I edited my custom function
from
{:name => package, :ensure => "latest"}
to
{:name => package, :noop => true, :ensure => "latest"}
Thanks,
Stacey.
On Saturday, April 1, 2017 at 2:58:15 PM UTC-4, Rob Nelson wrote:
>
> In your second example, you're missing a comma after true. Not sure if
> that's bad copy pasta or accurate with the source.
>
> On Sat, Apr 1, 2017 at 12:21 PM <[email protected] <javascript:>>
> wrote:
>
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/5b005c57-d25b-42ef-a88b-bc770dbbb7e2%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/puppet-users/5b005c57-d25b-42ef-a88b-bc770dbbb7e2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Rob Nelson
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/5d8c9010-b8c7-4659-98da-a5e8487b0fb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.