Let's say I have a Polcyfile.rb in a cookbook called motd
:
name 'motd'
default_source :chef_repo, "../"
include_policy "Policyfile", path: "../environment"
run_list 'motd'
and a recipes/default.rb
:
file '/etc/motd' do
content node['message']
end
I have another cookbook called environment
which has a Policyfile.rb:
name 'environment'
default_source :chef_repo, "../"
run_list 'environment'
It has an empty recipes/default.rb
and attributes/default.rb
with:
default['message'] = 'i am a message'
I run chef install Policyfile.rb
in environment
dir to generate the lock file. When I run kitchen converge
from motd
dir and then kitchen login
, I get my expected output to console:
This system is built by the Bento project by Chef Software
More information can be found at https://github.com/chef/bento
i am a message
Now I go and update environment/attributes/default.rb
to be
default['message'] = 'i am updated'
I DO NOT run chef update Policyfile.rb
for environment
and run kitchen converge
again from motd
. My expectation is that kitchen login
will not reflect my update because Policyfile.lock.json
in motd
has not updated its revision_id
for the included environment
policy. But much to my surprise I indeed see the updated message in the console. I do see that Policyfile.lock.json
has a new root revision_id
and that cookbook_locks->environment->identifier
has changed. But still, I would think that in this case, if the cookbooks in my dependency Policyfile.rb have changed and don't compute to match the hash of its Policyfile.lock.json revision_id
then I should still see the old output or there should be some kind of other warning here.
I guess I'm just trying to understand the concept here more fully. On the one hand, the root revision_id
for motd
changed so I have achieved idempotency in one sense. But on the other hand the revision_id
for environment
dependency and its component cookbook don't match. Can someone explain why this makes sense?