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

Deprecated pgagroal-cli commands config-get and config-set do not work as expected #410

Closed
decarv opened this issue Mar 8, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@decarv
Copy link
Contributor

decarv commented Mar 8, 2024

Describe the bug

Deprecated pgagroal-cli commands should still execute the corresponding new commands, but this is not true for config-get and config-set.

To Reproduce

Run in the terminal the commands and get the error message unknown command config-get.

$ ./pgagroal-cli -v config-get port
pgagroal-cli: command <config-get> has been deprecated by <conf get> since version 1.6
2024-03-07 22:38:59 TRACE cli.c:459 Command: <conf get> [(null)]
pgagroal-cli: unknown command config-get
$ ./pgagroal-cli -v config-set port 2346
pgagroal-cli: command <config-set> has been deprecated by <conf set> since version 1.6
2024-03-07 22:41:56 TRACE cli.c:466 Command: <conf set> [(null)] = [(null)]
pgagroal-cli: unknown command config-set

Version

pgagroal-cli 1.7.0

Diagnosis

Neither config_key or config_value are ever passed to parse_deprecated_command, thus being impossible to parse these values. This function needs to be modified.

@decarv decarv added the bug Something isn't working label Mar 8, 2024
@jesperpedersen
Copy link
Collaborator

@decarv Can you work on this ?

@decarv
Copy link
Contributor Author

decarv commented Mar 8, 2024

Sure! I plan to open a PR soon that should close #403 and this issue. But this issue should be a quick fix and thus quicker to review. I will work on it.

@jesperpedersen
Copy link
Collaborator

See if it worth to split the patch into the separate issue.

Otherwise, just reference both issues in the commit message

decarv added a commit to decarv/pgagroal that referenced this issue Mar 9, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the parse_command function. The parsing step now involves two tables (command_table) defined in each cli.c and admin.c files, which guide the parsing of commands.

Now adding a command with the structure "<command> [subcommand] [arg] [arg] ..." requires the addition of the command enum and its struct in the command_table.
decarv added a commit to decarv/pgagroal that referenced this issue Mar 9, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the parse_command function. The parsing step now involves two tables (command_table) defined in each cli.c and admin.c files, which guide the parsing of commands.

Now adding a command with the structure "<command> [subcommand] [arg] [arg] ..." requires the addition of the command enum and its struct in the command_table.
@decarv
Copy link
Contributor Author

decarv commented Mar 9, 2024

@jesperpedersen Splitting the patch was impractical.

I just referenced both issues.

@jesperpedersen
Copy link
Collaborator

That is quite ok

decarv added a commit to decarv/pgagroal that referenced this issue Mar 13, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the parse_command function. The parsing step now involves two tables (command_table) defined in each cli.c and admin.c files, which guide the parsing of commands.

Now adding a command with the structure "<command> [subcommand] [arg] [arg] ..." requires the addition of the command enum and its struct in the command_table.
decarv added a commit to decarv/pgagroal that referenced this issue Mar 13, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the parse_command function. The parsing step now involves two tables (command_table) defined in each cli.c and admin.c files, which guide the parsing of commands.

Now adding a command with the structure "<command> [subcommand] [arg] [arg] ..." requires the addition of the command enum and its struct in the command_table.
decarv added a commit to decarv/pgagroal that referenced this issue Mar 13, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the parse_command function. The parsing step now involves two tables (command_table) defined in each cli.c and admin.c files, which guide the parsing of commands.

Now adding a command with the structure "<command> [subcommand] [arg] [arg] ..." requires the addition of the command enum and its struct in the command_table.
decarv added a commit to decarv/pgagroal that referenced this issue Mar 14, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the `parse_command` function.

`parse_command` now involves the interpretation of a `command_table` of `struct pgagroal_command`, defined in each cli.c and admin.c files.

The `struct pgagroal_command` holds, beyond other things, the command, the subcommand and the accepted count of arguments.

With this information, `parse_command` is now able to display error messages when (a) the typed command is invalid, (b) the typed command requires a subcommand, (c) the typed subcommand is invalid, or when, (d) for the typed command, there are too few or too many arguments.

Now adding a command with the same invoking structure as the others (i.e., "<command> [subcommand] [arg] [arg] ...") requires inserting an entry in the `command_table` by filling the `struct pgagroal_command`.
decarv added a commit to decarv/pgagroal that referenced this issue Mar 15, 2024
This commit improves the error messages for pgagroal-cli and pgagroal-admin commands by modifying the `parse_command` function.

`parse_command` now involves the interpretation of a `command_table` of `struct pgagroal_command`, defined in each cli.c and admin.c files.

The `struct pgagroal_command` holds, beyond other things, the command, the subcommand and the accepted count of arguments.

With this information, `parse_command` is now able to display error messages when (a) the typed command is invalid, (b) the typed command requires a subcommand, (c) the typed subcommand is invalid, or when, (d) for the typed command, there are too few or too many arguments.

Now adding a command with the same invoking structure as the others (i.e., "<command> [subcommand] [arg] [arg] ...") requires inserting an entry in the `command_table` by filling the `struct pgagroal_command`.
@fluca1978
Copy link
Collaborator

Close via 11a1f47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants