pulp / pulp-cli

https://docs.pulpproject.org/pulp_cli/
GNU General Public License v2.0
36 stars 42 forks source link

Interactive config CLI not accepting empty value for option input #1008

Closed dot-mike closed 4 months ago

dot-mike commented 4 months ago

Summary

If the user wants to configure the pulp config interactively, the header options does not accept an empty value. This results in an endless loop in the interactive CLI until the user passes any value such as :

pulp config create  -i
Config file location [/home/mike/.config/pulp/cli.toml]:
API base url [https://localhost]: http://localhost:8080
Absolute API base path on server (not including 'api/v3/') [/pulp/]:
Domain to work in if feature is enabled [default]:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.:
Custom header to add to each api call. Name and value are colon separated. Can be specified multiple times.: :

[....]
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times:
Select pluins supposed to be loaded. Can be specified multiple times: :
Error: Profile cli:
'headers' must be a list of strings with a colon separator
'plugins' must be a list of strings

Steps to reproduce

pipx install pulp-cli[pygments]
pulp config create  -i
[....]

Expected behavior

If I pass a empty value during interactive CLI it should proceed to the next option and NOT crash.

The justified reason for this is because the CLI tool behaves correctly when the options for header & plugins are not passed as part of CLI command:

$ pulp config create --username admin --base-url http://localhost:8080 --password 'my-super-secret-password'
$ Created config file at '/home/mike/.config/pulp/cli.toml'

Stacktrace/Error log

Pulp and pulp-cli version info

Pulp3 Command Line Interface, Version 0.26.0
Plugin Versions:
  common: 0.26.0

Additonal context