Merge branch 'add_to_ssh_config_if_using_bitbucket_importer' into 'master'

Append to ~/.ssh/config when using bitbucket importer.

Fixes #699

See merge request !448
This commit is contained in:
Marin Jankovski 2015-08-27 16:19:58 +00:00
commit 3b0f7ebefc
1 changed files with 10 additions and 0 deletions

View File

@ -266,6 +266,16 @@ unless bitbucket_keys.nil?
mode 0600
end
ssh_config_file = File.join(ssh_dir, 'config')
bitbucket_host_config = "Host bitbucket.org\n IdentityFile ~/.ssh/bitbucket_rsa\n User #{node['gitlab']['user']['username']}"
execute 'manage config for bitbucket import key' do
command "echo '#{bitbucket_host_config}' >> #{ssh_config_file}"
user node['gitlab']['user']['username']
group node['gitlab']['user']['group']
not_if "grep 'IdentityFile ~/.ssh/bitbucket_rsa' #{ssh_config_file}"
end
file File.join(ssh_dir, 'bitbucket_rsa.pub') do
content "#{bitbucket_keys['public_key']}\n"
owner node['gitlab']['user']['username']