Skip to content
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

fix(152): cml ls --all-users display wrong owner #154

Merged

Conversation

sgherdao
Copy link
Contributor

@sgherdao sgherdao commented Jun 27, 2024

alternative fix to #152 (other PR #153):

  • inside ls command, make 1 API call to get users and create a mapping owner_id (uuid)-> username
  • updated list_lab_table and print_table signatures to take the ownerids_usernames mapping
  • add new mock for GET /users in MockCMLServer

 alternative fix to pr 153:

- inside `ls` command, make 1 API call to get users and create a mapping
  owner_id (uuid)-> username
- updated `list_lab_table` and `print_table` signatures to take the
  `ownerids_usernames` mapping
- add new mock for `GET /users` in `MockCMLServer`
@coveralls
Copy link

coveralls commented Jun 27, 2024

Pull Request Test Coverage Report for Build 9703376108

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 75.863%

Files with Coverage Reduction New Missed Lines %
virl/api/cml.py 1 90.7%
Totals Coverage Status
Change from base Build 9625913576: 0.03%
Covered Lines: 1955
Relevant Lines: 2577

💛 - Coveralls

Copy link
Collaborator

@xorrkaz xorrkaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the simplicity of this approach, but the plugin API needs to change.

@@ -47,4 +49,4 @@ def ls(all, all_users):
pl = ViewerPlugin(viewer="lab")
pl.visualize(labs=labs, cached_labs=cached_labs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the API needs to change here as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also mean a doc change.

@sgherdao
Copy link
Contributor Author

Another way, to avoid the function signature change, we could set an attribute to the lab object:

    setattr(lab, "owner_username", ownerids_usernames[lab.owner])

or equivalent
lab.owner_username

but I am not sure how you feel about that

@xorrkaz
Copy link
Collaborator

xorrkaz commented Jun 30, 2024

No, I don't like this as it changes the underlying CML API. That's more surprising for plugin developers. I like your map approach.

@coveralls
Copy link

coveralls commented Jul 1, 2024

Pull Request Test Coverage Report for Build 9736239689

Details

  • 10 of 10 (100.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 75.863%

Files with Coverage Reduction New Missed Lines %
virl/api/cml.py 1 90.7%
Totals Coverage Status
Change from base Build 9625913576: 0.03%
Covered Lines: 1955
Relevant Lines: 2577

💛 - Coveralls

@sgherdao
Copy link
Contributor Author

sgherdao commented Jul 1, 2024

Indeed, a bit hackish. I have found some bugs with the users and groups, plus plugin doc is missing. I have the changes staged. Happy to submit another Issue and/or PR or commit here.

@sgherdao sgherdao requested a review from xorrkaz July 1, 2024 00:48
@xorrkaz xorrkaz merged commit 441bb05 into CiscoDevNet:joe-dev Jul 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants