Hello, I would like to go in depth with Puppet, but I haven''t found any good documentation about my issue (I''ve just ordered the official Puppet book, hope it helps). I need to install RPM packages with specified install-options, like -- prefix. But the package type does not support this kind of option. Does anyone have an idea how to redefine a type ? Thanks ! -- 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.
You can probably start by looking at the code for the various types/providers under puppet''s code directory. On Debian, for eg., the code for rpm package provider is under /usr/lib/ruby/1.8/puppet/provider/package/rpm.rb . On Wed, Sep 8, 2010 at 1:40 PM, SiD <selfsid@gmail.com> wrote:> Hello, > > I would like to go in depth with Puppet, but I haven''t found any good > documentation about my issue (I''ve just ordered the official Puppet > book, hope it helps). > I need to install RPM packages with specified install-options, like -- > prefix. But the package type does not support this kind of option. > Does anyone have an idea how to redefine a type ? > > Thanks ! > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.
Thanks for your quick answer. I''ve already analysed the code, but it does not really help me. Do I need to write a new provider in Ruby, or can I override the original one ? Thanks again ! On Sep 8, 10:45 am, mohit chawla <mohit.chawla.bin...@gmail.com> wrote:> You can probably start by looking at the code for the various > types/providers under puppet''s code directory. On Debian, for eg., the code > for rpm package provider is under > /usr/lib/ruby/1.8/puppet/provider/package/rpm.rb . > > On Wed, Sep 8, 2010 at 1:40 PM, SiD <self...@gmail.com> wrote: > > Hello, > > > I would like to go in depth with Puppet, but I haven''t found any good > > documentation about my issue (I''ve just ordered the official Puppet > > book, hope it helps). > > I need to install RPM packages with specified install-options, like -- > > prefix. But the package type does not support this kind of option. > > Does anyone have an idea how to redefine a type ? > > > Thanks ! > > > -- > > 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<puppet-users%2Bunsubscribe@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/puppet-users?hl=en.-- 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.
You can do both. As an introductory tutorial, have a look at http://www.kartar.net/2010/02/puppet-types-and-providers-are-easy/ and, more information at http://docs.puppetlabs.com/#extending_puppet On Sep 9, 1:27 pm, SiD <self...@gmail.com> wrote:> Thanks for your quick answer. > I''ve already analysed the code, but it does not really help me. Do I > need to write a new provider in Ruby, or can I override the original > one ? > > Thanks again ! > > On Sep 8, 10:45 am, mohit chawla <mohit.chawla.bin...@gmail.com> > wrote: > > > You can probably start by looking at the code for the various > > types/providers under puppet''s code directory. On Debian, for eg., the code > > for rpm package provider is under > > /usr/lib/ruby/1.8/puppet/provider/package/rpm.rb . > > > On Wed, Sep 8, 2010 at 1:40 PM, SiD <self...@gmail.com> wrote: > > > Hello, > > > > I would like to go in depth with Puppet, but I haven''t found any good > > > documentation about my issue (I''ve just ordered the official Puppet > > > book, hope it helps). > > > I need to install RPM packages with specified install-options, like -- > > > prefix. But the package type does not support this kind of option. > > > Does anyone have an idea how to redefine a type ? > > > > Thanks ! > > > > -- > > > 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<puppet-users%2Bunsubscribe@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/puppet-users?hl=en.-- 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.
Well as a starter -- This is a provider called rpm_plus.rb -- I found most of it floating around on the web and I seem to recall tweaking some small part of it, although I don''t recall now what it was... in any event this works and is in use in our environment. Provider looks like: Puppet::Type.type(:package).provide :rpm_plus, :parent => :rpm, :source => :rpm do has_feature :versionable desc "Support via ``rpm``." commands :rpm_plus => "rpm" def rpm(*args) rpm_plus(*args + @resource[:vendor].split(" ")) end end You''d throw this in a file called rpm_plus.rb and stash it in <module>/lib/puppet/provider/package/. What this basically does is wrap the existing RPM provider with another one that lets you pass arguments in a "vendor" attribute. You would then install your RPM package in your manifest the following way: package{ ''My_package'': ensure => ''version_number'', provider => rpm_plus, source = "<my_package_location>", vendor => "--prefix=/home/ads", } The key bits are the provider => rpm_plus attribute, which tells Puppet to override its default yum provider, and the vendor attribute, into which you pass your additional arguments. -Eric On Thu, Sep 9, 2010 at 4:27 AM, SiD <selfsid@gmail.com> wrote:> Thanks for your quick answer. > I''ve already analysed the code, but it does not really help me. Do I > need to write a new provider in Ruby, or can I override the original > one ? > > Thanks again ! > > On Sep 8, 10:45 am, mohit chawla <mohit.chawla.bin...@gmail.com> > wrote: >> You can probably start by looking at the code for the various >> types/providers under puppet''s code directory. On Debian, for eg., the code >> for rpm package provider is under >> /usr/lib/ruby/1.8/puppet/provider/package/rpm.rb . >> >> On Wed, Sep 8, 2010 at 1:40 PM, SiD <self...@gmail.com> wrote: >> > Hello, >> >> > I would like to go in depth with Puppet, but I haven''t found any good >> > documentation about my issue (I''ve just ordered the official Puppet >> > book, hope it helps). >> > I need to install RPM packages with specified install-options, like -- >> > prefix. But the package type does not support this kind of option. >> > Does anyone have an idea how to redefine a type ? >> >> > Thanks ! >> >> > -- >> > 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<puppet-users%2Bunsubscribe@googlegroups.com> >> > . >> > For more options, visit this group at >> >http://groups.google.com/group/puppet-users?hl=en. > > -- > 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. > >-- 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.
Thank you for your links, especially kartar.net. Blog posts are really useful and clear ! On Sep 9, 10:46 am, alcy <mohit.chawla.bin...@gmail.com> wrote:> You can do both. > > As an introductory tutorial, have a look athttp://www.kartar.net/2010/02/puppet-types-and-providers-are-easy/ > and, more information athttp://docs.puppetlabs.com/#extending_puppet > > On Sep 9, 1:27 pm, SiD <self...@gmail.com> wrote: > > > Thanks for your quick answer. > > I''ve already analysed the code, but it does not really help me. Do I > > need to write a new provider in Ruby, or can I override the original > > one ? > > > Thanks again ! > > > On Sep 8, 10:45 am, mohit chawla <mohit.chawla.bin...@gmail.com> > > wrote: > > > > You can probably start by looking at the code for the various > > > types/providers under puppet''s code directory. On Debian, for eg., the code > > > for rpm package provider is under > > > /usr/lib/ruby/1.8/puppet/provider/package/rpm.rb . > > > > On Wed, Sep 8, 2010 at 1:40 PM, SiD <self...@gmail.com> wrote: > > > > Hello, > > > > > I would like to go in depth with Puppet, but I haven''t found any good > > > > documentation about my issue (I''ve just ordered the official Puppet > > > > book, hope it helps). > > > > I need to install RPM packages with specified install-options, like -- > > > > prefix. But the package type does not support this kind of option. > > > > Does anyone have an idea how to redefine a type ? > > > > > Thanks ! > > > > > -- > > > > 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<puppet-users%2Bunsubscribe@googlegroups.com> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/puppet-users?hl=en.-- 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.
Hey Eric Wow, it''s exactly what I wanted to do. I did not know how to call the provider and modify the command without writing a new provider. Simple, clear and powerful. Thanks a lot for sharing ! Did you use "vendor" parameter because it is not possible to create new parameters ? I have tired, but it does not work. On Sep 9, 5:40 pm, Eric Shamow <eric.sha...@gmail.com> wrote:> Well as a starter -- > > This is a provider called rpm_plus.rb -- I found most of it floating > around on the web and I seem to recall tweaking some small part of it, > although I don''t recall now what it was... in any event this works and > is in use in our environment. Provider looks like: > > Puppet::Type.type(:package).provide :rpm_plus, :parent => :rpm, :source => > :rpm do > > has_feature :versionable > > desc "Support via ``rpm``." > commands :rpm_plus => "rpm" > def rpm(*args) > rpm_plus(*args + @resource[:vendor].split(" ")) > end > end > > You''d throw this in a file called rpm_plus.rb and stash it in > <module>/lib/puppet/provider/package/. What this basically does is > wrap the existing RPM provider with another one that lets you pass > arguments in a "vendor" attribute. > > You would then install your RPM package in your manifest the following way: > > package{ ''My_package'': > ensure => ''version_number'', > provider => rpm_plus, > source = "<my_package_location>", > vendor => "--prefix=/home/ads", > } > > The key bits are the provider => rpm_plus attribute, which tells > Puppet to override its default yum provider, and the vendor attribute, > into which you pass your additional arguments. > > -Eric > > On Thu, Sep 9, 2010 at 4:27 AM, SiD <self...@gmail.com> wrote: > > Thanks for your quick answer. > > I''ve already analysed the code, but it does not really help me. Do I > > need to write a new provider in Ruby, or can I override the original > > one ? > > > Thanks again ! > > > On Sep 8, 10:45 am, mohit chawla <mohit.chawla.bin...@gmail.com> > > wrote: > >> You can probably start by looking at the code for the various > >> types/providers under puppet''s code directory. On Debian, for eg., the code > >> for rpm package provider is under > >> /usr/lib/ruby/1.8/puppet/provider/package/rpm.rb . > > >> On Wed, Sep 8, 2010 at 1:40 PM, SiD <self...@gmail.com> wrote: > >> > Hello, > > >> > I would like to go in depth with Puppet, but I haven''t found any good > >> > documentation about my issue (I''ve just ordered the official Puppet > >> > book, hope it helps). > >> > I need to install RPM packages with specified install-options, like -- > >> > prefix. But the package type does not support this kind of option. > >> > Does anyone have an idea how to redefine a type ? > > >> > Thanks ! > > >> > -- > >> > 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<puppet-users%2Bunsubscribe@googlegroups.com> > >> > . > >> > For more options, visit this group at > >> >http://groups.google.com/group/puppet-users?hl=en. > > > -- > > 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 athttp://groups.google.com/group/puppet-users?hl=en.-- 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.