Skip to content

doctl databases pool create (fails when --user arg not provided) #1758

@deplorable

Description

@deplorable

Describe the Issue:

  1. According to the DO Dashboard, connection pools can have the user field (also known as User privileges override (Optional)) set to an empty string (which appears as N/A in the table shown on the Connection Pools tab for a Postgres database). The empty string corresponds to "Use inbound user" in the DO Dashboard.

  2. The DO API Reference to "Add a New Connection Pool" shows:

  • name, mode, size and db are required, but
  • user is not required.
  1. When using doctl databases pool create <database-cluster-id> <pool-name> --size 25 --db <a-database-name-that-exists-inside-database-cluster-id-provided> --mode transaction, I see an error message appear:
Error: (pool.create.user) command is missing required arguments

See "Additional Details" below for a possible fix.

Environment:

Additional Details:

Since the --user arg is not marked as a requiredOpt() in

doctl/commands/databases.go

Lines 1239 to 1240 in c74c583

AddStringFlag(cmdDatabasePoolCreate, doctl.ArgDatabasePoolUserName, "", "",
"The username for the database user")

I believe the problem lies with

doctl/commands/databases.go

Lines 1344 to 1348 in c74c583

user, err := c.Doit.GetString(c.NS, doctl.ArgDatabasePoolUserName)
if err != nil {
return nil, err
}
req.User = user

which probably needs to be modified so it doesn't throw an error if no --user arg is provided.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions