I figured out how to get puppet to install nginx through the puppet
provider without running it as root.

someone on IRC suggested I add "logoutput => on_failure"

        exec { "brew_install_nginx":
            command => "/usr/local/bin/brew install nginx",
            creates => "/usr/local/sbin/nginx",
            logoutput => on_failure,
            path=>
"/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/Library/Aliases",
            user => "push",
        }

which gave me lots of handy error output.

thanks IRC.


On Fri, Aug 17, 2012 at 12:38 AM, Daniele Sluijters <
daniele.sluijt...@gmail.com> wrote:

> Hello,
>
> The problem is that you're running 'brew install nginx' as root, since
> Puppet runs as root.
>
> If you run that command as root on a console it will tell you:
>
> 9:35:11 r...@chell.portal.daenney.net ~ brew install nginx
> Cowardly refusing to `sudo brew install'
>
> And it exists with an exitcode of:
> 9:35:14 r...@chell.portal.daenney.net ~ echo $?
>                                                     1 ↵
> 1
>
> So, unless you can run that command as the actual user that owns the brew
> installation this just won't work.
>
> --
> Daniele Sluijters
>
> On Friday, 17 August 2012 09:20:53 UTC+2, Dan wrote:
>>
>> any hints on installing a package through the 'brew' provider on macosx?
>>
>> code:
>>
>>         exec { "brew_install_nginx":
>>             command => "/usr/local/bin/brew install nginx",
>>             creates => "/usr/local/sbin/nginx",
>>             path=> "/usr/local/sbin:/usr/local/**bin:/usr/sbin:/usr/bin",
>>             user => "push",
>>         }
>>
>> "brew install nginx" works from the command line, outside of puppet
>>
>> output:
>>
>> $ ls /usr/local/sbin/nginx
>> ls: /usr/local/sbin/nginx: No such file or directory
>> $ /opt/bin/contact_puppet_**server.sh
>> info: Retrieving plugin
>> info: Caching catalog for dev.push.am
>> info: Applying configuration version '1345186944'
>> err: /Stage[main]/Nginx::Install/**Exec[brew_install_nginx]/**returns:
>> change from notrun to 0 failed: /usr/local/bin/brew install nginx returned
>> 1 instead of one of [0] at 
>> /etc/puppet/modules/nginx/**manifests/install.pp:23
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/9Ox-OD1_m8QJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to