Noop metaparameter in class not working as expected

106 views
Skip to first unread message

Julio Guevara

unread,
Aug 16, 2016, 7:29:22 PM8/16/16
to Puppet Users
All puppet agent have on puppet.conf
noop = true

I need to make sure that some classes (like the class that configure the puppet-agents or mcollective) can run regardless of noop setting.

Following documentation for puppet 4.5.3 i found that 
and

I changed corresponding include for resource like declaration of those classes, but resources contained inside that class still acted normally.
It seems to be that resources contained within a class will behave according to configuration set on puppet.conf even if the class has set noop to a different value.

Code i used to test this issue:
class foo {
  notify
{ '1.Resource noop true' :
    noop
=> true,
 
}
  notify
{ '2.Resource noop false' :
    noop
=> false,
 
}
  notify
{ "3.Class noop ${noop}" : }
  notify
{ "4.Client noop ${clientnoop}" : }
}


class { 'foo' :
  noop
=> true,
}

What I expected:
  Notify 1 should print as no-op regardless of other configuration.
  Notify 2 should print as yes-op regardless of other configuration.
  Notify 3 would print as no-op because of class having noop => true.
  Notify 4 would print as no-op because of class having noop => true.

What I'm seeing:
  Notify 1 prints as expected
  Notify 2 prints as expected
  Notify 3 prints as yes-op, not expected
  Notify 4 prints as yes-op, not expected

Output from
# puppet apply test.pp
Notice: Compiled catalog for xxxxxxx in environment production in 0.06 seconds
Notice: /Stage[main]/Foo/Notify[1.Resource noop true]/message: current_value absent, should be 1.Resource noop true (noop)
Notice: 2.Resource noop false
Notice: /Stage[main]/Foo/Notify[2.Resource noop false]/message: defined 'message' as '2.Resource noop false'
Notice: 3.Class noop true
Notice: /Stage[main]/Foo/Notify[3.Class noop true]/message: defined 'message' as '3.Class noop true'
Notice: 4.Client noop false
Notice: /Stage[main]/Foo/Notify[4.Client noop false]/message: defined 'message' as '4.Client noop false'
Notice: Applied catalog in 0.14 seconds

I don't think I have misunderstood the documentation from puppet, but i could be crazy.
Also, what happens with classes inside classes, those they get the noop from the parent class or from the configuration

Thanks
Julio

Julio Guevara

unread,
Aug 19, 2016, 10:53:41 AM8/19/16
to Puppet Users
:/ is this a bug?
Should I report it somewhere? o post this question somewhere else?

Thanks for your help!
Julio

Julio Guevara

unread,
Aug 22, 2016, 10:08:20 AM8/22/16
to Puppet Users
Last time I bump this email :/
Anyone has any idea?

Thanks
Julio

On Tuesday, August 16, 2016 at 6:29:22 PM UTC-5, Julio Guevara wrote:

Miguel Di Ciurcio Filho

unread,
Aug 22, 2016, 10:37:55 AM8/22/16
to puppet...@googlegroups.com
Passing noop => true to a class does not work as you expected.

This is one of that moments where you treat a class like a resource,
but it is not, unfortunately.

Take a look at this noop() function:

https://github.com/nrvale0/deploy-to-noop-part-1/tree/master/puppet/environments/production/modules/noop

It does work quite nicely and I've used in production and dos reflect
the behavior you are looking for.

Regards,

Miguel
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/1f35f5f7-5822-4480-af65-1ca649224d4d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
http://instruct.com.br
11 3230-6506
61 4042-2250

Julio Guevara

unread,
Aug 23, 2016, 10:14:18 AM8/23/16
to puppet...@googlegroups.com
Well this seems like a nice workaround.
But the problem with this is that if you are using third party modules, you can't really modify their behavior unless you have a wrapper class just to apply this, which is why the noop parameter would me much more better. I can understand that Classes does not behave like Resources, but I mean it is even used like an example for the puppet documentation. Is confusing.

I think i will give it a try, because I need some resources to allways be yes-op like the base that configures puppet and mcollective.

Thanks
Julio

--
http://instruct.com.br
11 3230-6506
61 4042-2250

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/xNtv564stCo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAK6YstnuLGVzJ9pKT%3Dx_%3DVpvP0vzu8h4%2B9kV8CR20P98oPSA6Q%40mail.gmail.com.

jcbollinger

unread,
Aug 24, 2016, 9:10:07 AM8/24/16
to Puppet Users


On Monday, August 22, 2016 at 9:08:20 AM UTC-5, Julio Guevara wrote:
Last time I bump this email :/
Anyone has any idea?


The docs specify that:

In addition to class-specific parameters, you can also specify a value for any metaparameter. In such cases, every resource contained in the class will also have that metaparameter:

noop is a metaparameter; in fact, it is the example used in the section of the docs I quoted.  Your expectation is therefore correct, and Puppet's behavior is buggy in this regard.  I'm uncertain whether this is a manifestation of PUP-3630, or whether it is a different issue.  You could consider asking about that over on puppet-developers, or in PUP-3630's comment thread.  If it is a new issue, then I'm sure Puppet would appreciate a bug report.


John

Reply all
Reply to author
Forward
0 new messages