Coder Social home page Coder Social logo

django-saltapi's Introduction

Django Salt API

This Django app serves as a REST API for Salt. It is basically a very thing wrapper around the salt-api package.

Status

The main motivation behind creating a Django package to interface with Salt is that Django is already in our software stack. Since then salt-api has become more flexible in the ways it can be deployed -- it is now possible to deploy its rest_cherrypy module on any compliant WSGI server (in contrast to running salt-api in a separate process). In addition to that there is an even slimmer alternative, though with less features, in the rest_wsgi module. I encourage you to have a look at them before deciding to use django-saltapi.

Since salt-api has solved most of the motivations behind the inception of django-saltapi it is likely that this packages raison d'etre will be to utilize more of the functionality in the Django REST Framework. Future developments will likely be towards this goal.

This package comes with some caveats. This app compared to salt-api:

  • this app only supports x-www-form-urlencoded data input for the API wrapper or input snarfed from the URL, whereas salt-api supports other data formats
  • this app supports only JSON data output

Note

Currently the API does not require authentication and two API functions are exposed without CSRF protection, though they are harmless from an integrity perspective. See views.py to enable authentication.

Installation

  1. Add django_saltapi to your INSTALLED_APPS setting in your project `settings.py`:

    INSTALLED_APPS = (
        [...]
        'django_saltapi',
    )
  2. Add Salt settings in your project `settings.py`:

    SALT_CONFIG = {
        'master_config': '/etc/salt/master',
    }
  3. Include the package URLconf in your project urls.py like so:

    url(r'^api/salt/', include('django_saltapi.urls')),

Usage

Note

The documentation and some scripts refer to the host as "salt" where the API is running, YMMV.

  1. Visit http://salt/api/salt/ to view the default static HTML page.
  2. Issue a Salt ping to all minions via the Salt API wrapper:

    django-saltapi '*' test.ping
  3. Try out the explicitly exposed REST API functions (see views.py):

    django-saltapi-ping all
    django-saltapi-echo all x
    django-saltapi-job
    django-saltapi-job <jid>
    django-saltapi-minion
    django-saltapi-minion <mid>

django-saltapi's People

Contributors

holmboe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-saltapi's Issues

Active

Hello,
Is your project working now?
How could you develop authentication ?

Thank you

Arguments gets mangled

Arguments breaks somewhere before they get to Salt if there are more than one (1) character argument.

Compare these two:

django-saltapi-echo salt a
django-saltapi-echo salt abc

The latter will fail saying that you specified 3 arguments. This might be related to x-www-form-urlencoded encoded input data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.