-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"cml ls --all-users" displays wrong lab owners #152
Comments
cml ls --all-users
displays wrong lab owners
I think that you should use If it's not a big deal, you could make two 2 calls at least temporarily. |
Thanks @tmikuska for looking into this, I will prepare a PR to use |
That sounds reasonable. We just need to understand the roundtrip cost. If it's comparable, this seems like a decent solution. |
I submitted #153, there is an other potential solution, inside the In terms of performance, it might be slightly better but I think overall won't make a big difference, but would probably require less code modifications (e.g. I thought about that option first but discarded it because I thought |
made an alternate PR |
Fixed in 2.2.0. Thanks! |
Describe the bug
cml lab ls --all-users
returns the wrong owner username:Change introduced by PR #149 and commit 0780c34
it changed from
lab.owner
tolab.username
in the below file:virlutils/virl/cli/views/labs/lab_views.py
Lines 16 to 27 in b3bc0b8
It would appear that
lab.username
is not the owner of the lab but the currently logged in user 😅.I am checking with @tmikuska, he is checking upstream meanwhile I see a the following as potential solution:
We are currently doing this:
virlutils/virl/cli/ls/commands.py
Lines 25 to 37 in b3bc0b8
So an HTTP call to get all the lab IDs
client.get_lab_list(all_users)
then another one for each lab another call,
labs.append(client.join_existing_lab(id))
Then in the view, we make a few more calls (properties/methods... although most are cached):
virlutils/virl/cli/views/labs/lab_views.py
Lines 16 to 27 in b3bc0b8
Proposed Solution
Instead of making 2 calls to
client.get_lab_list(all_users)
andjoin_existing_lab(id)
, we could make 2 different calls:client.all_labs(show_all=True)
lab.details()
to consume in the viewThe details returns actually what we need to pass to the view and more (maybe something we want to print in the future)
Small note, the dict doesn't contain
interfaces
info ... so we also need to keep the calllab.statistics
but that should be cheap, I thinkhttps://github.com/CiscoDevNet/virl2-client/blob/5bf320f62214c39a5615d19fda9a932f67d332ce/virl2_client/models/lab.py#L389C1-L402C10
@xorrkaz let me know your thoughts and I will prepare a PR
The text was updated successfully, but these errors were encountered: