gary
2008-Dec-26 07:38 UTC
[Puppet Users] realizing virtual packages with different provider (gem)
Hello,
I''m starting to add gems as virtual resources. Some of them have the
same name as default provider packages. If I want to realize them,
should I define the package with an alias? Like:
@package {''mysql'':
ensure => present,
alias => ''mysqlgem'',
provider => gem,
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Joshua Timberman
2008-Dec-26 15:04 UTC
[Puppet Users] Re: realizing virtual packages with different provider (gem)
On Fri, Dec 26, 2008 at 12:38 AM, gary <garyyuen@gmail.com> wrote:> > I''m starting to add gems as virtual resources. Some of them have the > same name as default provider packages. If I want to realize them, > should I define the package with an alias? Like: > > @package {''mysql'': > ensure => present, > alias => ''mysqlgem'', > provider => gem, > }I''d use a define. define gem_package($ensure = ''true'', $version) { exec { "gem-package-$name": path => "/path/to/gem_command", command => "gem install --version $version $name", unless => "gem list --local rails | grep ''${name}.*${version}'' } You can add more command options too, such as handling a different gem server. Or disable ri and rdoc. -- Joshua Timberman http://twitter.com/jtimberman --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Joshua Timberman
2008-Dec-26 15:05 UTC
[Puppet Users] Re: realizing virtual packages with different provider (gem)
Argh. Thats what I get pre-coffee. I''d also check the syntax and add the missing brace in the exec:> unless => "gem list --local rails | grep ''${name}.*${version}''}> }-- Joshua Timberman http://twitter.com/jtimberman --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
gary
2009-Jan-08 09:59 UTC
[Puppet Users] Re: realizing virtual packages with different provider (gem)
Hello Joshua,
Thank you very much. I finally got around to trying this out and it
works nicely! But for some reason the unless grep didn''t work. I had
it test for the installed gem directory:
define rubygems::install ( $ensure = ''true'', $version ) {
exec { "gem-$name":
command => "/usr/local/bin/gem install $name --version
$version",
onlyif => "test -f /usr/local/bin/gem",
unless => "test -d /usr/local/lib/ruby/gems/1.8/gems/${name}-$
{version}",
}
}
On Dec 26 2008, 11:05 pm, "Joshua Timberman"
<joshua.timber...@gmail.com> wrote:> Argh. Thats what I get pre-coffee. I''d also check the syntax and
add
> the missing brace in the exec:
>
>
>
> > unless => "gemlist --local rails | grep
''${name}.*${version}''
> }
> > }
>
> --
> Joshua Timbermanhttp://twitter.com/jtimberman
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---