Remove transactions from the koji staging-sync sql script.

This commit is contained in:
Ralph Bean 2015-09-14 17:34:49 +00:00
parent 2d7093cee5
commit f3c857cc11

View file

@ -24,8 +24,6 @@
-- [unset kojihub ServerOffline setting] -- [unset kojihub ServerOffline setting]
BEGIN;
-- bump sequences (not strictly needed anymore) -- bump sequences (not strictly needed anymore)
select now() as time, 'bumping sequences' as msg; select now() as time, 'bumping sequences' as msg;
alter sequence task_id_seq restart with 90000000; alter sequence task_id_seq restart with 90000000;
@ -64,14 +62,10 @@ select now() as time, 'expiring repos' as msg;
update repo set state = 3 where state in (0, 1, 2); update repo set state = 3 where state in (0, 1, 2);
COMMIT;
-- add our staging builders, dynamically pulled from ansible inventory -- add our staging builders, dynamically pulled from ansible inventory
{% for host in groups['buildvm-stg'] + groups['koji-stg'] %} {% for host in groups['buildvm-stg'] + groups['koji-stg'] %}
BEGIN;
select now() as time, 'adding staging host {{ host }}' as msg; select now() as time, 'adding staging host {{ host }}' as msg;
insert into users (name, usertype, status) values ('{{ host }}', 1, 0); insert into users (name, usertype, status) values ('{{ host }}', 1, 0);
insert into host (user_id, name, arches) values ( insert into host (user_id, name, arches) values (
@ -80,11 +74,9 @@ insert into host (user_id, name, arches) values (
insert into host_channels (host_id, channel_id) values ( insert into host_channels (host_id, channel_id) values (
(select id from host where name='{{host}}'), (select id from channels where name='{{channel}}')); (select id from host where name='{{host}}'), (select id from channels where name='{{channel}}'));
{% endfor %} {% endfor %}
COMMIT;
{% endfor %} {% endfor %}
{% for host in groups['arm-stg'] %} {% for host in groups['arm-stg'] %}
BEGIN;
select now() as time, 'adding staging host {{ host }}' as msg; select now() as time, 'adding staging host {{ host }}' as msg;
insert into users (name, usertype, status) values ('{{ host }}', 1, 0); insert into users (name, usertype, status) values ('{{ host }}', 1, 0);
insert into host (user_id, name, arches) values ( insert into host (user_id, name, arches) values (
@ -93,20 +85,17 @@ insert into host (user_id, name, arches) values (
insert into host_channels (host_id, channel_id) values ( insert into host_channels (host_id, channel_id) values (
(select id from host where name='{{host}}'), (select id from channels where name='{{channel}}')); (select id from host where name='{{host}}'), (select id from channels where name='{{channel}}'));
{% endfor %} {% endfor %}
COMMIT;
{% endfor %} {% endfor %}
-- Add some people to be admins, only in staging. Feel free to grow this list.. -- Add some people to be admins, only in staging. Feel free to grow this list..
{% for username in ['ralph', 'imcleod'] %} {% for username in ['ralph', 'imcleod'] %}
BEGIN;
select now() as time, 'adding staging admin {{username}}' as msg; select now() as time, 'adding staging admin {{username}}' as msg;
insert into user_perms (user_id, perm_id, active, creator_id) values ( insert into user_perms (user_id, perm_id, active, creator_id) values (
(select id from users where name='{{username}}'), (select id from users where name='{{username}}'),
(select id from permissions where name='admin'), (select id from permissions where name='admin'),
True, True,
(select id from users where name='{{username}}')); (select id from users where name='{{username}}'));
COMMIT;
{% endfor %} {% endfor %}
VACUUM ANALYZE; VACUUM ANALYZE;