On Nov 18, 2008, at 6:19 AM, gary wrote:

>
> Hello,
>
> I'm hoping someone can help out. :)
>
> Our rails deployment uses a custom compiled ruby. The app runs under a
> certain named rails. So in trying to be able to manage it's gems, I
> tried creating a custom provider. I took the default gem provider and
> modified it like this:
>
>    commands :gemcmd => "/usr/bin/sudo -u rails /opt/.../lib/ruby/bin/
> gem"
>
> When I run puppet interactive, the custom provider is found though it
> returns some errors:
>
> ******
> warning: Could not match /usr/bin/gem:11:Warning: Gem::manage_gems is
> deprecated and will be removed on or after March 2009.
> warning: Could not match /usr/lib/ruby/gems/1.8/gems/puppet-0.24.6/ 
> lib/
> puppet/util.rb:334: [BUG] rb_sys_fail() - errno == 0
> warning: Could not match ruby 1.8.6 (2007-09-24) [x86_64-linux]
> warning: Could not match /usr/bin/gem:11:Warning: Gem::manage_gems is
> deprecated and will be removed on or after March 2009.
> ******
>
> Later, I may patch the custom provider to be able to specify a user.
> For now, I'm just trying to get it to work. :) Maybe I'm missing
> something?


You specifically want the gems installed as that user?  Hmm.  That's a  
bit harder; we don't do much of that right now.

However, you should be able to do something like (haven't tested this,  
but it might work):

create a subclass of the existing gem provider:

...provides(:railsgem) do
# Then change the commands to use:
   commands :gem => "/my/wierd/gem/path", ...

# Override the created methods to use a special user:

def gem(command)
   Puppet::Util::SUIDManager.asuser("rails") do
     super
   end
end

The 'super' might not work correctly because of how the methods are  
added; you might need to reimplement the command execution, just do  
'execute(command)'.  See provider.rb, all of the different 'command'  
methods.

If you have further questions, please post them to the -dev list.

-- 
I'm seventeen and I'm crazy. My uncle says the two always go together.
When people ask your age, he said, always say seventeen and insane.
     -- Ray Bradbury
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to