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

Fix bug for incomplete brew installations #90

Open
jordigg opened this issue Nov 16, 2017 · 0 comments
Open

Fix bug for incomplete brew installations #90

jordigg opened this issue Nov 16, 2017 · 0 comments

Comments

@jordigg
Copy link
Contributor

jordigg commented Nov 16, 2017

I have seen in a few occasions the module fail because a package was in a bad state, usually when the installation couldn't complete because a the installer of such package was broken.

The error is similar to:

Debug: Prefetching brewcask resources for package
Debug: Listing installed packages
Debug: Executing: ‘/usr/bin/stat -nf %Uu /usr/local/bin/brew’
Debug: Executing: ‘/usr/bin/stat -nf %Ug /usr/local/bin/brew’
Debug: Executing with uid=404 gid=80: ‘/usr/local/bin/brew cask list --versions’
Warning: Could not match virtualbox
Debug: Storing state
Debug: Stored state in 0.35 seconds
Error: Failed to apply catalog: No resource and no name in property hash in brewcask instance
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider.rb:531:in `name’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package.rb:5:in `block in prefetch’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package.rb:4:in `each’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package.rb:4:in `prefetch’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:323:in `prefetch’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:223:in `prefetch_if_necessary’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:107:in `block in evaluate’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:116:in `call’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:116:in `traverse’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:154:in `evaluate’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:222:in `block in apply’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:155:in `with_destination’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:142:in `as_logging_destination’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:221:in `apply’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:171:in `block in apply_catalog’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `block in benchmark’
/opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:222:in `benchmark’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:170:in `apply_catalog’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:343:in `run_internal’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:221:in `block in run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:241:in `override’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:195:in `run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:45:in `block (4 levels) in run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:21:in `lock’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:45:in `block (3 levels) in run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:98:in `with_client’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:42:in `block (2 levels) in run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:65:in `run_in_fork’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:41:in `block in run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:179:in `call’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:179:in `controlled_run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:39:in `run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:353:in `onetime’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:331:in `run_command’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `block in run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:540:in `exit_on_fail’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in `run’
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute’
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'

I've seen this issue on brew cask install virtualbox a few weeks ago because they released a broken installer.

After debugging the error I've seen that the issue is caused by the package being "half" installed, the brew folders would have been created and populated but some files are missing.
The result of that is that you get an unexpected return when running brew cask list --versions where you will get the name of the package but an empty version string. The parsing then will send an error and break the run without providing much debugging information to fix it.

The line causing the error is https://github.com/TheKevJames/puppet-homebrew/blob/master/lib/puppet/provider/package/brewcask.rb#L149

This should not fail in this case, return some debugging information or trying to fix the error by itself. An improvement would be that if we detect a package without reported version we try and fix it but maybe this functionality would be better part of the brew project.

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

No branches or pull requests

2 participants