TheKevJames / puppet-homebrew

homebrew (+brewcask! +taps!) package installer and provider
https://forge.puppet.com/thekevjames/homebrew
Apache License 2.0
18 stars 44 forks source link

Notify error when brew user has no privileges on cwd #111

Open sp-ricard-valverde opened 6 years ago

sp-ricard-valverde commented 6 years ago

After reporting the original problem with brew here and getting closed without resolution I guess something could be done at least on this module's side.

The problem is, if running puppet apply with sudo and from a private folder, when Homebrew tries to install the packages as the Homebrew unprivileged user, it fails. When it fails this way, the puppet module does not catch this particular permission error and continues execution, in the end leading to errors like Error: Could not find package: <name>.

I think It should be useful to preventively report an error in the lines:

raise Puppet::ExecutionFailure, "Homebrew user has no privileges on the current folder #{pwd}"
TheKevJames commented 6 years ago

Linking to #101 as a partial dupe.