cli/tree: Allow to specify rpc-endpoint with config file #1446

Merged
fyrchik merged 1 commit from a-savchuk/frostfs-node:cli-tree-rpc-endpoint into master 2024-10-26 11:30:27 +00:00
Member

Close #1442

We have several ways to specify the rpc-endpoint: with a flag, with a single config file or multiple files. Before, the rpc-endpoint flag was marked as required. Because cobra checked the required flag presence first, it prevented specifying rpc-endpoint with a config file.

Before:

$ cat cli.yaml
wallet: node1-storage.json
password: N7Omhct5
rpc-endpoint: 10.78.130.238:8080
address: NWBqChzgL9VZtkRBj83Cd8H9GbcAhbBD41

$ frostfs-cli -c cli.yaml tree list --cid 9HAXqftkMZAPRpStA1pQHLqxL7gj9mdihY5K9hv4Fvr
Error: required flag(s) "rpc-endpoint" not set

After:

  • read rpc-endpoint from a config file
$ cat cli.yaml
wallet: node1-storage.json
password: N7Omhct5
rpc-endpoint: 10.78.130.238:8080
address: NWBqChzgL9VZtkRBj83Cd8H9GbcAhbBD41

$ frostfs-cli -c cli.yaml tree list --cid 9HAXqftkMZAPRpStA1pQHLqxL7gj9mdihY5K9hv4Fvr
failed to call treeList rpc error: code = Unknown desc = can't get container: status: code = 3072 message = container not found
  • if rpc-endpoint isn't defined, says that
$ cat cli.yaml
wallet: node1-storage.json
password: N7Omhct5
address: NWBqChzgL9VZtkRBj83Cd8H9GbcAhbBD41

$ frostfs-cli -c cli.yaml tree list --cid 9HAXqftkMZAPRpStA1pQHLqxL7gj9mdihY5K9hv4Fvr
failed to create client: rpc-endpoint is not defined
Close #1442 We have several ways to specify the `rpc-endpoint`: with a flag, with a single config file or multiple files. Before, the `rpc-endpoint` flag was marked as required. Because `cobra` checked the required flag presence first, it prevented specifying `rpc-endpoint` with a config file. Before: ``` $ cat cli.yaml wallet: node1-storage.json password: N7Omhct5 rpc-endpoint: 10.78.130.238:8080 address: NWBqChzgL9VZtkRBj83Cd8H9GbcAhbBD41 $ frostfs-cli -c cli.yaml tree list --cid 9HAXqftkMZAPRpStA1pQHLqxL7gj9mdihY5K9hv4Fvr Error: required flag(s) "rpc-endpoint" not set ``` After: - read `rpc-endpoint` from a config file ``` $ cat cli.yaml wallet: node1-storage.json password: N7Omhct5 rpc-endpoint: 10.78.130.238:8080 address: NWBqChzgL9VZtkRBj83Cd8H9GbcAhbBD41 $ frostfs-cli -c cli.yaml tree list --cid 9HAXqftkMZAPRpStA1pQHLqxL7gj9mdihY5K9hv4Fvr failed to call treeList rpc error: code = Unknown desc = can't get container: status: code = 3072 message = container not found ``` - if `rpc-endpoint` isn't defined, says that ``` $ cat cli.yaml wallet: node1-storage.json password: N7Omhct5 address: NWBqChzgL9VZtkRBj83Cd8H9GbcAhbBD41 $ frostfs-cli -c cli.yaml tree list --cid 9HAXqftkMZAPRpStA1pQHLqxL7gj9mdihY5K9hv4Fvr failed to create client: rpc-endpoint is not defined ```
a-savchuk added 2 commits 2024-10-23 12:30:44 +00:00
We have several ways to specify the `rpc-endpoint`: with a flag,
with a single config file or multiple files. Before, the `rpc-endpoint`
flag was marked as required. Because `cobra` checked the required flag
presence first, it prevented specifying `rpc-endpoint` with a config file.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
[#1442] cli/tree: Enchance error message if rpc-endpoint isn't defined
All checks were successful
DCO action / DCO (pull_request) Successful in 1m9s
Tests and linters / Run gofumpt (pull_request) Successful in 1m23s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m9s
Vulncheck / Vulncheck (pull_request) Successful in 2m10s
Build / Build Components (pull_request) Successful in 2m35s
Tests and linters / gopls check (pull_request) Successful in 2m51s
Tests and linters / Staticcheck (pull_request) Successful in 2m56s
Tests and linters / Lint (pull_request) Successful in 3m29s
Tests and linters / Tests (pull_request) Successful in 4m20s
Tests and linters / Tests with -race (pull_request) Successful in 6m6s
839360df52
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
a-savchuk changed title from cli/tree: Allow to specify rpc-endpoint with config file to WIP: cli/tree: Allow to specify rpc-endpoint with config file 2024-10-23 12:35:18 +00:00
a-savchuk force-pushed cli-tree-rpc-endpoint from 839360df52 to 0068c6fb1d 2024-10-23 12:38:21 +00:00 Compare
a-savchuk changed title from WIP: cli/tree: Allow to specify rpc-endpoint with config file to cli/tree: Allow to specify rpc-endpoint with config file 2024-10-23 12:45:44 +00:00
a-savchuk requested review from storage-core-developers 2024-10-23 12:45:54 +00:00
a-savchuk requested review from storage-core-committers 2024-10-23 12:45:55 +00:00
acid-ant approved these changes 2024-10-23 12:54:38 +00:00
Dismissed
a-savchuk force-pushed cli-tree-rpc-endpoint from 0068c6fb1d to 29708b78d7 2024-10-23 13:05:21 +00:00 Compare
a-savchuk dismissed acid-ant's review 2024-10-23 13:05:21 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

acid-ant approved these changes 2024-10-23 13:12:59 +00:00
dstepanov-yadro approved these changes 2024-10-23 19:27:19 +00:00
fyrchik approved these changes 2024-10-24 06:18:16 +00:00
fyrchik merged commit 29708b78d7 into master 2024-10-24 06:18:27 +00:00
a-savchuk deleted branch cli-tree-rpc-endpoint 2024-10-24 06:59:51 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1446
No description provided.