Skip to content

Commit 1fecdd9

Browse files
committed
create_admin: fix for POO #179359 changes
Since ff06373 I don't think create_admin can ever work. It does not specify `from_script` when getting an OpenQA::Schema instance, so Schema's `connect_db` will try and do `OpenQA::App->singleton->home`, and that's never going to work because we don't really have an app singleton (nothing is ever going to have called `set_singleton` on this path, I don't think). As a script, create_admin should clearly be using the from_script path, so let's change the way it gets a Schema instance to match all the other scripts and fix the problem. Signed-off-by: Adam Williamson <[email protected]>
1 parent acdc860 commit 1fecdd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

script/create_admin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ unless ($key) {
6363
print "Secret: $secret\n";
6464
}
6565

66-
my $schema = OpenQA::Schema->singleton;
66+
my $schema = OpenQA::Schema::connect_db(deploy => 0, silent => 1, from_script => 1);
6767
my $users = $schema->resultset('Users')->find({is_admin => 1});
6868
if ($users != 0) {
6969
warn "An admin user already exists! Use client or web UI to create further users.\n";

0 commit comments

Comments
 (0)