debian-mirror-gitlab/db/fixtures/development/11_keys.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
979 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
require './spec/support/sidekiq_middleware'
2014-09-02 18:07:02 +05:30
2017-09-10 17:25:29 +05:30
2017-08-17 22:00:37 +05:30
# Creating keys runs a gitlab-shell worker. Since we may not have the right
# gitlab-shell path set (yet) we need to disable this for these fixtures.
Sidekiq::Testing.disable! do
Gitlab::Seeder.quiet do
2020-04-08 14:13:33 +05:30
# We want to run `add_to_authorized_keys` immediately instead of after the commit, so
2017-09-10 17:25:29 +05:30
# that it falls under `Sidekiq::Testing.disable!`.
2020-04-08 14:13:33 +05:30
Key.skip_callback(:commit, :after, :add_to_authorized_keys)
2017-09-10 17:25:29 +05:30
2019-12-26 22:10:19 +05:30
User.not_mass_generated.first(10).each do |user|
2017-08-17 22:00:37 +05:30
key = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt#{user.id + 100}6k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
2014-09-02 18:07:02 +05:30
2017-09-10 17:25:29 +05:30
key = user.keys.create(
2017-08-17 22:00:37 +05:30
title: "Sample key #{user.id}",
key: key
)
2017-09-10 17:25:29 +05:30
Sidekiq::Worker.skipping_transaction_check do
2020-04-08 14:13:33 +05:30
key.add_to_authorized_keys
2017-09-10 17:25:29 +05:30
end
2017-08-17 22:00:37 +05:30
print '.'
end
2014-09-02 18:07:02 +05:30
end
end