Giter VIP home page Giter VIP logo

Comments (6)

ffrank avatar ffrank commented on June 26, 2024

Looks like a rather severe design error.

Yes, the alternative's name cannot map to name and be namevar, because by its nature, you need more than one alternative that share the same name. However, it's plain that there can also be several independent alternatives with different names (alternatives for different things) that point to the same binary. So the path (in alternative terms) is not unique at all.

What is probably unique is the name+path combination, forming a distinct alternative for name. Going for a composite namevar, however, would likely be absolute overkill.

Proposal: Make the name parameter meaningless. Add a path property that takes the role of the current name parameter. The wrinkle being that it will allow managing the same resource twice or more, like:

alternative_entry { 'nvim as vim':
  path     => '/usr/bin/nvim',
  altlink  => '/usr/bin/vim',
  altname  => 'vim',
}
alternative_entry { 'trololol':
  path     => '/usr/bin/nvim',
  altlink  => '/usr/bin/vim',
  altname  => 'vim',
  priority => 9000,
}

Still, I rather feel that this inconvenience is not worth the hassle of dealing with composite namevars. Unless, of course, @crayfishx wishes to step up and do the fun part ;-)

(Note, I especially love how the provider has a name= method despite name not being a property.)

from puppet-alternatives.

crayfishx avatar crayfishx commented on June 26, 2024

@ffrank I don't think composite namevars are overkill at all, in fact, I think it's very appropriate for this type. I'll try and contribute the 'fun part' ;-)...

from puppet-alternatives.

crayfishx avatar crayfishx commented on June 26, 2024

I would much rather see composite namevars than the leave it open to duplicate resource declarations like in your example.

from puppet-alternatives.

ffrank avatar ffrank commented on June 26, 2024

Cool. And yes, that will probably be the only way to build a really clean abstraction.

from puppet-alternatives.

igalic avatar igalic commented on June 26, 2024

can't we just fix this by using title and name distinctly?
or… use better… names?

from puppet-alternatives.

ffrank avatar ffrank commented on June 26, 2024

Well, you can always make name to be meaningless, so that resource titles become arbitrary.

However (and this is a big one), this allows users to manage any entity with multiple resources (that have different, meaningless names/titles). So that would be quite horrible as well. Let's not do that.

from puppet-alternatives.

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.