-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Cannot create directory[/opt/homebrew-cask] when running chef-client as a non-root user #70
Comments
Yes. This is actually expected, as When running these recipes with Chef, it's possible that |
In my case, I already have Homebrew and Cask installed. So when testing a recipe, I wasn't expecting this failure. If I run chef-client in local mode as myself and The Cask installer requires So I guess the real issue is that the Maybe the root cause is in the way that |
+1 Same problem here. /opt/homebrew-cask already exists, is already owned by the homebrew user. And yes, it's because the chef directory resource provider checks permissions of the parent directory before it checks whether it even needs to take action. |
Is it best to open an issue against chef for the directory resource provider? I just don't know enough about the existing use cases of that resource provider to know if it would open a can of worms. |
@jtimberman Do you have an opinion about how best to handle this? Thanks. |
I have been having this same problem as well. Do we even need the following code? Doesn't the Cask installer create these directories if they don't exist? directory '/Library/Caches/Homebrew/Casks' do
owner homebrew_owner
mode 00775
only_if { ::Dir.exist?('/Library/Caches/Homebrew') }
end
directory '/opt/homebrew-cask' do
owner homebrew_owner
mode 00775
recursive true
end
directory '/opt/homebrew-cask/Caskroom' do
owner homebrew_owner
mode 00775
end |
Relatedly the default |
Disable installation of Casks while these issues are being worked out: - sous-chefs/homebrew#70 - sous-chefs/homebrew#100
We no longer manage this directory in the latest version so I'm going to close this out |
When ensuring directories, the cask recipe makes the assumption that chef-client has been run either as root or with elevated privileges. If running chef-client in local mode as the current user, I run into the following error.
The java cookbook includes the
homebrew::cask
recipe in itshomebrew
recipe (https://github.com/agileorbit-cookbooks/java/blob/master/recipes/homebrew.rb). So when installing Java using Homebrew, it seems like it is a requirement to run chef-client as root. This has two smells to me:The java cookbook is just an example, though. This could be true for any dependent cookbook. But it is especially difficult to work around when trying to use community cookbooks.
Maybe this could be passed off as an issue with the java cookbook. But it just feels like cookbooks dependent on the homebrew cookbook are not expecting this cookbook to behave this way -- if being permission agnostic is a goal.
The text was updated successfully, but these errors were encountered: