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

Racks Python API and _get in base.Manager #1

Merged
merged 3 commits into from
Jul 11, 2013

Conversation

jistr
Copy link
Contributor

@jistr jistr commented Jul 11, 2013

This adds _get function to base.Manager and basic read actions for Racks.

If you want to do manual testing, you'll have to fire up Python REPL:

from tuskarclient.common import http
from tuskarclient.v1_0 import racks
api = http.HTTPClient('http://f18-tuskar:6385')
rm = racks.RackManager(api)

# and now you can play
rm.list()
rm.get(1) # provided that rack with id 1 exists

This is useful so that we don't have to use _list in each Manager
subclass for getting a single resource and then fetching first item of
the array and checking for index error. This method wraps it for us.
Currently just inherits from Resource and doesn't contain anything
testable really.
@ghost ghost assigned petrblaho Jul 11, 2013
@mfojtik
Copy link
Contributor

mfojtik commented Jul 11, 2013

Couple comments here:

  • Is there any reason for having 'v1_0' instead of 'v1'? Will the tuskar client follow the API versioning from Tuskar or it will has its own versioning?
  • The URL concerns me a bit, I think the right approach should be to use the 'http://f18-tuskar:6385/v1' (with the 'v1'), which is more clear to me ;-)

@jistr
Copy link
Contributor Author

jistr commented Jul 11, 2013

Is there any reason for having 'v1_0' instead of 'v1'? Will the tuskar client follow the API versioning from Tuskar or it will has its own versioning?

This is a bug and we know about it. I started the codebase before looking at how Tuskar does versions. 😊 This should get fixed soon.

The URL concerns me a bit, I think the right approach should be to use the 'http://f18-tuskar:6385/v1' (with the 'v1'), which is more clear to me ;-)

Right. Currently the the full paths are specified in v1_0.RackManager. It's how other clients do it, but you're right it might be better to use prefix in the Client (which will be there instead of HTTPClient in a little while). We should investigate whether we can use HTTPClient and base.Manager to provide also the base URL for all Managers, besides hostname and port.

I'll create issues for both and we'll look into this separately, since Petr already started working on Resource Collections in a similar fashion and I don't want to change the foundations under his hands.

Thanks for bringing these up :)

@mfojtik
Copy link
Contributor

mfojtik commented Jul 11, 2013

👍 thanks for explaining me that :)

@petrblaho
Copy link
Contributor

👍 and merging...

@mfojtik raised a few issues. Link to newly created issues are here:

Is there any reason for having 'v1_0' instead of 'v1'? Will the tuskar client follow the API versioning from Tuskar or it will has its own versioning?

Version naming issue #2

The URL concerns me a bit, I think the right approach should be to use the 'http://f18-tuskar:6385/v1' (with the 'v1'), which is more clear to me ;-)

Location of path prefix definition #3

petrblaho added a commit that referenced this pull request Jul 11, 2013
Racks Python API and _get in base.Manager
@petrblaho petrblaho merged commit 280016f into tuskar:master Jul 11, 2013
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