Giter Club home page Giter Club logo

Comments (6)

txaj avatar txaj commented on September 13, 2024

Ok... Boolean are quite badly handled here...

furthermore the default of this option changed in collectd 4.6.0

The only solution I see here is to replace "undef" by the sanest default for that kind of usage (which is "true"). This sane default is also the current default for collectd >= 4.6.0, so we'll be coherent with the documentation of the most recent version of collectd.

Once this default set, we could remove the if close in the template. What do you guys think ?

from puppet-collectd.

txaj avatar txaj commented on September 13, 2024

as a side note i'm also dubious about why the string "false" gets interpreted as a boolean. That may be the root issue in fact

from puppet-collectd.

huasome avatar huasome commented on September 13, 2024

I tried both setting the value as a string and as a boolean, no joy on either.

from puppet-collectd.

txaj avatar txaj commented on September 13, 2024

The approach used in #201 might solve our issue here

from puppet-collectd.

kitchen avatar kitchen commented on September 13, 2024

FWIW, the way I handle "tri-state bools" (true/false/undef) is like so:

define foo (
  $foo = undef
) {
  $foo_bool = str2bool($foo)
}

and then in template code:

<% if [email protected]? %>
  foo = <%= @foo ? 'true' : 'false' %>
<% end %>

this has the added benefit of normalizing boolean values on input to what the output should be. str2bool is from puppetlabs/stdlib, but that's ok since it's already used by this module :)

from puppet-collectd.

kitchen avatar kitchen commented on September 13, 2024

I edited the last comment, sorry about that. I had typed up my old approach and realized that it was my old approach :)

from puppet-collectd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.