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

On Mon, Aug 22, 2016 at 9:37 AM, Miguel Di Ciurcio Filho <
[email protected]> wrote:

> 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
>
>
> On Tue, Aug 16, 2016 at 8:29 PM, Julio Guevara
> <[email protected]> wrote:
> > 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
> > https://docs.puppet.com/puppet/4.5/reference/metaparameter.html#noop
> > and
> > https://docs.puppet.com/puppet/4.5/reference/lang_
> classes.html#using-resource-like-declarations
> >
> > 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
> >
> > --
> > 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/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
>
> --
> 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
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/CAK6YstnuLGVzJ9pKT%3Dx_%3DVpvP0vzu8h4%
> 2B9kV8CR20P98oPSA6Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADzjYHFohqJDVJdj05ws9mCUU78VT0dvQL9EpGT-YW-SKUxxqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to