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 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.