Hello I am having issues getting chef to checkout my git repo using an ssh key from my data_bag.
Below is my git resource:
repo_key = search(:git, "id:git_key").first
git_key_file = "#{Chef::Config['file_cache_path']}/git_key/id_rsa"
directory "#{Chef::Config['file_cache_path']}/git_key" do
action :create
end
file git_key_file do
content repo_key['deploy_key']
mode "0755"
action :create_if_missing
end
git "/usr/share/my_repo" do
repository "git@github.com:my_name/some_repo.git"
checkout_branch "#{node["my_app"][:test_branch]}"
action :sync
ssh_wrapper "ssh -i #{git_key_file}"
end
When I run: sudo chef-client
I get the error below:
STDERR: error: cannot run ssh -i /var/chef/cache/git_key/id_rsa: No such file or directory
I have ssh'ed into the server and I can verify that the key file is in the proper place and contains the key.