Example #1
0
def update_project(name, image, source, description, auto_poll, timeout):
    """update a build project"""

    kargs = {
        'host': c.cfg['host'],
        "api_version": c.cfg['api_version'],
        "url_path": "/builder"
    }
    if not name:
        sys.exit("name can't be empty.")
    if not image:
        sys.exit("image can't be empty. Try 'escli builder list-envrionments'")
    if not source:
        sys.exit("source can't be empty.")
    if auto_poll:
        pollForSourceChanges = "true"
    else:
        pollForSourceChanges = "false"
    try:
        dict_resp = esb.Builder(kargs).update_project(name, image, source,
                                                      description,
                                                      pollForSourceChanges,
                                                      timeout)
    except Exception as e:
        sys.exit("failed to update project:  %s" % str(e))
    print(jsn.dumps(dict_resp, sort_keys=True, indent=4))
    if dict_resp == None:
        click.echo("failed to update project")
        sys.exit(1)
Example #2
0
def get_project(name):
    """gets information about build project"""

    kargs = {
        'host': c.cfg['host'],
        "api_version": c.cfg['api_version'],
        "url_path": "/builder"
    }
    try:
        dict_resp = esb.Builder(kargs).query_project(name)
    except Exception as e:
        sys.exit("failed to query project:  %s" % str(e))
    print(jsn.dumps(dict_resp, sort_keys=True, indent=4))
    if dict_resp == None:
        click.echo("failed to get project details")
        sys.exit(1)
Example #3
0
def list_repositories():
    """list your build repositories"""

    kargs = {
        'host': c.cfg['host'],
        "api_version": c.cfg['api_version'],
        "url_path": "/builder"
    }
    try:
        dict_resp = esb.Builder(kargs).get_repositories()
    except Exception as e:
        sys.exit("failed to query repositories:  %s" % str(e))
    print(jsn.dumps(dict_resp, sort_keys=True, indent=4))
    if dict_resp == None:
        click.echo("failed to get repositorie list")
        sys.exit(1)
Example #4
0
def start_project_build(name):
    """start build project"""

    kargs = {
        'host': c.cfg['host'],
        "api_version": c.cfg['api_version'],
        "url_path": "/builder"
    }
    try:
        dict_resp = esb.Builder(kargs).start_project_build(name)
    except Exception as e:
        sys.exit("failed to start project:  %s" % str(e))
    print(jsn.dumps(dict_resp, sort_keys=True, indent=4))
    if dict_resp == None:
        click.echo("failed to start project")
        sys.exit(1)
Example #5
0
def list_projects(orderby, status):
    """list your build projects"""

    filters = {'orderby': orderby, "status": status}
    kargs = {
        'host': c.cfg['host'],
        "api_version": c.cfg['api_version'],
        "url_path": "/builder",
        "params": filters
    }
    try:
        dict_resp = esb.Builder(kargs).get_projects()
    except Exception as e:
        sys.exit("failed to query projects:  %s" % str(e))
    print(jsn.dumps(dict_resp, sort_keys=True, indent=4))
    if dict_resp == None:
        click.echo("failed to get project list")
        sys.exit(1)