You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add tests to serve as a minimum specification for REST netapi modules #13698
Featurenew functionality including changes to functionality and code refactors, etc.Salt-APIneeds-testcasePR needs test cases written, or the issue is about a bug/feature that needs test cases
1: Versioned API in the URL. We already have the problem today that we have to be very careful adding/removing/changing the apis since there is no semantic version-ing.
2: I'd actually like to see a more restful interface. I was talking with some people in the office and our idea was something like //jobs/. Meaning that if you wanted to post a new job to the local client you would POST /local/jobs and you'd get the return data. If it was an async request that endpoint would return a 303 to /local/jobs/JID and of course you could just get jid info from that url. A GET of /local/jobs would get you a jid list (or something similar).
Regardless of the API though, I am all for a single API spec-- with tests for it.
Those are both things I would like to see experimentation with in individual modules and kept out of the spec. Both are great ideas! -- for example, the rest_cherrypy module has something similar to your proposed /local/jobs/<jid> URL (in the /minions and /jobs URLs).
The spec should only cover the raw functionality -- how to format lowstate data in order to execute methods on Salt's Python API client interfaces, and to watch the event bus. That way netapi modules are free to build more friendly (and versioned) interfaces on top of that. And also that puts the onus to keep Salt's Python API up to snuff.
I guess what i'm trying to say is that our "bare minimum" api isn't very clean or restful. So I'd like to make the base API more restful. IMO it doesn't matter too much what it is as long as we are backwards compatible and it exposes all of the funcitonality that we need. I'd actually prefer for the spec to be what we expect people to use, and we'd use those other individual modules to try out other things-- then bring them into the main spec. As part of that we'll probably want to version the base API since it may need to change in the future as we add new functionality etc.
I agree that the baseline is not RESTful. It's more RPC-like. However it does expose all possible functionality. Think of it more like asm.js that you would use to build a RESTful API on top of.
As for versioning, this baseline interface is, very directly, Salt's Python API accessed via lowstate dictionaries. It cannot change for the lifetime of Salt without breaking backward compat -- it can only be additve (1, 2, 3, 4, 5). We can add (new client interfaces and new methods on existing client interfaces). Meaning only the RESTful API built on top of the baseline needs to be versioned since that is the only part that can change.
Makes sense. So the plan would be for starters (version 0) is the RPC
interface on root. Then we can add v1 which would be restful, which could
potentially in the future deprecate the / api. Am I following?
On Jun 25, 2014 7:39 AM, "Seth House" [email protected] wrote:
Not quite. The spec is the RPC-like interface on root. This interface isn't going to change for as long as Salt's own Python API doesn't change (it will continue to be added to though). The rest_tornado, rest_cherrypy, etc modules create RESTful interfaces on top and version the interfaces they provide individually. This is already the case with /minions, and /jobs, and /login / /logout, etc.
I've never been a fan of competing-yet-identical REST interfaces. Dev time would be better spent on a single module.
CherryPy was chosen for the first netapi module in part because it has a single dep for both lib and web server. Now that Tornado is a hard-dep for Salt (#22453) I would like to revisit thoughts of retiring those other modules and defaulting to Saltnado for a single Salt REST API. We'll need to check backward-compat carefully as part of that work. I don't have a time-frame in mind for this work yet.
We had talked about deprecating rest_cherrypy in favor of the tornado implementation. and I agree, with tornado now has a hard dep, 2015.7 (or w/e the next feature release) is probably a good time to "deprecate" rest_cherrypy.
Featurenew functionality including changes to functionality and code refactors, etc.Salt-APIneeds-testcasePR needs test cases written, or the issue is about a bug/feature that needs test cases
Activity
jacksontj commentedon Jun 24, 2014
2 Things that I'd really like to see in this:
1: Versioned API in the URL. We already have the problem today that we have to be very careful adding/removing/changing the apis since there is no semantic version-ing.
2: I'd actually like to see a more restful interface. I was talking with some people in the office and our idea was something like //jobs/. Meaning that if you wanted to post a new job to the local client you would POST /local/jobs and you'd get the return data. If it was an async request that endpoint would return a 303 to /local/jobs/JID and of course you could just get jid info from that url. A GET of /local/jobs would get you a jid list (or something similar).
Regardless of the API though, I am all for a single API spec-- with tests for it.
whiteinge commentedon Jun 24, 2014
Those are both things I would like to see experimentation with in individual modules and kept out of the spec. Both are great ideas! -- for example, the
rest_cherrypymodule has something similar to your proposed/local/jobs/<jid>URL (in the/minionsand/jobsURLs).The spec should only cover the raw functionality -- how to format lowstate data in order to execute methods on Salt's Python API client interfaces, and to watch the event bus. That way netapi modules are free to build more friendly (and versioned) interfaces on top of that. And also that puts the onus to keep Salt's Python API up to snuff.
jacksontj commentedon Jun 25, 2014
I guess what i'm trying to say is that our "bare minimum" api isn't very clean or restful. So I'd like to make the base API more restful. IMO it doesn't matter too much what it is as long as we are backwards compatible and it exposes all of the funcitonality that we need. I'd actually prefer for the spec to be what we expect people to use, and we'd use those other individual modules to try out other things-- then bring them into the main spec. As part of that we'll probably want to version the base API since it may need to change in the future as we add new functionality etc.
whiteinge commentedon Jun 25, 2014
I agree that the baseline is not RESTful. It's more RPC-like. However it does expose all possible functionality. Think of it more like asm.js that you would use to build a RESTful API on top of.
As for versioning, this baseline interface is, very directly, Salt's Python API accessed via lowstate dictionaries. It cannot change for the lifetime of Salt without breaking backward compat -- it can only be additve (1, 2, 3, 4, 5). We can add (new client interfaces and new methods on existing client interfaces). Meaning only the RESTful API built on top of the baseline needs to be versioned since that is the only part that can change.
Savvy?
jacksontj commentedon Jun 25, 2014
Makes sense. So the plan would be for starters (version 0) is the RPC
interface on root. Then we can add v1 which would be restful, which could
potentially in the future deprecate the / api. Am I following?
On Jun 25, 2014 7:39 AM, "Seth House" [email protected] wrote:
whiteinge commentedon Jun 27, 2014
Not quite. The spec is the RPC-like interface on root. This interface isn't going to change for as long as Salt's own Python API doesn't change (it will continue to be added to though). The rest_tornado, rest_cherrypy, etc modules create RESTful interfaces on top and version the interfaces they provide individually. This is already the case with
/minions, and/jobs, and/login//logout, etc.Lothiraldan commentedon Apr 17, 2015
I think at least the '/login' should be standardized, you can't create a token with basic RPC
whiteinge commentedon Apr 17, 2015
I've never been a fan of competing-yet-identical REST interfaces. Dev time would be better spent on a single module.
CherryPy was chosen for the first netapi module in part because it has a single dep for both lib and web server. Now that Tornado is a hard-dep for Salt (#22453) I would like to revisit thoughts of retiring those other modules and defaulting to Saltnado for a single Salt REST API. We'll need to check backward-compat carefully as part of that work. I don't have a time-frame in mind for this work yet.
jacksontj commentedon Apr 20, 2015
We had talked about deprecating rest_cherrypy in favor of the tornado implementation. and I agree, with tornado now has a hard dep, 2015.7 (or w/e the next feature release) is probably a good time to "deprecate" rest_cherrypy.
whiteinge commentedon Aug 20, 2015
Closing this in deference to #25460.
whiteinge commentedon Aug 20, 2015
Er. And #26505.