Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

test-db database create fails (with warnings too) with no arguments #42

Open
nnutter opened this issue Nov 20, 2014 · 7 comments
Open
Assignees

Comments

@nnutter
Copy link
Contributor

nnutter commented Nov 20, 2014

test-db database create fails (with warnings too) with no arguments:

$ export TESTDBSERVER_URL="https://vmpool46.gsc.wustl.edu"
$ test-db database create
Use of uninitialized value $query_list[1] in join or string at /usr/lib/perl5/TestDbServer/CmdLine.pm line 62.
There is no template with that name
@nnutter
Copy link
Contributor Author

nnutter commented Nov 21, 2014

Not yet working on #45:

$ PERL_LWP_SSL_VERIFY_HOSTNAME=0 carton exec -- ./dev test-db database create --timeout 600
Got error response 400: Bad Request at /gscuser/nnutter/TestDbServer/bin/test-db-database-create line 15.

@nnutter
Copy link
Contributor Author

nnutter commented Nov 21, 2014

This is failing because test_db can't create a database with postgres as the owner. More specifically, we can't GRANT postgres TO test_db.

[Fri Nov 21 15:07:21 2014] [fatal] _create_database_from_template: DBD::Pg::db do failed: ERROR:  must be superuser to alter superusers at lib/TestDbServer/PostgresInstance.pm line 116.

@brummett
Copy link
Contributor

Behavior should be that if created a DB based on template1, then the default owner should be test_db

@brummett brummett self-assigned this Nov 24, 2014
@brummett brummett closed this as completed Dec 1, 2014
@brummett
Copy link
Contributor

brummett commented Dec 4, 2014

This isn't fixed after all:

> TESTDBSERVER_URL=https://apipe-test-db.gsc.wustl.edu test-db database create
Got error response 400: Bad Request at /usr/bin/test-db-database-create line 15

In the log:

_create_database_from_template: Attribute (template_name) does not pass the type constraint because: Validation failed for 'Str' with value undef at constructor TestDbServer::Command::CreateDatabaseFromTemplate::new (defined at lib/TestDbServer/Command/CreateDatabaseFromTemplate.pm line 63) line 84
        TestDbServer::Command::CreateDatabaseFromTemplate::new('TestDbServer::Command::CreateDatabaseFromTemplate', 'owner', 'test_db', 'template_name', undef, 'host', 'localhost', 'port', 5432, 'superuser', 'test_db', 'schema', 'TestDbServer::Schema=HASH(0x53c4428)') called at lib/TestDbServer/DatabaseRoutes.pm line 154

Also, without owner:

> TESTDBSERVER_URL=https://apipe-test-db.gsc.wustl.edu test-db database create --based-on template1
Got error response 400: Bad Request at /usr/bin/test-db-database-create line 15

Log:

[info] create database from template template1
[fatal] _create_database_from_template: DBD::Pg::db do failed: ERROR:  must be superuser to alter superusers at lib/TestDbServer/PostgresInstance.pm line 116.

@brummett brummett reopened this Dec 4, 2014
@brummett
Copy link
Contributor

brummett commented Dec 4, 2014

Probably because the puppet stuff hasn't been updated to write out config entries for 'default_template_name' and 'external_hostname'

@nnutter
Copy link
Contributor Author

nnutter commented Dec 11, 2014

Production server got deployed and one of these is fixed:

$ TESTDBSERVER_URL=https://apipe-test-db.gsc.wustl.edu test-db database create
CREATED 190CAF9C818111E490D2AD3395573682 at localhost:5432

$ TESTDBSERVER_URL=https://apipe-test-db.gsc.wustl.edu test-db database create --based-on template1
Got error response 400: Bad Request at /usr/bin/test-db-database-create line 15

I think the latter issue is because CreateDatabaseFromTemplate is comparing the owner to the configuration's superuser which is not postgres. Hard-coding a check for postgres isn't completely correct either since that is configurable when installing PostgreSQL. The former works because both the owner and template gets filled in when no template is provided.

@nnutter
Copy link
Contributor Author

nnutter commented Dec 12, 2014

Maybe we should just always make people specify an owner?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants