Skip to content

fix(flags): describe the accepted values of --addon and --database - #1265

Merged
EtienneM merged 4 commits into
Scalingo:masterfrom
josephpage:fix/addon-flag-help
Oct 9, 2026
Merged

EtienneM merged 4 commits into
Scalingo:masterfrom
josephpage:fix/addon-flag-help

Conversation

@josephpage

Copy link
Copy Markdown
Contributor

Context

The help of the --addon flag only documents an ID, but the flag accepts an addon type as well. Verified with the installed CLI (1.49.0):

$ scalingo backups-create -h
OPTIONS:
   --app string, -a string  Name of the current app (default: "<name>")
   --addon string           ID of the current addon (default: "<addon_id>")
   ...
   Example
     $ scalingo --app my-app --addon addon_uuid backups-create

But in practice:

$ scalingo --app my-app --addon postgresql backups
! Unable to get the addon UUID based on its type: list the addons to get the type UUID: ...

$ scalingo --app my-app --addon ad-00000000-0000-0000-0000-000000000000 backups
! The application was not found on the region osc-fr1.

With a value starting with ad-, addonUUIDFromFlags uses it as-is, otherwise utils.GetAddonUUIDFromType resolves it from the addon provider name (postgresql, redis, ... and a few aliases), and fails with no 'X' addon exists when nothing matches. So a type is accepted (a custom addon name is not), which the help does not say.

While I was in the same file: --database (preview feature) has the same kind of mismatch, its help says "ID of the current database" while the code handles a name (ExtractDatabaseNameFromCommandLineOrEnv, AddonsList(dbName), and the errors of currentDatabaseNameAndUUID mention "the given name"). Happy to drop this one if you prefer to keep the PR focused.

Changes

  • fix(flags): describe the accepted values of --addon and --database
  • fix(pitr): use a valid --addon value in the examples — --addon my-addon cannot work, the flag does not accept the name of an addon.
  • Add a changelog entry in the section "To Be Released" of CHANGELOG.md

Notes

  • only string literals are changed (no API change): gofmt -l reports nothing on the modified files.
  • the --addon examples of the repository use several placeholders (addon_uuid, addon-uuid, ad-9be0fc04-...): I left them untouched, but I can normalize them in a follow-up if you want.

The help of the `--addon` flag only mentions an ID, while the flag also accepts
an addon type: `utils.GetAddonUUIDFromType` returns the value as-is when it
starts with `ad-`, and otherwise resolves it from the addon provider name
(`postgresql`, `redis`, ...), with a few aliases. Passing a type for an app that
has no such addon gives:
`Unable to get the addon UUID based on its type: ... no 'X' addon exists`.

The help of the `--database` flag (preview feature) mentions an ID as well,
while the code handles a database name: `ExtractDatabaseNameFromCommandLineOrEnv`
returns the value of the flag, this value is passed to `AddonsList`, and the
errors of `currentDatabaseNameAndUUID` mention "the given name".
`--addon my-addon` cannot work: the flag accepts an addon ID or an addon type,
not the name of the addon. Use `postgresql`, PITR being a PostgreSQL feature.
@EtienneM
EtienneM self-requested a review October 9, 2026 09:20
@EtienneM EtienneM changed the title fix(flags): describe the accepted values of --addon and --database fix(flags): describe the accepted values of --addon and --database Oct 9, 2026

@EtienneM EtienneM left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this contribution

@EtienneM
EtienneM merged commit 32d1d6f into Scalingo:master Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants