Exemple #1
0
def lists(name):
    """Lists clusters or resources"""
    if name == "cluster":
        # list of clusters from yaml 
        ddict = dict(enumerate(udata.clusters(), start=1))
    elif name == "resource":
        ddict = dict(enumerate(udata.resources(), start=1))
    elif name == "key":
        ddict = dict(enumerate(ukey.list_keys(), start=1))
    else:
        print ("Unexpected type: {0}".format(name))# %s" % name)
        ddict = {}

    for num, val in ddict.iteritems():
        print ("{0}) {1}".format(num, val))
Exemple #2
0
def update(rtype):
    """Updates clusters or resources"""
    if rtype == "cluster":
        # list of clusters from yaml 
        ddict = dict(enumerate(udata.clusters(), start=1))
    elif rtype == "resource":
        ddict = dict(enumerate(udata.resources(), start=1))
    else:
        print ("Unexpected type")# %s" % name)
        ddict = None

    for num, val in ddict.iteritems():
        print ("{0}) {1}".format(num, val))

    num = click.prompt("Choose to update", type=int)
    click.edit(filename=udata.get_filepath(name=ddict[num], rtype=rtype))