example42 / puppet-perl

Puppet module to manage Perl and CPAN modules
Other
4 stars 26 forks source link

vagrant provision keeps reinstalling CPAN packages #8

Open apennebaker opened 10 years ago

apennebaker commented 10 years ago

Perl::Critic installs successfully on a fresh box with vagrant up. Then, every vagrant provision after that installs Perl::Critic again and again.

Source:

https://github.com/mcandre/mcandre-ubuntu

alvagante commented 10 years ago

The check for the presence of a module is done with perldoc -l : $cpan_command_check = $ensure ? { present => "perldoc -l ${name}", absent => "perldoc -l ${name} || true", } so that specic module might not provide proper docs. If you have better ways to verify if a perl module is installed let me know.

apennebaker commented 10 years ago

Good point, I'm not sure what to do in that case.

App::Ack mainly installs a binary, ack. But I'm not sure we could generalize this.

alvagante commented 10 years ago

What can easily be done is to add a parameter to the define that allows customization of the command to use to check for a module existence. The default can keep on using perldoc, but in edge cases the user may provide a custom command, whatever it might be

apennebaker commented 10 years ago

Yeah! onlyif => "/usr/bin/test ! -f <file>" works well for Execs. Could Perl modules get this attribute as well?

andrewblack commented 10 years ago

Ubuntu doesn't (in my experience) install perldoc by default

$ perldoc -l perldoc
You need to install the perl-doc package to use this program.
alvagante commented 10 years ago

True, the perl class manages its installation (on Ubuntu). I'm not a perl guru, and this is what I found online as a way to check, more or less reliably, for the precence of a module, if there are better methods please let me know. In any case it makes sense to add an option to let users specify custom check commands, for cope with edge cases. I can do it when I find time (not likely in the near future), relevant PRs are welcomed.

apennebaker commented 10 years ago

Should Class['Perl'] require Package['perl-doc'] before attempting to install Perl modules?