コード例 #1
0
ファイル: cscontrol.py プロジェクト: yeshbourne/calvin-base
def control_deploy(args):
    response = None
    print args
    try:
        response = utils.deploy_application(args.node, args.script.name,
                                            args.script.read(), args.check)
    except Exception as e:
        print e
    if isinstance(response,
                  dict) and "application_id" in response and args.reqs:
        reqs = requirements_file(args.reqs)
        if reqs:
            try:
                result = utils.add_requirements(args.node,
                                                response["application_id"],
                                                reqs)
                _log.debug(
                    "Succeeded with applying deployment requirements %s\n" %
                    result['placement'])
            except:
                _log.error(
                    "Applying deployment requirement from file %s failed" %
                    args.reqs)
                print("Applying deployment requirement from file %s failed" %
                      args.reqs)
    return response
コード例 #2
0
ファイル: cscontrol.py プロジェクト: KaptenJon/calvin-base
def control_deploy(args):
    data = {"name": args.script.name, "script": args.script.read()}
    node = args.node
    response_http = requests.post(node + "/deploy", data=json.dumps(data))
    response = json.loads(response_http.text)
    if "application_id" in response and args.reqs:
        reqs = requirements_file(args.reqs)
        if reqs:
            result = utils.add_requirements(utils.RT(node), response["application_id"], reqs)
        if result and 'result' in result and result['result'] == 'NACK':
            _log.error("Applying deployment requirement from file %s failed" % args.reqs)
            print ("Applying deployment requirement from file %s failed" % args.reqs)
        elif result and 'placement' in result:
            _log.debug("Succeeded with applying deployment requirements %s\n" % result['placement'])
    return response_http
コード例 #3
0
ファイル: cscontrol.py プロジェクト: Tim-SHOOSAN/calvin-base
def control_deploy(args):
    response = None
    print args
    try:
        response = utils.deploy_application(args.node, args.script.name, args.script.read(), args.check)
    except Exception as e:
        print e
    if isinstance(response, dict) and "application_id" in response and args.reqs:
        reqs = requirements_file(args.reqs)
        if reqs:
            try:
                result = utils.add_requirements(args.node, response["application_id"], reqs)
                _log.debug("Succeeded with applying deployment requirements %s\n" % result["placement"])
            except:
                _log.error("Applying deployment requirement from file %s failed" % args.reqs)
                print ("Applying deployment requirement from file %s failed" % args.reqs)
    return response