sous-chefs / java

Development repository for the java cookbook
https://supermarket.chef.io/cookbooks/java
Apache License 2.0
386 stars 637 forks source link

set_attributes_from_version doesn't set default['java']['openjdk_packages'] for OSX #583

Closed pvandervelde closed 4 years ago

pvandervelde commented 4 years ago

:speaking_head: Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

:ghost: Brief Description

When trying to install the OpenJDK packages on OSX it fails with

undefined method '[]' for nil:NilClass

on line 52 of the openjdk.rb file

This looks to be due to the fact that the set_attributes_from_version.rb script sets the node.default['java']['openjdk_packages'] attribute for every platform option except for mac_os_x which then leads to homebrew trying to install a nil package.

:pancakes: Cookbook version

4.3.0

:woman_cook: Chef-Infra Version

15.0.300

:tophat: Platform details

macOS Catalina 10.15.2

Steps To Reproduce

Steps to reproduce the behavior:

attributes.rb

default['java']['jdk_version'] = '8'
default['java']['install_flavor'] = 'openjdk'
default['java']['install_type'] = 'jdk'

default.rb

include_recipe 'java'

Failure should follow

:police_car: Expected behavior

I expected it to not fail with an error message and install the OpenJDK on my OSX machine

damacus commented 4 years ago

We need to add some OSX testing to this cookbook. If you're able to do that, then we'd love the contributions to fix this area of testing.

Right now we're working on moving the non-Oracle JDKs on Linux platforms to custom resources. So this will happen post rework.

pvandervelde commented 4 years ago

Unfortunately, I have left the job where I had access to an OSX machine so I won't be able to test it at the moment. If I am in such a situation again I will let you know.

damacus commented 4 years ago

I think we might be able to test via Github Actions. I also have a couple of Mac machines kicking around to try it on 👍

damacus commented 4 years ago

As we no longer have attributes I'm going to close this one down. But we should open up another issue for Mac testing