Comment 5 for bug 2015881

Revision history for this message
Christian Rohmann (christian-rohmann) wrote (last edit ):

1) I am not saying make this a strict if / else, but rather start in the right order of going through the cases in https://github.com/openstack/osc-lib/blob/db9cdc95ed96045ff47c02cf822b1ba90ffa67b0/osc_lib/utils/__init__.py#L168.

This would not make it any worse (apart from more code), but potentially half the number of expensive API calls. The whole "find_resource" method works on a best-effort basis anyways, by not make this effort a little better :-)

2) The same issue / bug of doing two round trips in case a name is used applies to the OpenSDK at https://github.com/openstack/openstacksdk/blob/7235634f74c595610c912f332be03523b956933b/openstack/resource.py#L2252 right? There the string is first tried to used as ID and then as the name of the resource.

3) I am really discouraged by the "nothing can be done" thing you said about this issue. Yes, not having a common ID format across all resources is unlikely to be fixed (ever). But why not discuss the introduction of explicit and mutually exclusive "--id" "--name" parameters (and matching find_by_id and find_by_name functions in the OpenStackSDK) to then only ask for name or id and definitely only do one round of API roller coaster. The current "find" method could remain the default. But in case someone knows if an ID or name is used (e.g. when using the openstackclient via the proposed "--id" parameter).

Edit: While I re-read this ... regarding 3) it would likely only require "--name", as the "find" method already tries the ID first.