# Load Configuration # ------------------------------------------------------------------ if len(sys.argv) != 2: print("Hey, thats not how you launch this...") print("%s <config file>") % sys.argv[0] sys.exit(1) configfile = sys.argv[1] with open(configfile, 'r') as cfh: config = yaml.safe_load(cfh) # Open Config File and Parse Config Data db=RunbookDB(configfile) conn=db.connect() # Open External Connections # ------------------------------------------------------------------ # RethinkDB Server # Helper Functions # ------------------------------------------------------------------ # Execute # ------------------------------------------------------------------
from runbookdb import RunbookDB if len(sys.argv) != 2: print("Hey, thats not how you launch this...") print("%s <config file>") % sys.argv[0] sys.exit(1) # Open Config File and Parse Config Data configfile = sys.argv[1] with open(configfile, "r") as cfh: config = yaml.safe_load(cfh) # Establish Connection database = config['rethink_db'] db = RunbookDB(configfile) conn = db.connect() tables = [ "users", "reactions", "monitors", "dc1queue", "dc2queue", "events", "history", "subscription_history", ] for table in tables: print "==========TABLE %s" % table
import sys import yaml import rethinkdb as r from runbookdb import RunbookDB if len(sys.argv) != 2: print("Hey, thats not how you launch this...") print("%s <config file>") % sys.argv[0] sys.exit(1) # Open Config File and Parse Config Data configfile = sys.argv[1] with open(configfile, "r") as h: config = yaml.safe_load(h) # Establish Connection host = config['rethink_host'] database = config['rethink_db'] db=RunbookDB(configfile) conn=db.connect() # Drop Database r.db_drop(database).run(conn) print "Done!"