Esempio n. 1
0
#!/usr/bin/python3

# first init env
import env, tools
config = env.getenv("CONFIG")
tools.loadenv(config)

# must import logger after initlogging, ugly
from log import initlogging
initlogging("docklet-worker")
from log import logger

import xmlrpc.server, sys, time
from socketserver import ThreadingMixIn
import threading
import etcdlib, network, container
from nettools import netcontrol
import monitor
from lvmtool import new_group, recover_group
import psutil

##################################################################
#                       Worker
# Description : Worker starts at worker node to listen rpc request and complete the work
# Init() :
#      get master ip
#      initialize rpc server
#      register rpc functions
#      initialize network
#      initialize lvm group
# Start() : 
Esempio n. 2
0
#!/usr/bin/python3

# load environment variables in the beginning
# because some modules need variables when import
# for example, userManager/model.py

# must first init loadenv
import tools, env
config = env.getenv("CONFIG")
tools.loadenv(config)

# second init logging
# must import logger after initlogging, ugly
from log import initlogging
initlogging("docklet-master")
from log import logger

import os
import http.server, cgi, json, sys, shutil
from socketserver import ThreadingMixIn
import nodemgr, vclustermgr, etcdlib, network, imagemgr
import userManager
import monitor
import guest_control, threading

external_login = env.getenv('EXTERNAL_LOGIN')
if (external_login == 'TRUE'):
    from userDependence import external_auth

class DockletHttpHandler(http.server.BaseHTTPRequestHandler):
    def response(self, code, output):
Esempio n. 3
0
import os
import getopt

import sys, inspect




this_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
src_folder = os.path.realpath(os.path.abspath(os.path.join(this_folder,"..", "src")))
if src_folder not in sys.path:
    sys.path.insert(0, src_folder)

# must first init loadenv
from log import initlogging
initlogging("docklet-user")
from log import logger

import tools, env
config = env.getenv("CONFIG")
tools.loadenv(config)
masterips = env.getenv("MASTER_IPS").split(",")
G_masterips = []
for masterip in masterips:
    G_masterips.append(masterip.split("@")[0] + ":" + str(env.getenv("MASTER_PORT")))

from flask import Flask, request, session, render_template, redirect, send_from_directory, make_response, url_for, abort
from functools import wraps
import userManager,beansapplicationmgr, notificationmgr
import threading,traceback
from model import User,db
Esempio n. 4
0
#!/usr/bin/python3

# first init env
import env, tools
config = env.getenv("CONFIG")
tools.loadenv(config)

# must import logger after initlogging, ugly
from log import initlogging
initlogging("docklet-worker")
from log import logger

import xmlrpc.server, sys, time
from socketserver import ThreadingMixIn
import threading
import etcdlib, network, container
from nettools import netcontrol
import monitor
from lvmtool import new_group, recover_group

##################################################################
#                       Worker
# Description : Worker starts at worker node to listen rpc request and complete the work
# Init() :
#      get master ip
#      initialize rpc server
#      register rpc functions
#      initialize network
#      initialize lvm group
# Start() :
#      register in etcd
Esempio n. 5
0
import json
import os
import getopt

import sys, inspect

this_folder = os.path.realpath(
    os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
src_folder = os.path.realpath(
    os.path.abspath(os.path.join(this_folder, "..", "src")))
if src_folder not in sys.path:
    sys.path.insert(0, src_folder)

# must first init loadenv
from log import initlogging
initlogging("docklet-user")
from log import logger

import tools, env
config = env.getenv("CONFIG")
tools.loadenv(config)
masterips = env.getenv("MASTER_IPS").split(",")
G_masterips = []
for masterip in masterips:
    G_masterips.append(
        masterip.split("@")[0] + ":" + str(env.getenv("MASTER_PORT")))

from flask import Flask, request, session, render_template, redirect, send_from_directory, make_response, url_for, abort
from functools import wraps
import userManager, beansapplicationmgr, notificationmgr
import threading, traceback
Esempio n. 6
0
# because some modules need variables when import
# for example, userManager/model.py

from flask import Flask, request

# must first init loadenv
import tools, env
# default CONFIG=/opt/docklet/local/docklet-running.conf

config = env.getenv("CONFIG")
tools.loadenv(config)

# second init logging
# must import logger after initlogging, ugly
from log import initlogging
initlogging("docklet-master")
from log import logger

import os
import http.server, cgi, json, sys, shutil
import xmlrpc.client
from socketserver import ThreadingMixIn
import nodemgr, vclustermgr, etcdlib, network, imagemgr, notificationmgr, lockmgr
from logs import logs
import userManager, beansapplicationmgr
import monitor, traceback
import threading
import sysmgr
import requests
from nettools import portcontrol
Esempio n. 7
0
#!/usr/bin/python3

import json
import os
import getopt
import time

import sys

# must first init loadenv
import tools, env
config = env.getenv("CONFIG")
tools.loadenv(config)

from log import initlogging
initlogging("docklet-web")
from log import logger

from flask import Flask, render_template, redirect, request, session, make_response
import requests
import auth, cookie_tool
import utils
from usermgr import UserManager
import proxytool

app = Flask(__name__)

@app.route("/", methods=['GET'])
def home():
    return render_template('home.html')