brew and macosx and puppet

546 views
Skip to first unread message

kegstand

unread,
Aug 17, 2012, 3:20:53 AM8/17/12
to puppet...@googlegroups.com
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

Daniele Sluijters

unread,
Aug 17, 2012, 3:38:00 AM8/17/12
to puppet...@googlegroups.com
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 ro...@chell.portal.daenney.net ~ brew install nginx
Cowardly refusing to `sudo brew install'

And it exists with an exitcode of:
9:35:14 ro...@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

kegstand

unread,
Aug 17, 2012, 1:29:26 PM8/17/12
to puppet...@googlegroups.com
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.

--
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...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

David Portabella

unread,
Oct 3, 2013, 5:27:11 AM10/3/13
to puppet...@googlegroups.com, kegs...@gmail.com
Reply all
Reply to author
Forward
0 new messages