Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soloist is incompatible with the homebrew cookbook because it forces you to run as root #27

Open
hazeledmands opened this issue May 18, 2013 · 5 comments

Comments

@hazeledmands
Copy link

From the readme for the opscode-cookbooks/homebrew repository:

it's anticipated that you'll run the cookbook as your own user

...and if you use soloist to install any homebrew packages:

ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of brew install  phantomjs ----
STDOUT:
STDERR: Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
---- End output of brew install  phantomjs ----

I'm new enough to chef that I'm not sure what the best thing to do here is -- but maybe we should make it optional to run soloist as root?

@ohrite
Copy link
Collaborator

ohrite commented May 18, 2013

Well that's odd. Soloist totally runs as you, and so has the ability to
harvest your user info before it sudoes anything. I'm wondering if there's
some way of passing that through. @mkocher?

On Saturday, May 18, 2013, Max Edmands wrote:

From the readme for the opscode-cookbooks/homebrewhttps://github.com/opscode-cookbooks/homebrew#prerequisitesrepository:

it's anticipated that you'll run the cookbook as your own user

...and if you use soloist to install any homebrew packages:

ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of brew install phantomjs ----
STDOUT:
STDERR: Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
---- End output of brew install phantomjs ----

I'm new enough to chef that I'm not sure what the best thing to do here is
-- but maybe we should make it optional to run soloist as root?


Reply to this email directly or view it on GitHubhttps://github.com//issues/27
.

Doc Ritezel
+1-415-601-5766

@hiremaga
Copy link
Collaborator

@cunnie and I ran into this when we tried to switch Sprout over to
the homebrew cookbook a couple of weeks ago.

It has to do with the way that the homebrew cookbook shells out.

At least in the case of Sprout, I think we'll want to keep sudo but find
some other way to have the homebrew cookbook shell out as
node['current_user']

On Saturday, May 18, 2013, Doc Ritezel wrote:

Well that's odd. Soloist totally runs as you, and so has the ability to
harvest your user info before it sudoes anything. I'm wondering if there's
some way of passing that through. @mkocher?

On Saturday, May 18, 2013, Max Edmands wrote:

From the readme for the opscode-cookbooks/homebrew<
https://github.com/opscode-cookbooks/homebrew#prerequisites>repository:

it's anticipated that you'll run the cookbook as your own user

...and if you use soloist to install any homebrew packages:

ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of brew install phantomjs ----
STDOUT:
STDERR: Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by
root.
However, this is both not recommended and completely unsupported so do
so at
your own risk.
---- End output of brew install phantomjs ----

I'm new enough to chef that I'm not sure what the best thing to do here
is
-- but maybe we should make it optional to run soloist as root?


Reply to this email directly or view it on GitHub<
https://github.com/mkocher/soloist/issues/27>
.

Doc Ritezel
+1-415-601-5766


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-18103503
.

@hazeledmands
Copy link
Author

@hiremaga, based on your suggestion I locally modified the homebrew cookbook's libraries/homebrew_package.rb from:

def brew(*args)
  get_response_from_command("brew #{args.join(' ')}")
end

to:

def brew(*args)
  get_response_from_command("su #{node['current_user']} -c 'brew #{args.join(' ')}'")
end

And it made everything work like a charm. Seems to go against their "it's anticipated that you'll run the cookbook as your own user" though, so I'm not sure if they'd accept this as a pull request...

@camelpunch
Copy link

Fast forward to the year 2015. We just ran into this and burned 30 mins or so.

@weitzel926
Copy link

@camelpunch - advice on how to fix this? I've been unable to get our soloist scripts working because of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants