Giter Club home page Giter Club logo

Comments (21)

adrienthebo avatar adrienthebo commented on September 26, 2024

Pardon the slow response; I just discovered that I wasn't watching a bunch of my own repositories. I'll be reviewing this shortly. Thanks!

from puppet-alternatives.

chino avatar chino commented on September 26, 2024

I could actually do this quickly and send you a pull request if you want but I was super busy at the time so just threw up a bug here in case someone got to it first.. up to you!

from puppet-alternatives.

adrienthebo avatar adrienthebo commented on September 26, 2024

I'm looking at the man page for update-alternatives and I don't know how this behavior would interact with the current interface. How would you want to use this resource to install alternatives? Could you add some example cases?

from puppet-alternatives.

chino avatar chino commented on September 26, 2024

Well before you can set an alternative it must be first installed if it's not already.

So in current form your module allows someone to switch between the various system installed alternatives.

I would honestly think that any time someone wants to set set you should just install it for them if it's not already..

My example in my first message earlier shows how I used exec{} to install it if it's not already installed.

So let's say I want to update hadoop-conf (which is /etc/hadoop/conf) to use /etc/hadoop/conf.mine instead of the default /etc/hadoop/conf.empty:

alt=hadoop-conf
mine=/etc/hadoop/conf.mine
path=/etc/hadoop/conf
priority=50

# if it's not already installed
update-alternatives --list $alt | grep -q $mine ||

# install it
update-alternatives --verbose --install $path $alt $mine $priority

from puppet-alternatives.

adrienthebo avatar adrienthebo commented on September 26, 2024

So to be sure I understand you, the update-alternatives --install option will both install the link as an alternative and set it as the active alternative?

from puppet-alternatives.

chino avatar chino commented on September 26, 2024

Actually you must first install before you can set.

Which is why above I use Exec -> alternative since you still need to perform a set afterwards.

from puppet-alternatives.

jgoldschrafe avatar jgoldschrafe commented on September 26, 2024

Since there are use cases for installing an alternative that don't involve actually forcibly setting one, I can see a case for making this a separate type. They should be easy enough to chain together.

from puppet-alternatives.

adrienthebo avatar adrienthebo commented on September 26, 2024

@chino sorry about the delay in responding to this; I haven't had a lot of time to work on my modules.

I've prototyped a type interface at https://github.com/adrienthebo/puppet-alternatives/blob/0622f1e577c86ecf5ca1a32035f007e959d1b8ca/lib/puppet/type/alternative_entry.rb ; could you take a look and let me know if that will suit your needs?

My concern is that right now the alternative link is disconnected from the actual alternative, so /bin/false could be used as an alternative for www-browser but there's no immediate way to tie the two together. Trying to make this might mean using multiple namevars, which is a gigantic bag of worms that I don't know if I want to get into.

from puppet-alternatives.

philicious avatar philicious commented on September 26, 2024

I would like to see Redhat support added to 0622f1e

from puppet-alternatives.

schkovich avatar schkovich commented on September 26, 2024

@adrienthebo Works for me. Although I had to make some changes (@property_hash[:key] to @resource.value(:key) in alternative_entry/dpkg.rb).

from puppet-alternatives.

schoekek avatar schoekek commented on September 26, 2024

sorry it works not for me on debian wheezy and puppet 3.4.2
I try that:
alternative_entry { '/bin/nano':
ensure => absent,
}
This error came on client:
Debug: Executing '/usr/sbin/update-alternatives --list '
Error: /Stage[main]/Debian/Alternative_entry[/bin/nano]: Could not evaluate: Execution of '/usr/sbin/update-alternatives --list ' returned 2: update-alternatives: error: /var/lib/dpkg/alternatives/ corrupt: while reading status: Is a directory

from puppet-alternatives.

adrienthebo avatar adrienthebo commented on September 26, 2024

@lgbff could you try isolating whats happening that's causing that corruption? Could you see what commands are being run by Puppet and if they are doing what's expected?

from puppet-alternatives.

schoekek avatar schoekek commented on September 26, 2024

Hmm, i run on client:
#puppet agent -vd -t

and the error is:
Debug: Executing '/usr/sbin/update-alternatives --list '
Error: /Stage[main]/Debian/Alternative_entry[/bin/nano]: Could not evaluate: Execution of '/usr/sbin/update-alternatives --list ' returned 2: update-alternatives: error: /var/lib/dpkg/alternatives/ corrupt: while reading status: Is a directory

what can i try for more debugging?

from puppet-alternatives.

schoekek avatar schoekek commented on September 26, 2024

any ideas?

from puppet-alternatives.

adrienthebo avatar adrienthebo commented on September 26, 2024

@lgbff it seems like the commands being used by the provider aren't doing what's expected, could you do some testing around what is the correct way to remove alternates?

from puppet-alternatives.

schoekek avatar schoekek commented on September 26, 2024

I think, the variable @property_hash[:altname] in file lib /puppet/provider/alternative_entry/dpkg.rb on line 17 is empty.
the request of '/usr/sbin/update-alternatives --list ' gets a error:
-su: /usr/sbin/update-alternatives --list : Datei oder Verzeichnis nicht gefunden

here reminder my manifest:
alternative_entry { '/bin/nano':
ensure => 'present',
altlink => '/usr/bin/editor',
altname => 'editor',
priority => '5',
}

from puppet-alternatives.

jsosic avatar jsosic commented on September 26, 2024

I created a pull request with fixes of the bug(s) that trouble @lgbff

from puppet-alternatives.

jsosic avatar jsosic commented on September 26, 2024

alternative_entry merged to master.

from puppet-alternatives.

stkerr avatar stkerr commented on September 26, 2024

It would be nice if this feature was added to the documentation.

from puppet-alternatives.

adrienthebo avatar adrienthebo commented on September 26, 2024

@stkerr if you have a moment would you be able to submit a documentation pull request?

from puppet-alternatives.

stkerr avatar stkerr commented on September 26, 2024

Opened pull request #22 to add an example to the documentation.

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.