Created
June 1, 2014 16:12
-
-
Save mindjiver/81d299b974c01aebc872 to your computer and use it in GitHub Desktop.
Create initial user in Gerrit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Insert the base values for the intial Gerrit user. This user will | |
-- become the administrator of the server. As this user is a local | |
-- user it will not be able to login through the web UI. | |
-- Create a local user, we need to insertions for this. | |
INSERT INTO account_external_ids VALUES(1000000, | |
NULL, | |
NULL, | |
'username:<%= node['gerrit']['admin']['user_name'] %>'); | |
INSERT INTO account_external_ids VALUES(1000000, | |
'<%= node['gerrit']['admin']['email'] -%>', | |
NULL, | |
'mailto:<%= node['gerrit']['admin']['email'] %>'); | |
-- The group_id = 1 is the magic value which will add the initial user | |
-- 1000000 to the administrator group. | |
INSERT INTO account_group_members VALUES(1000000, 1); | |
-- Insert the audit information. | |
INSERT INTO account_group_members_audit VALUES(1000000, | |
NULL, | |
NULL, | |
1000000, | |
'<%= @timestamp -%>', | |
1); | |
-- Set the sequence next value to increment to 1000001. | |
SELECT pg_catalog.setval('account_id', 1000000, true); | |
-- Insert the public SSH key for the administrator account. | |
INSERT INTO account_ssh_keys VALUES('<%= node['gerrit']['admin']['ssh_key'] -%>', | |
'Y', | |
1000000, | |
1); | |
-- Insert the internal Gerrit user which is connected to the | |
-- account_external_id we created before. | |
INSERT INTO accounts VALUES(NULL, | |
'<%= node['gerrit']['admin']['full_name'] -%>', | |
'N', | |
NULL, | |
NULL, | |
NULL, | |
25, | |
'N', | |
'Y', | |
'N', | |
NULL, | |
'Y', | |
'N', | |
'<%= node['gerrit']['admin']['email'] -%>', | |
'<%= @timestamp -%>', | |
1000000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment