Skip to content

Conversation

@aayushchouhan09
Copy link
Member

@aayushchouhan09 aayushchouhan09 commented Jan 24, 2025

Explain the changes

  1. Problem: Leading spaces before a flag value, when using =, caused the value to be split into an empty string ('') and the actual value, resulting in faulty flag assignments.
  2. Solution: A validation has been added to check if the flag value become empty due to incorrect formatting. It checks if argv._ has more than two elements and throws an error if invalid values are detected.

This prevents incorrect assignments and ensures flag values are valid.

Issues: Fixed #xxx / Gap #xxx

  1. Fixed: NC | CLI | Weird behavior of the CLI when adding space before access_key/secret_key flag #8319

Testing Instructions:

  1. Try creating account with noobaa-cli using below command:
    $ sudo node src/cmd/manage_nsfs account add --name aayush2 --uid=9 --gid=9 --new_buckets_path= tmp/
  • Tests added

@aayushchouhan09 aayushchouhan09 requested review from a team, jackyalbo and liranmauda and removed request for a team January 24, 2025 11:01
@aayushchouhan09 aayushchouhan09 force-pushed the account-space-fix branch 2 times, most recently from 3ced00b to 0b8a0a1 Compare January 29, 2025 09:49
Copy link
Contributor

@shirady shirady left a comment

Choose a reason for hiding this comment

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

LGTM

…' which may be due to leading space in flag values

Signed-off-by: Aayush Chouhan <[email protected]>

Updated the code after Romy's PR is merged

Signed-off-by: Aayush Chouhan <[email protected]>

Updated the logic and tests

Signed-off-by: Aayush Chouhan <[email protected]>

Updated to enum, added examples and error msg

Signed-off-by: Aayush Chouhan <[email protected]>

Update the function name and unit tests

Signed-off-by: Aayush Chouhan <[email protected]>
@aayushchouhan09 aayushchouhan09 merged commit e1e56a8 into noobaa:master Feb 17, 2025
11 checks passed
@aayushchouhan09 aayushchouhan09 deleted the account-space-fix branch February 17, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NC | CLI | Weird behavior of the CLI when adding space before access_key/secret_key flag

4 participants