chef-cookbooks / ssh_known_hosts

Development repository for Chef Cookbook ssh_known_hosts
https://supermarket.chef.io/cookbooks/ssh_known_hosts
Apache License 2.0
72 stars 77 forks source link

Removed :delayed property from ssh known hosts template #81

Closed PierreBeucher closed 7 years ago

PierreBeucher commented 7 years ago

A delayed property on the update ssh known hosts file template caused issue #77. Without the delayed property, the ssh_known_hosts file is updated as expected.

Signed-off-by: Pierre Beucher beucher.pierre@gmail.com

Issues Resolved

77: Using recently added ssh host does not work until next provision/converge

Check List

lamont-granquist commented 7 years ago

no, this is working as-designed. this is a delayed accumulator pattern which must run at the end of the chef run in a delayed notification at the end of the run.

the note that you've deleted is that the resource should be changed to:

  action :nothing
  delayed_action :create

but it will still behave identically.

if you need an ssh key for deployment for a github key the you should install that early now, into something like /root/.ssh/known_hosts in order to do deployments (the same way that you would deploy github's ssh key if you were deploying from github and not using this cookbook).

lamont-granquist commented 7 years ago

this also wouldn't have fixed the problem anyway. since the action code doesn't run until converge time, the root run_context will be mostly populated with all the resource by the time this run. the net effect is that typically you move the resource from the delayed action phase to the tail end of the root run_list, which isn't what would solve #77. it might solve it for someone who only used ssh keys in a deployment that took place in a delayed action, but as a general solution forcing everyone to do their deployment actions in delayed notifications would be awful.