[#113] cli: add "name" option for "get container" command #224

Merged
fyrchik merged 1 commit from aarifullin/frostfs-node:feature/113-get_cnr_by_name into master 2023-04-12 18:25:38 +00:00
Member
  • Make get container command filter out the container by attribute name

Signed-off-by: Airat Arifullin a.arifullin@yadro.com

* Make get container command filter out the container by attribute name Signed-off-by: Airat Arifullin a.arifullin@yadro.com
aarifullin added the
frostfs-cli
label 2023-04-06 14:08:56 +00:00
aarifullin force-pushed feature/113-get_cnr_by_name from 9e74ca577c to d490e526e4 2023-04-06 15:21:33 +00:00 Compare
aarifullin force-pushed feature/113-get_cnr_by_name from d490e526e4 to afaaa9b727 2023-04-06 15:23:27 +00:00 Compare
aarifullin force-pushed feature/113-get_cnr_by_name from afaaa9b727 to c311532acb 2023-04-06 15:24:22 +00:00 Compare
aarifullin changed title from WIP: [#113] cli: add "name" option for "get container" command to [#113] cli: add "name" option for "get container" command 2023-04-06 15:24:50 +00:00
aarifullin requested review from storage-core-developers 2023-04-06 15:25:02 +00:00
aarifullin requested review from storage-core-committers 2023-04-06 15:25:02 +00:00
acid-ant reviewed 2023-04-06 19:45:11 +00:00
@ -0,0 +65,4 @@
}
cnr := res.Container()
if searchVarNameFlag != "" && container.Name(cnr) == searchVarNameFlag {
Member

Can we check first condition at the beginning of searchContainer() or earlier? Maybe also will be useful to search by the pat of the name?

Can we check first condition at the beginning of searchContainer() or earlier? Maybe also will be useful to search by the pat of the name?
Author
Member

We may add regexp for this case search --name *test_name*. Using the option like that is more predictable

We may add regexp for this case `search --name *test_name*`. Using the option like that is more predictable
Owner

We can, but it could become less obvious: dot will match any symbol, etc.

We can, but it could become less obvious: dot will match any symbol, etc.
Author
Member

Can we check first condition at the beginning of searchContainer() or earlier? Maybe also will be useful to search by the pat of the name?

Glancing at bucket names like 9d6c424a-7a69-4662-836... I agreed to make searching for the string as part of the container name. It's really useful

> Can we check first condition at the beginning of searchContainer() or earlier? Maybe also will be useful to search by the pat of the name? Glancing at bucket names like `9d6c424a-7a69-4662-836...` I agreed to make searching for the string as part of the container name. It's really useful
Owner

Maybe we better add this flag to already existing list command? @carpawell

Maybe we better add this flag to already existing `list` command? @carpawell
Author
Member

Maybe we better add this flag to already existing list command?

This was my first assumption but I came to the conclusion that using --name in list (and, probably, other filter option in the future) is not obvious and inutively convinient. list just lists container names or their attributes withour pretty printing and let's keep it like that

> Maybe we better add this flag to already existing `list` command? This was my first assumption but I came to the conclusion that using `--name` in `list` (and, probably, other filter option in the future) is not obvious and inutively convinient. `list` just lists container names or their attributes withour pretty printing and let's keep it like that

Maybe we better add this flag to already existing list command?

Agree.

> Maybe we better add this flag to already existing list command? Agree.
dstepanov-yadro approved these changes 2023-04-07 13:59:24 +00:00
aarifullin force-pushed feature/113-get_cnr_by_name from c311532acb to 9c384d03c7 2023-04-10 19:17:03 +00:00 Compare
aarifullin requested review from dstepanov-yadro 2023-04-10 19:18:54 +00:00
Author
Member

I moved this option to list command for comfortable usage for everyone and removed search

I moved this option to `list` command for comfortable usage for everyone and removed `search`
aarifullin force-pushed feature/113-get_cnr_by_name from 9c384d03c7 to 8c6d856958 2023-04-10 19:21:25 +00:00 Compare
aarifullin force-pushed feature/113-get_cnr_by_name from 8c6d856958 to 2ad7966284 2023-04-10 19:22:51 +00:00 Compare
fyrchik approved these changes 2023-04-11 04:37:44 +00:00
@ -58,0 +64,4 @@
continue
}
if cnrName := containerSDK.Name(res.Container()); flagListName != "" && !strings.Contains(cnrName, flagVarListName) {
Owner

I think !strings.Contains is too unexpected, let's stick with the exact name for now.

I think `!strings.Contains` is too unexpected, let's stick with the exact name for now.
Author
Member

OK

OK
aarifullin force-pushed feature/113-get_cnr_by_name from 2ad7966284 to e274b7a612 2023-04-11 07:13:51 +00:00 Compare
aarifullin requested review from fyrchik 2023-04-11 07:14:34 +00:00
fyrchik approved these changes 2023-04-11 08:13:00 +00:00
fyrchik approved these changes 2023-04-11 08:13:55 +00:00
acid-ant reviewed 2023-04-11 08:47:37 +00:00
@ -58,0 +58,4 @@
containerList := res.IDList()
for _, cnr := range containerList {
prmGet.SetContainer(cnr)
res, err := internalclient.GetContainer(prmGet)
Member

It is not necessary to get container if flagListName is empty. Also it is possible to use result from here when flagVarListPrintAttr set to true.

It is not necessary to get container if `flagListName` is empty. Also it is possible to use result from here when `flagVarListPrintAttr` set to true.
Author
Member

It is not necessary to get container

I fixed this but anyway getting the container doesn't seem to burden the iteration :)

> It is not necessary to get container I fixed this but anyway getting the container doesn't seem to burden the iteration :)
acid-ant marked this conversation as resolved
dstepanov-yadro reviewed 2023-04-11 10:13:32 +00:00
@ -58,0 +64,4 @@
continue
}
if cnrName := containerSDK.Name(res.Container()); flagListName != "" && cnrName != flagVarListName {

This line doesn't match description: List containers only by the whole attribute name or only by the name part. Or did I miss something?

This line doesn't match description: `List containers only by the whole attribute name or only by the name part`. Or did I miss something?
Author
Member

Thanks! Forgot to fix after changes. Fixed

Thanks! Forgot to fix after changes. Fixed
aarifullin force-pushed feature/113-get_cnr_by_name from e274b7a612 to dde9f9d2e4 2023-04-11 11:05:09 +00:00 Compare
dstepanov-yadro approved these changes 2023-04-11 11:50:10 +00:00
acid-ant approved these changes 2023-04-11 12:39:56 +00:00
aarifullin requested review from fyrchik 2023-04-12 10:19:46 +00:00
fyrchik merged commit 01c0c90a86 into master 2023-04-12 18:25:38 +00:00
Sign in to join this conversation.
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#224
No description provided.