Whenever I try to use the chef-run command to run a recipe that includes a data bag on a node using the chef-run command, it fails to converge the remote host.
The command I'm executing is similar to:
chef-run NODE_FQDN --user SSH_USER --password 'PASSWORD' --sudo-password 'PASSWORD' COOKBOOK::RECIPE
The following reason is shown in the logs:
Compiling cookbooks...
Loading Chef InSpec profile files:
Loading Chef InSpec input files:
Loading Chef InSpec waiver files:
[2022-11-03T16:18:18-05:00] ERROR: Failed to load data bag item: "DATA_BAGNAME" "ITEM_NAME"
================================================================================
Recipe Compile Error in /var/chef-workstation/cache/cookbooks/COOKBOOK/recipes/RECIPE.rb
================================================================================
Net::HTTPServerException
------------------------
404 "Not Found"
When I apply the same recipe as a role on the node, Chef has no difficulty finding the data bag associated with the recipe.
Is there a setting somewhere that would tell the chef-run command how to find the data bag item?