So I'm not sure who's fault this is but here's the issue.
Kitchen openstack drops an empty ohai hint json file for ohai to pick up. However, if you are managing that ohai hint with an ohai cookbook lwrp the cookbook fails to converge.
The reproducer is to generate a new cookbook have it depend on ohai and put 'ohai_hint "openstack"' into the default recipe. Setup your kitchen.yml to test that recipe with the openstack plugin and it fails.
The issue is that the ohai cookbook is using 'JSON.parse(File.read("openstack.json"))' to load the current contents of the hint before the updated contents is saved. This throws an exception as the file is empty and doesn't contain valid JSON. Fixing the lwrp to use 'JSON.load' actually returns a nil. However, its unknown as to whether that's good behavior at that spot or not for all valid hints.
A simple fix from the kitchen openstack side would be to make sure the file contains '{}' instead of just being empty. This is the simplest valid JSON text and makes the ohai cookbook happy.
Currently I'm using ruby to detect if the file exists and is empty then blow it away and let ohai lay down the file with the new content.
So I'm not sure who's fault this is but here's the issue.
Kitchen openstack drops an empty ohai hint json file for ohai to pick up. However, if you are managing that ohai hint with an ohai cookbook lwrp the cookbook fails to converge.
The reproducer is to generate a new cookbook have it depend on ohai and put 'ohai_hint "openstack"' into the default recipe. Setup your kitchen.yml to test that recipe with the openstack plugin and it fails.
The issue is that the ohai cookbook is using 'JSON.parse(File.read("openstack.json"))' to load the current contents of the hint before the updated contents is saved. This throws an exception as the file is empty and doesn't contain valid JSON. Fixing the lwrp to use 'JSON.load' actually returns a nil. However, its unknown as to whether that's good behavior at that spot or not for all valid hints.
A simple fix from the kitchen openstack side would be to make sure the file contains '{}' instead of just being empty. This is the simplest valid JSON text and makes the ohai cookbook happy.
Currently I'm using ruby to detect if the file exists and is empty then blow it away and let ohai lay down the file with the new content.