Closed dragonsmith closed 7 years ago
thanks for the heads up @dragonsmith (and for doing early testing!) i'll play around with this a bit and see if i can find a solution.
wild... so for now, you can work around this by using the long-form (i.e. unit_after
/unit_before
):
systemd_service 'node_exporter' do
unit_after %w(network.target remote-fs.target)
unit do
description 'Systemd unit for Prometheus Node Exporter'
end
install do
wanted_by 'multi-user.target'
end
service do
type 'simple'
exec_start "/usr/local/sbin/node_exporter #{options}"
working_directory '/'
restart 'on-failure'
restart_sec '30s'
end
action :create
end
and i'm kind of inclined to leave this there and send this to chef-sugar as a bug at this point...
well, after a little bit of futzing around, i think i found a way to prevent the method_missing hijinks from letting the resource find chef-sugar's before/after methods before trying unit_before
, unit_after
... https://github.com/nathwill/chef-systemd/pull/94/commits/4d2ede2cb282ca674b6218905acc16687d7ac3f9
Hello, We found out that your new refactored syntax is being broken by chef-sugar cookbook. More precisely by this method: https://github.com/sethvargo/chef-sugar/blob/master/lib/chef/sugar/filters.rb#L148
if we add
chef-sugar
to our run_list or as a dependency than the following example code will fail:with the following error:
which is raised by the 4th line from the example.
I understand it is the tricky situation where chef-sugar cookbook cuts some corners, but it is already integrated into other third-party cookbooks e.g. consul (like in our case).
I'm kinda unsure even what to purpose because the
after
method from chef-sugar becomes available after the compilation stage (if I understand it right).What do you think?
Thank you very much!