Commit 4c1231ac authored by Stan Hu's avatar Stan Hu

Fix SSH Detect Host Keys not working

Due to a change in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24245, the Detect
Host Key feature in the SSH mirroring stopped working.
`SshHostKey#primary_key` was being used instead of the hard-coded
`:id`. However, `SshHostKey#find_by` was expecting the symbolized `:id`
rather than the string `id`, so it could never find the host key it was
supposed to update.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56855
parent 0cc5e956
......@@ -54,7 +54,7 @@ class SshHostKey
# Needed for reactive caching
def self.primary_key
'id'
:id
end
def id
......
---
title: Fix Detect Host Keys not working
merge_request: 24884
author:
type: fixed
......@@ -50,6 +50,12 @@ describe SshHostKey do
subject(:ssh_host_key) { described_class.new(project: project, url: 'ssh://example.com:2222', compare_host_keys: compare_host_keys) }
describe '.primary_key' do
it 'returns a symbol' do
expect(described_class.primary_key).to eq(:id)
end
end
describe '#fingerprints', :use_clean_rails_memory_store_caching do
it 'returns an array of indexed fingerprints when the cache is filled' do
stub_reactive_cache(ssh_host_key, known_hosts: known_hosts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment