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

28 lines
949 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
2017-09-10 17:25:29 +05:30
# We want to run `add_to_shell` immediately instead of after the commit, so
# that it falls under `Sidekiq::Testing.disable!`.
Key.skip_callback(:commit, :after, :add_to_shell)
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
key.add_to_shell
end
2017-08-17 22:00:37 +05:30
print '.'
end
2014-09-02 18:07:02 +05:30
end
end