#
# Cookbook:: irrigate-vector
# Recipe:: deploy_qa_user
#
# Author:: Orchard IT (<it@theorchard.com>)
#

if platform_family?('windows')
  directory 'c:\Git\.ssh' do
    action :create
    recursive true
  end

  github_ssh_key_location = 'c:\Git\.ssh\id_rsa'
  github_ssh_key = data_bag_item('secrets', node['vector']['deploy_user_github_key'])
  private_key = github_ssh_key['private_key'].chomp
  file github_ssh_key_location do
    content private_key
    sensitive true
  end

  # Relax ssh host key checks or initial git clone will fail
  key_config = "Host *\n\tStrictHostKeyChecking no\n"
  file 'c:\Git\.ssh\config' do
    content key_config
  end
end
