Tailor Documentation. Release 0.1. Derek Stegelman, Garrett Pennington, and Jon Faustman

Similar documents
git-pr Release dev2+ng5b0396a

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

mp3fm Documentation Release Akshit Agarwal

Django Mail Queue Documentation

Sensor-fusion Demo Documentation

PyCon APAC 2014 Documentation

X Generic Event Extension. Peter Hutterer

agate-sql Documentation

inflection Documentation

puppet-diamond Documentation

Dellve CuDNN Documentation

dublincore Documentation

retask Documentation Release 1.0 Kushal Das

Elegans Documentation

utidylib Documentation Release 0.4

Feed Cache for Umbraco Version 2.0

Imagination Documentation

aiounittest Documentation

Testworks User Guide. Release 1.0. Dylan Hackers

delegator Documentation

BME280 Documentation. Release Richard Hull

sensor-documentation Documentation

jumpssh Documentation

MCAFEE THREAT INTELLIGENCE EXCHANGE RESILIENT THREAT SERVICE INTEGRATION GUIDE V1.0

disspcap Documentation

Imagination Documentation

Statsd Metrics Documentation

Piexif Documentation. Release 1.0.X. hmatoba

abstar Documentation Release Bryan Briney

Guest Book. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Firebase PHP SDK. Release

XStatic Documentation

Piexif Documentation. Release 1.0.X. hmatoba

deepatari Documentation

invenio-formatter Documentation

SopaJS JavaScript library package

twstock Documentation

PHP-FCM Documentation

Instagram PHP Documentation

Asthma Eliminator MicroMedic Competition Entry

Industries Package. TARMS Inc.

CuteFlow-V4 Documentation

XEP-0099: IQ Query Action Protocol

XEP-0087: Stream Initiation

Open Source Used In Cisco Configuration Professional for Catalyst 1.0

clipbit Release 0.1 David Fraser

KEMP Driver for Red Hat OpenStack. KEMP LBaaS Red Hat OpenStack Driver. Installation Guide

Daedalus Documentation

pydocstyle Documentation

OPi.GPIO Documentation

TWO-FACTOR AUTHENTICATION Version 1.1.0

HTNG Web Services Product Specification. Version 2011A

NDIS Implementation Guide

HTNG Web Services Product Specification. Version 2014A

Bambu API Documentation

MatPlotTheme Documentation

Spotter Documentation Version 0.5, Released 4/12/2010

XEP-0399: Client Key Support

Inptools Manual. Steffen Macke

RTI Connext DDS Core Libraries

SW MAPS TEMPLATE BUILDER. User s Manual

Colgate, WI

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

django-helpdesk Documentation

Epic. Epic Systems. Deployment Guide

XEP-0104: HTTP Scheme for URL Data

XEP-0363: HTTP File Upload

XEP-0044: Full Namespace Support for XML Streams

LANDISVIEW Beta v1.0-user Guide

MEAS HTU21D PERIPHERAL MODULE

LoadMaster VMware Horizon (with View) 6. Deployment Guide

Transparency & Consent Framework

Splunk. Splunk. Deployment Guide

Java Relying Party API v1.0 Programmer s Guide

Adobe Connect. Adobe Connect. Deployment Guide

josync Documentation Release 1.0 Joel Goop and Jonas Einarsson

Transparency & Consent Framework

Additional License Authorizations for HPE OneView for Microsoft Azure Log Analytics

Black Mamba Documentation

mqtt-broker Documentation

Migration Tool. Migration Tool (Beta) Technical Note

XEP-0361: Zero Handshake Server to Server Protocol

CS 4961 Senior Design. Planetary Surface Flyover Movie Generator. Software Design Specification

XEP-0056: Business Data Interchange

Packet Trace Guide. Packet Trace Guide. Technical Note

The RX Document Version 1.0 X11 Release 6.4

XEP-0206: XMPP Over BOSH

webbot Documentation Release Natesh M Bhat

Bluetooth Low Energy in C++ for nrfx Microcontrollers

ClassPad Manager Subscription

MEAS TEMPERATURE SYSTEM SENSOR (TSYS01) XPLAINED PRO BOARD

Simba Cassandra ODBC Driver with SQL Connector

International Color Consortium

Moodle. Moodle. Deployment Guide

SWTP 6800 Simulator Usage 27-Mar-2012

XEP-0052: File Transfer

XEP-0140: Shared Groups

VMware vcenter Log Insight Manager. Deployment Guide

Preprocessing of fmri data

Dependency Injection Container Documentation

Transcription:

Tailor Documentation Release 0.1 Derek Stegelman, Garrett Pennington, and Jon Faustman August 15, 2012

CONTENTS 1 Quick Start 3 1.1 Requirements............................................... 3 1.2 Installation................................................ 3 2 Authors 5 2.1 Core Authors............................................... 5 3 Tailor Decorators 7 3.1 @tailored................................................. 7 3.2 @dependency.............................................. 7 4 Tailor Server API 9 4.1 Tailor Command JSON......................................... 9 5 License 11 6 Feature Set 13 i

ii

Tailor Documentation, Release 0.1 Tailor is a Python (Django) application designed to take your fabric commands, and make them executable from an API. Tailor is built with modularity in mind by binding explicitly to the Fabric file you supply. Fabric commands can be made accessible to the web API by adding the @tailored decorator. CONTENTS 1

Tailor Documentation, Release 0.1 2 CONTENTS

CHAPTER ONE QUICK START 1.1 Requirements Django 1.3.x or greater Fabric 1.2 Installation To install Tailor simply install via pip: pip install tailor 1.2.1 Client Installation Add application to installed apps: INSTALLED_APPS += ( tailor.client, ) Add tailor.urls to your url conf: urlpatterns = patterns(, ) url(r ^tailor/, include( tailor.client.urls )), Add TAILOR_FABFILE_PATH, a path to your fabfile, to your Django settings file.: TAILOR_FABFILE_PATH = "/path/to/your/fabfile.py" Add TAILOR_API_KEYS, a dictionary of accepted keys, to your Django settings file.: TAILOR_API_KEYS = { dashboard : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, hubot : YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY, arduinio : ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ, } 3

Tailor Documentation, Release 0.1 Note: Tailor includes a simple alphanumeric key generator. from tailor import keygen then run keygen.generate(32) In your fabfile, from tailor.client.decorators import tailored. To make Fabric commands available to Tailor, add the @tailored decorator to any Fabric function. For functions that may be used by other fabric tasks, but shouldn t be directly callable via the api, add the @dependency decorator. Returns a list of the available Fabric commands, including docstrings and required parameters /tailor/api/schema/?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Method: GET 1.2.2 Servent Installation Add application to installed apps: INSTALLED_APPS += ( tailor.servent, ) Add tailor.urls to your url conf: urlpatterns = patterns(, ) url(r ^tailor/, include( tailor.servent.urls )), Using the Admin If you don t want to make your own custom Tailor client, you can use the admin. Add entries to the Project model including the location of a tailor schema and a valid Tailor api key. Execute commands from with the change form page in the admin. Rolling your own Client You can make any number of clients with any language, device, or method. Simply post JSON to a tailor fab location with the following information. If you project is recorded in the Tailor Project model, you can include the id in the Tailor fab api. Otherwise, omit an id and provide a schema_url and an api_key Run Fabric commands URL: /your_tailor_url_path/api/v1/fab/<id> Method: POST POST DATA (for a remote host): { hosts : [ http://server1.example.com, http://server2.example.com, http://server3.example.com ], commands : [ { command : alpha }, 4 Chapter 1. Quick Start

Tailor Documentation, Release 0.1 } { command : deploy, parameters : [ 0.96, ] } ], apikey : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX POST DATA (for the same host): { } hosts : self, commands : [ { command : production }, { command : restart_apache } ] 1.2. Installation 5

Tailor Documentation, Release 0.1 6 Chapter 1. Quick Start

CHAPTER TWO AUTHORS 2.1 Core Authors Garrett Pennington @gpennington Derek Stegelman - @dstegelman 7

Tailor Documentation, Release 0.1 8 Chapter 2. Authors

CHAPTER THREE TAILOR DECORATORS 3.1 @tailored Using the decorator @tailored on a fabric method will set an attribute that allows the method to be accessible via the tailor API. Example: from tailor.client.decorators import tailored @tailored def collect_static(): """ Collect static files, run before comitting call alpha or production first """ virtualenv("python manage.py collectstatic --noinput --settings=settings.%s" % env.branch) 3.2 @dependency The dependency decorator is used when Tailor needs access to the fabric command for the API, but you don t want to be able to access the method directly. Example: from tailor.client.decorators import dependency @dependency def virtualenv(command): with cd(env.directory): run(env.activate + && + command) 9

Tailor Documentation, Release 0.1 10 Chapter 3. Tailor Decorators

CHAPTER FOUR TAILOR SERVER API 4.1 Tailor Command JSON { } "hosts": [ "server1.example.com" ], "commands": [ { "command": "make_release", "params": [ { "name": "tag", "value": "1.0" }, { "name": "message", "value": "a new tag" } ] }, { "command": "alpha", "params": [] } ], "api_key": "sdfsdlkoweiu209823f4980fsadnfbqamck3i", "schema_url": "http://localhost:8001/tailor/api/v1/schema/" 11

Tailor Documentation, Release 0.1 12 Chapter 4. Tailor Server API

CHAPTER FIVE LICENSE Copyright (c) 2012 Garrett Pennington, Derek Stegelmen, Jon Faustman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software ), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PAR- TICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT- WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13

Tailor Documentation, Release 0.1 14 Chapter 5. License

CHAPTER SIX FEATURE SET Drop in fabfile Execute decorated functions through a HTTP based API. Key based authentication 15