Skip to content

Instantly share code, notes, and snippets.

@michaelkuty
Created January 9, 2016 17:21
Show Gist options
  • Save michaelkuty/16203266f5d0bbe54f0e to your computer and use it in GitHub Desktop.
Save michaelkuty/16203266f5d0bbe54f0e to your computer and use it in GitHub Desktop.
Salt Master Flask server
from flask import jsonify
from flask import Flask
from flask import request
import yaml
app = Flask(__name__)
@app.route("/<path:path>", methods=['POST'])
def dump_relass(path):
print path
reclass = yaml.load(request.data)
print reclass
stream = file('/' + path, 'w')
yaml.dump(reclass, stream)
stream.close()
return jsonify({"result": "Success! See /%s" % path})
if __name__ == "__main__":
app.debug = True
app.run(host="0.0.0.0")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment