from cloudmesh_base.locations import config_file from cloudmesh_base.ConfigDict import ConfigDict from cloudmesh_base.logger import LOGGER from pymongo import MongoClient from mongoengine import connect # Changes of import in existing cloudmesh code: # ## FROM: # from cloudmesh.config.cm_config import get_mongo_db, get_mongo_dbname_from_collection, DBConnFactory ## TO: # from cloudmesh_database.dbconn import get_mongo_db, get_mongo_dbname_from_collection, DBConnFactory ## log = LOGGER(__file__) MONGOCLIENT = 0 MONGOENGINE = 1 class DBConnFactory(object): connectors = {} DBCONFIG = None TYPE_MONGOCLIENT = MONGOCLIENT TYPE_MONGOENGINE = MONGOENGINE @classmethod def getconn(cls, dbname, clientType=MONGOCLIENT): conn = None
from cloudmesh_base.locations import config_file from flask import Blueprint, g, render_template, request from flask.ext.login import login_required from cloudmesh_base.ConfigDict import ConfigDict from cloudmesh.launcher.cm_launcher_db import cm_launcher_db from flask.ext.principal import Permission, RoleNeed from cloudmesh.config.cm_config import cm_config import subprocess from pprint import pprint from cloudmesh_base.logger import LOGGER LOG_MSG = LOGGER(__file__) launch_module = Blueprint('launch _module', __name__) RAIN_PERMISSION = Permission(RoleNeed('rain')) # # ROUTE: launch # # list of recipies which we need to get from cm_launcher.yaml # @RAIN_PERMISSION.require(http_exception=403) # @login_required # @RAIN_PERMISSION.require(http_exception=403) @launch_module.route('/cm/launch/launch_servers/', methods=["POST", "GET"]) def launch_servers(): config = cm_config() data = {