Esempio n. 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'])
Esempio n. 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())
Esempio n. 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'])
Esempio n. 4
0
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))
Esempio n. 5
0
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)
Esempio n. 6
0
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
Esempio n. 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())