Giter VIP home page Giter VIP logo

Comments (12)

txaj avatar txaj commented on June 22, 2024

I agree with you, but your suggestion depends too much on the provider used by the package type.

I can't think of a better way to do either

from puppet-collectd.

blkperl avatar blkperl commented on June 22, 2024

Yeah I haven’t thought of a good solution yet for this problem. It affects all the plugins that check for collectd version.

from puppet-collectd.

txaj avatar txaj commented on June 22, 2024

When I look on how we use this fact, it appear we are discriminating against a rather big version number. Couldn't we take the approach of discriminating against ::lsbdistrelease ?

from puppet-collectd.

jpoittevin avatar jpoittevin commented on June 22, 2024

I'm not sure it will be enough. If one uses a special repository, he could have a different version of collectd than the one expected with a given dist.

from puppet-collectd.

blkperl avatar blkperl commented on June 22, 2024

We could add $::lsbdistcodename version defaults and allow it to be overridden by the user but then we have to maintain a list for the life time of the module which is not very appealing.

from puppet-collectd.

vladciobancai avatar vladciobancai commented on June 22, 2024

Any work around about this issue ?

--later :
I have found a small work around that works for me. I have created a facter script to overwrite the collectd_version in order that the plugins to be placed at the first run of puppet.

Facter.add("collectd_version") do
setcode do
"5.4.1-1.7.amzn1"
end
end

from puppet-collectd.

bdellegrazie avatar bdellegrazie commented on June 22, 2024

Here is another suggestion:
instead of using the fact directly in the ERB templates, why not use a class variable (e.g. $_collectd_version) which is set based on one of the following sources:

  • $version (if it represents an explicit version - major.minor.revision parts only)
  • $collectd_version fact, if not undef / nil
  • default version supplied from hiera or minimum version supported by this module

This permits the system administrator to use an explicit version for the package and get a single puppet run and/or to supply a default minimum version if these are not set.
e.g. assuming class with defaults as follows (untested)

class collectd(
  ...
  $version  = installed,
  $collectd_default_version = '5.0.0',
) inherits collectd::params {
  ...
   $_collectd_version = pick( regsubst($version, '^\d+\.\d+\.\d+', '\0'), $collectd_version, $collectd_default_version)
  ...
}

Then use $_collectd_version in the ERB templates.

What do you think? If you think its worthwhile I can attempt a pull request.

from puppet-collectd.

bdellegrazie avatar bdellegrazie commented on June 22, 2024

@johnf, @txaj, @jpoittevin, @ngagecj:
Any comment on my potential solution above? I'm happy to create a PR if its considered reasonable.
Thanks

from puppet-collectd.

txaj avatar txaj commented on June 22, 2024

This is a great idea!

In your PR you may want 1/ not to break compatibility by setting the $collectd_default_version to undef, so it'll still need two runs if not explicitly configured 2/ document this feature both in the "usage" section and down the README with a format like "Puppet needs two runs to correctly write my conf, why ?" and refer to this issue

from puppet-collectd.

bdellegrazie avatar bdellegrazie commented on June 22, 2024

@txaj: I've raised the PR as requested.
I've tested this but it relies upon the user loading the collectd class before instantiating any plugin classes. I'm not sure there's a way around this.
Tests for the plugins have been updated but there isn't an easy way of testing the version selector as its only exposed by an internal variable.
Thoughts?

from puppet-collectd.

bdellegrazie avatar bdellegrazie commented on June 22, 2024

Rebased to current master

from puppet-collectd.

igalic avatar igalic commented on June 22, 2024

with the closing of #305 can we close this issue, too?

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.