Example #1
0
def application_logcheck():

    response_text, response_err = '', ''

    iapp = Application.query.get_or_404(
        request.form.get('app_id'))
    server = Server.query.get_or_404(
        request.form.get('server_id'))
    server_type= server_type_choice.get(
        str(server.category), 'telecom')

    project_name = iapp.project.first().ename
    app_name = iapp.ename
    server_ip = server.ip

    h = Host(
       project=project_name,
       app_name=app_name,
       host=server_ip, 
       host_line_type=server_type)
    try:
        command = "tail -n 150 /tmp/%s.log" \
            % app_name
        response_text, response_err = \
            h.run_command(command)
    except Exception,e:
        exception = sys.exc_info()
        response_err = traceback.format_exception(*exception)
Example #2
0
def application_rsync(app_id):

    ac = Application.query.get_u_or_404(app_id)
    response_text, response_err = '', ''

    server_type = request.form.get('category')
    ip = request.form.get('ip')
    project = request.form.get('project')
    app_name = request.form.get('app_name')
    is_need_restart = request.form.get('is_need_restart')
    is_need_restart = True if \
        is_need_restart == 'true' else False

    server_type= server_type_choice.get(server_type, 'telecom')

    h = Host(project=project,app_name=app_name,
        host=ip, host_line_type=server_type)
    try:
        response_text, response_err = \
            h.rsync(is_need_restart=is_need_restart)
    except Exception,e:
        exception = sys.exc_info()
        response_err = traceback.format_exception(*exception)
        current_app.logger.error(response_err)