Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credentials hierarchy - Additional fixes #8076

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated query to the new credentials structure
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Refactor Credentials to a proper class hierarchy
- Refactor susecredentials to support the new hierarchy
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'rhui', 'Red Hat Update Infrastructure'
where not exists(select 1 from suseCredentialsType where label = 'rhui');

DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'susecredentialstype') THEN
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'rhui', 'Red Hat Update Infrastructure'
where not exists(select 1 from suseCredentialsType where label = 'rhui');
ELSE
RAISE NOTICE 'suseCredentialsType does not exists';
END IF;
END;
$$;
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,17 @@ CREATE SEQUENCE IF NOT EXISTS susecloudrmthost_id_seq;
---------------------------
-- Add new credentials type
---------------------------
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'cloudrmt', 'Cloud RMT network'
where not exists(select 1 from suseCredentialsType where label = 'cloudrmt');
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'susecredentialstype') THEN
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'cloudrmt', 'Cloud RMT network'
where not exists(select 1 from suseCredentialsType where label = 'cloudrmt');
ELSE
RAISE NOTICE 'suseCredentialsType does not exists';
END IF;
END;
$$;

--------------------------------
-- Update suse credentials Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@
-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
--

insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'reportcreds', 'Reporting DB Credentials'
where not exists(select 1 from suseCredentialsType where label = 'reportcreds');
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'susecredentialstype') THEN
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'reportcreds', 'Reporting DB Credentials'
where not exists(select 1 from suseCredentialsType where label = 'reportcreds');
ELSE
RAISE NOTICE 'suseCredentialsType does not exists';
END IF;
END;
$$;


CREATE TABLE IF NOT EXISTS suseMgrServerInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'rhui', 'Red Hat Update Infrastructure'
where not exists(select 1 from suseCredentialsType where label = 'rhui');

DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'susecredentialstype') THEN
insert into suseCredentialsType (id, label, name)
select sequence_nextval('suse_credtype_id_seq'), 'rhui', 'Red Hat Update Infrastructure'
where not exists(select 1 from suseCredentialsType where label = 'rhui');
ELSE
RAISE NOTICE 'suseCredentialsType does not exists';
END IF;
END;
$$;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated query to the new credentials structure
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated query to the new credentials structure