The problem is like this:
I have two common cookbook, named common1, common2, they have multiple versions.
$ knife cookbook show common1
common1 1.0.1 1.0.0
$ knife cookbook show common2
common2 1.0.1 1.0.0
Cookbook test1 depends on the common1:
cookbooks/test1/metadata.rb
...
depends 'common1'
without explicit version specification such as depends 'common1' = '1.0.1'.
Cookbook test2 are similar, but it depends on both common1, common2.
cookbooks/test2/metadata.rb
...
depends 'common2'
depends 'common1'
Now the wired thing is that:
all cookbooks are always using old common1, while newer common2 are being used as expected.
# chef-client -o test1 --why-run | egrep -- '- common'
- common1 (1.0.0)
# chef-client -o test2 --why-run | egrep -- '- common'
- common2 (1.0.1)
- common1 (1.0.0)
I dumped the http data between chef client and server, the only difference is that
the chef client node was bootstrapped with an old test1 as its runlist, which used old common, the knife node command shows that. the common2 is not in runlist.
I suspect the bootstrap timing cookbook version matters, interfere new version.
Can anyone explain this issue?
Other info:
- Chef-client version: 4.14.29
- Host: Ubuntu Bionic
EDIT: more info, the ... in the test1/metadata.rb matters
...
depends 'common1'
it is
depends 'base'
depends 'common1'
where the base cookbook has multiple versions.
once I removed the depends 'base', it works as expected, the newer common1 get used.
Still checking. So far I have not found the base cookbook declared specific version of anything, the latest base cookbook has no any dependence, but still caused the issue.