Skip to content

Bring Saltnado up to feature parity with rest_cherrypy #26505

Closed

Description

@whiteinge

As has been discussed now that Tornado is a dep for Salt core it makes sense to move development effort on a REST API to Saltnado. We do not yet have a timeline for this work but we cannot deprecate rest_cherrypy until Saltnado has feature parity and identical interfaces so this issue will serve as a place to track that work.

Missing features:

  • Implement support for all *client interfaces.
    • local
    • local_async
    • local_subset
    • runner
    • runner_async
    • ssh
    • wheel
    • wheel_async
  • Logout.
  • Passing the session token via cookies or the X-Auth-Header.
  • Generating minion keys.
  • Serving static files.
  • Bootstrapping a rich-client HTML app (and support for the history API -- no 404s on browser refresh).
  • CORS. Add support for CORS in saltnado. Ref #26505 #27142
  • Vet API compatibility for all endpoints. Client libraries should be able to switch between them seamlessly.
  • Login accepts urlencoded and JSON payloads, JSON payload can be with or without a containing array. Rest API Inconsistency #37803
  • Session tokens should hide Salt eauth tokens, though users should be able to bypass that on some endpoints. Salt-api token cherrypy/tornado inconsistency #38139
  • xsrf support.

Activity

  1. added
    Feature
    on Aug 20, 2015
  2. added this to the Approved milestone on Aug 20, 2015
  3. added
    P2
    Core
    on Aug 20, 2015
  4. Lothiraldan commented on Sep 1, 2015

    @Lothiraldan
    Contributor

    I'm working on a proof-of-concept of saltpad in react and hit the non-support of preflight request in either rest_cherrypy or rest_tornado, could I help?

  5. whiteinge commented on Sep 1, 2015

    @whiteinge
    ContributorAuthor

    The rest_cherrypy module has undocumented (:disappointed:) support for CORS. There's no tests in place for that so I don't know off the top of my head if it's missing anything.

    If you're interested in diving into the Saltnado code we would gladly welcome the effort! Pick whatever you're interested in and have at it (with an eye toward interface consistency with rest_cherrypy). That said, since you're a client author it's worth underscoring the mention in OP that we don't yet have a definitive timeline for a concerted effort toward this migration. I'd hate to see Saltpad stuck in a place where it needs bleeding-edge features in Saltnado as well as the yet-to-be-migrated features from rest_cherrypy.

    In any case, please feel free to ping me if I can assist with anything as you dive in.

  6. jacksontj commented on Sep 2, 2015

    @jacksontj
    Contributor

    From a quick look at these, a few features are unclear to me:

        Serving static files.
    

    ? We just need to serve a directory of static files? Seems odd for salt-api :/

        Bootstrapping a rich-client HTML app (and support for the history API -- no 404s on browser refresh).
    

    What history API is this referring to? I did a couple quick searches and was unable to find anything

        CORS.
    

    Setting headers to be callable from other domains? Or is this the whole options thing to make sure its valid?

        Vet API compatibility for all endpoints. Client libraries should be able to switch between them seamlessly.
    

    I think this had a ticket before-- where we want to make a shared "http api" test that ran against both :)

  7. Lothiraldan commented on Sep 2, 2015

    @Lothiraldan
    Contributor

    I've made some quick fix on saltnado to make it compatible with browser-js usage. I will made severals PRs in the next day for CORS support and some fixes for better support of real 'Accept' header and 'Content-Type' values.

  8. whiteinge commented on Sep 2, 2015

    @whiteinge
    ContributorAuthor

    We just need to serve a directory of static files? Seems odd for salt-api :/

    rest_cherrypy was written in-part to be able to drive a rich-client web app.

    https://github.com/saltstack/salt/blob/b676e32/salt/netapi/rest_cherrypy/app.py#L102-L106

    What history API is this referring to? I did a couple quick searches and was unable to find anything

    This one:

    http://diveintohtml5.info/history.html

    Implemented here:

    https://github.com/saltstack/salt/blob/b676e32/salt/netapi/rest_cherrypy/app.py#L300-L332

    Setting headers to be callable from other domains? Or is this the whole options thing to make sure its valid?

    The former.

    https://github.com/saltstack/salt/blob/b676e32/salt/netapi/rest_cherrypy/app.py#L453-L493

    I think this had a ticket before-- where we want to make a shared "http api" test that ran against both :)

    I closed that issue since we're no longer talking about maintaining both modules. You're right that work would definitely be of help here and we can certainly reopen it to track that work. Since the end-goal is deprecation, I don't think we need to spend much time building this out -- maybe some light integration tests or maybe we can just ask the various client authors to vet against Saltnado during the deprecation phase.

  9. jacksontj commented on Sep 3, 2015

    @jacksontj
    Contributor

    We just need to serve a directory of static files? Seems odd for salt-api :/

    rest_cherrypy was written in-part to be able to drive a rich-client web app.

    IMO that sort of functionality doesn't really make sense to keep in the API. Especially since we are adding COORS headers (so the app can be served from another domain all together) I can't really see why we'd need/want this in the API? Just seems like another moving part that no one really needs :/

    https://github.com/saltstack/salt/blob/b676e32/salt/netapi/rest_cherrypy/app.py#L102-L106

    What history API is this referring to? I did a couple quick searches and was unable to find anything
    

    This one:

    http://diveintohtml5.info/history.html

    Implemented here:

    https://github.com/saltstack/salt/blob/b676e32/salt/netapi/rest_cherrypy/app.py#L300-L332

    Similar questions-- not sure why this needs to be implemented on an API endpoint? From the looking I did on the UIs all of them require standing up some webserver-- so all they should be doing to the API is sending API calls. I say that of course realizing that hasn't always been the case-- but I think we'll want to encourage better service oriented architecture here-- and IMO that includes keeping the API just that-- an API.

    Setting headers to be callable from other domains? Or is this the whole options thing to make sure its valid?
    

    The former.

    Cool, definitely easy to add :)

    https://github.com/saltstack/salt/blob/b676e32/salt/netapi/rest_cherrypy/app.py#L453-L493

    I think this had a ticket before-- where we want to make a shared "http api" test that ran against both :)
    

    I closed that issue since we're no longer talking about maintaining both modules. You're right that work would definitely be of help here and we can certainly reopen it to track that work. Since the end-goal is deprecation, I don't think we need to spend much time building this out -- maybe some light integration tests or maybe we can just ask the various client authors to vet against Saltnado during the deprecation phase.

    Fair enough :)

  10. whiteinge commented on Sep 3, 2015

    @whiteinge
    ContributorAuthor

    A few clients have made JS apps on top of the API that I know of. Serving static files is a tiny addition. I'm not a huge fan of the server-side requirements for the HTML5 history API but it's also an easy addition -- just a header inspection and a routing bypass.

    Setting up a second web server and trying to get CORS working correctly is a bunch of trouble for small deployments. I do agree that encouraging a good SOA is worthwhile -- but only for apps of significant users or significant complexity. It's way overkill for just slapping a small UI on top of Salt, especially when you already have a running web server right there.

  11. jacksontj commented on Sep 4, 2015

    @jacksontj
    Contributor

    Fair enough, if we are going to implement the "small shop" features I think
    we'll want to make the handlers configurable to load (similar to how the
    websockets stuff is today).

    On Thu, Sep 3, 2015 at 10:01 AM, Seth House [email protected]
    wrote:

    A few clients have made JS apps on top of the API that I know of. Serving
    static files is a tiny addition. I'm not a huge fan of the server-side
    requirements for the HTML5 history API but it's also an easy addition --
    just a header inspection and a routing bypass.

    Setting up a second web server and trying to get CORS working correctly is
    a bunch of trouble for small deployments. I do agree that encouraging a
    good SOA is worthwhile -- but only for apps of significant users or
    significant complexity. It's way overkill for just slapping a small UI on
    top of Salt, especially when you already have a running web server right
    there.

    —
    Reply to this email directly or view it on GitHub
    #26505 (comment).

  12. whiteinge commented on Sep 4, 2015

    @whiteinge
    ContributorAuthor

    Works for me.

    I'm digging that pattern in general and wouldn't mind seeing all endpoints have that "lazy-loaded" aspect as a first-class API. I.e., the Salt loader applied to REST endpoints. Not necessary to complete the TODOs in this issue, of course, but food for thought for the future.

  13. jacksontj commented on Sep 4, 2015

    @jacksontj
    Contributor

    Yea, I'm thinking we break it into pieces. And (at least today) those would
    probably be something like "core", "experimental" (ws), "extra"
    (fileserver, etc.)

    On Thu, Sep 3, 2015 at 7:30 PM, Seth House [email protected] wrote:

    Works for me.

    I'm digging that pattern in general and wouldn't mind seeing all endpoints
    have that "lazy-loaded" aspect as a first-class API. I.e., the Salt loader
    applied to REST endpoints. Not necessary to complete the TODOs in this
    issue, of course, but food for thought for the future.

    —
    Reply to this email directly or view it on GitHub
    #26505 (comment).

  14. 5 remaining items

  15. Lothiraldan commented on Jan 19, 2016

    @Lothiraldan
    Contributor

    @whiteinge I tested right now the unofficial CORS support of rest_cherrypy and it doesn't works at least with authentication by header, I will try the cookie authentication but it's not very standard for API to use cookies.

  16. stale commented on Sep 28, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

  17. mchugh19 commented on Sep 29, 2018

    @mchugh19
    Contributor

    This is still an issue and could use a new champion

  18. stale commented on Sep 29, 2018

    @stale

    Thank you for updating this issue. It is no longer marked as stale.

  19. mattp- commented on Oct 25, 2018

    @mattp-
    Contributor

    tagging #35798 as another issue to resolve for cherrypy parity

  20. untra commented on Jun 18, 2019

    @untra

    whats the status of this?

  21. fechnert commented on Jan 14, 2020

    @fechnert
    Contributor

    I'm also very interested in using Tornado and the websocket features rather than rest_cherrypy.

  22. mattp- commented on Jan 14, 2020

    @mattp-
    Contributor

    I have a fix/rewrote the event handling for #35798 at least. just haven't got it sent upstream.

  23. fechnert commented on Jan 16, 2020

    @fechnert
    Contributor

    @mattp- i would love to see and use these changes. The race condition is quite annoying, which prevents me currently from using the websocket as a nice event stream for multiple clients ...

  24. removed
    P2
    on Jun 3, 2020
  25. baby-gnu commented on Apr 4, 2022

    @baby-gnu
    Contributor

    Hello, is there any progress on this issue?

  26. locked and limited conversation to collaborators on Feb 5, 2025
  27. converted this issue into a discussion #67440 on Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreFeatureSalt-API

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions