Closed grogancolin closed 7 years ago
hmmm, so this cookbook uses the 'gem' method in the metadata to install the dbus-systemd gem, which seems to be the issue here. i'm guessing you're using an older version of chef? i believe this should be resolvable by doing a compile-time installation with a chef_gem resource for dbus-systemd, or upgrading to a chef version that supports the gem method during the metadata parsing.
let me know if i can be of further assistance.
i'm updating our metadata to specify that we require a chef_version >= 12.8.1, which is when the gem metadata support was added to chef core
Weird, I'm getting the same issue running with Chef 13.2.20, with systemd
3.0.1
googlecompute: cannot load such file -- dbus/systemd/machined
googlecompute:
googlecompute: Cookbook Trace:
googlecompute: ---------------
googlecompute: /var/chef/cache/cookbooks/systemd/resources/machine.rb:1:in `class_from_file'
googlecompute:
googlecompute: Relevant File Content:
googlecompute: ----------------------
googlecompute: /var/chef/cache/cookbooks/systemd/resources/machine.rb:
googlecompute:
googlecompute: 1>> require 'dbus/systemd/machined'
@mpires how have you installed chef? if omnibus, can you share the gem list? (/opt/chef/embedded/bin/gem list | grep systemd
). trying to find a reproduction case here
Hi @nathwill that command yields no results. I have to apologize for this false positive, this is most definitely due to my own private servers not having the dbus-systemd available. You can close it, sorry again.
no worries at all. fwiw, my understanding is that if you are using a new chef version, chef is supposed to automatically install the gem during the compile phase of a chef run since the metadata for this cookbook specifies dbus-systemd as a requirement. that seems to be born out by the integration testing, so i'm not really sure why it wouldn't be happening for you.
of course, if you're trying to require the gem outside of a chef run, that wouldn't happen, so maybe that's where the issue lies? lmk if i can be of further assistance.
Hello @nathwill
The reported bug seems to be related to a ChefSpec environment. I also encountered the same kind of issue. Chefspec is not handling properly the Gem dependencies defined in cookbook's metadata (chefspec/chefspec#871)
But I think we could find a solution to reduce the impact from the chef-systemd cookbooks.
I'll open a PR.
Since updating to 3.0.0 - we've had some cookbooks fail to run with: