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

Error: Failed to apply catalog: No command brew defined for provider brew #72

Closed jordigg closed 7 years ago

jordigg commented 7 years ago

I continue having the following error intermittently on new systems: Error: Failed to apply catalog: No command brew defined for provider brew

I'm not sure what is causing this error to appear on some new system and not on some others. I can confirm that if brew is already present before puppet runs the problem will disappear. May be related to the random order that puppet runs every time is executed.

The only way I've found to fix this issue is adding the following line commands :brew => '/usr/local/bin/brew' into https://github.com/TheKevJames/puppet-homebrew/blob/master/lib/puppet/provider/package/brew.rb

This shouldn't interfere with anything else, so I would suggest adding it in order to get rid of this random errors. What do you say @TheKevJames?

TheKevJames commented 7 years ago

Hmm, that line is already present in https://github.com/TheKevJames/puppet-homebrew/blob/master/lib/puppet/provider/package/brewcommon.rb#L15 . I wonder if this means the commands and has_features blocks are all uninheritable? Maybe we should move all of those into all three of the providers, instead of the base class?

Somewhat related: I'm very leery of merging anything new until I figure out why CI is failing. See https://github.com/TheKevJames/puppet-homebrew/pull/71 for the most up-to-date branch dealing with that... any ideas would be appreciated.

jordigg commented 7 years ago

Will have a look into CI. Is strange, was checking some of the errors and for example: brew info ack reports as not found and if you test on a real machine the package is there and exit code is 0. After that tries brew cask info ack and fails which is correct because is a brew package. Happens as well with brew info git and brew cask info google-chrome and when tested on a real machine seems to work just fine... Not sure why on some tests works and on others does not.

jordigg commented 7 years ago

Since adding that change I haven't had any issues so far with nay new system. Not sure right now on the implications but I would suggest adding commands :brew => '/usr/local/bin/brew' to each provider and removing it from it's parent. Will try with that and report.