Code Monkey home page Code Monkey logo

aiorunbook's Introduction

Overview

Please refer to: http://aiorunbook.readthedocs.io/

Installation

sudo pip3 install git+https://github.com/slieberth/aioRunbook.git

Hello-World aioRunbookScheduler

import asyncio
from aioRunbook.aioRunbookScheduler import aioRunbookScheduler

ymlConfigString = """#hello world yml
config:
  steps:
    - record:
        name: record test local-shell
        method: local-shell
        commands:
          - echo "Hello World" """
fh = open("test.yml",'w')
fh.write(ymlConfigString)
fh.close()
myRunbook = aioRunbookScheduler("test.yml")
loop = asyncio.get_event_loop()
loop.run_until_complete(myRunbook.execSteps(loop))
print(myRunbook.configDict["config"]["steps"][0]['record']['output'])

Hello-World aioRunbookHttpServer

from aioRunbook.aioRunbookHttpServer import aioRunbookHttpServer
from aiohttp.web import Application, Response, StreamResponse, run_app
import asyncio

ymlConfigString = """#
templateDir: "./templates/"
runbookDirs:
  - "./runbookDir1"
  - "./runbookDir2"
  - "./runbookDir3"
httpPort: 4711  
userAuth:
- - username: CharlieBrown
  - password: test
  - permissions: 
    - viewResults
- - username: MissSophie
  - password: test
  - permissions: 
    - viewResults
    - runTests
- - username: MajorTom
  - password: test
  - permissions: 
    - viewResults
    - runTests
    - editTests"""
fh = open("aioServerConfig.yml",'w')
fh.write(ymlConfigString)
fh.close()
myHttpServer = aioRunbookHttpServer("aioServerConfig.yml")
loop = asyncio.get_event_loop()
app = myHttpServer.init(loop)
if app != None:
    loop.run_until_complete(run_app(app,port=myHttpServer.httpPort))

On your local machine you must copy all *.html files from the git template into a local folder ./templates. On your local machine you must create the directories for the configured runbooks directories: ./runbookDir[1-3] All directories are customizable in the config file. The given ones are just examples.

testing aioRunbookHttpServer with docker

an docker container is available for testing:

docker pull slieberth/aiorunbook
docker run  -p 4711:4711 slieberth:aioRunbook

The direct your browser to 127.0.0.1:4711

aiorunbook's People

Contributors

slieberth avatar

Watchers

 avatar

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.