コード例 #1
0
def list_projects():
    proj = projects()
    for cluster in proj.getSites():
        proj._csite_ = cluster
        print("=" * 5, cluster, "=" * 5)
        table_layout("Proj for {0}".format(cluster), proj.list(),
                     ['id', 'name'])
コード例 #2
0
 def list(describe):
     key_info = KeyPairFun.keypair_data_info()
     if not isNone(describe):
         table_layout(' {} Info '.format(describe),
                      key_info.queryById(describe))
     else:
         #pp(show_list = key_info.list())
         table_layout(' KeyPairs Info ', key_info.list())
コード例 #3
0
def list_all_img():
    print("NOTE: This operation will take 1~2 mins.")
    a = solutions()
    cntrs = [(cntr['name'], cntr['id']) for cntr in a.list()
             if not cntr['id'] in block_set]
    sol_list = sites.getSolList(name_only=True)
    base_site = sites(debug=False)
    output = []
    for (sol_name, sol_id) in cntrs:
        output.append({
            "sol_name": sol_name,
            "sol_id": sol_id,
            "images": base_site.getAvblImg(sol_id, sol_name)
        })

    table_layout("img", output, ['sol_name', 'sol_id', 'images'])
コード例 #4
0
ファイル: gpu_cntr.py プロジェクト: theblackcat102/TWCC-CLI
def create_commit():
    a = sites()
    isAll = True;

    if type(a.list(isAll=isAll)) is dict and 'detail' in a.list(isAll=isAll).keys():
        isAll = False

        my_sites = a.list(isAll=isAll)
        if len(my_sites)>0:
            col_name = ['id','name', 'create_time', 'status']
            table_layout('sites', my_sites, caption_row=col_name)

    site_id = get_input(u'Please Input the site ID which you would like to commit: ')
    tag = get_input(u'Please Input the image tag  ')
    image = get_input(u'Please Input the image name: ')
    c = image_commit()
    print(c.createCommit(site_id, tag, image))
コード例 #5
0
ファイル: gpu_cntr.py プロジェクト: theblackcat102/TWCC-CLI
def list_cntr(site_id, isTable,isAll):
    if not type(site_id)==type(1):
        raise ValueError("Site number: '{0}' error.".format(site_id))

    if not isTable:
        gen_cntr(site_id)
    else:
        a = sites()
        if type(a.list(isAll=isAll)) is dict and 'detail' in a.list(isAll=isAll).keys():
            isAll = False
        # raise ValueError("{}, please change to Admin key".format(a.list(isAll=isAll)['detail']))
        if site_id==0:
            my_sites = a.list(isAll=isAll)
            if len(my_sites)>0:
                col_name = ['id','name', 'create_time', 'status']
                table_layout('sites', my_sites, caption_row=col_name)
        else:
            res = a.queryById(site_id)
            col_name = ['id','name', 'create_time', 'status', 'status_reason']
            table_layout('sites: %s'%site_id, res, caption_row=col_name)
コード例 #6
0
ファイル: gpu_cntr.py プロジェクト: theblackcat102/TWCC-CLI
def list_all_solutions():
    a = solutions()
    sols = a.list()
    col_name = ['id','name', 'create_time']
    table_layout("all avalible solutions", sols, caption_row=col_name)
    return sols
コード例 #7
0
 def list(describe):
     acls_info = AclsFun.acls_auth()
     if not isNone(describe):
         table_layout(' Acls Info ', acls_info.queryById(describe))
     else:
         pp(show_list=acls_info.list())