コード例 #1
0
def get_keys(host,user,passwd):
    os = Openshift(host=host,user=user,passwd=passwd)
    (resp, content) = os.keys_list()
    if resp != 200:
        print('ERROR! Result: %(resp)s' % {'resp': resp})
        sys.exit(1)
    return os.rest.response.json()['data']
コード例 #2
0
def remove_key(host,user,passwd,key_name, verbose=False):
    if verbose:
        print('Removing key %(keyname)s' % {'keyname': key_name})
    os = Openshift(host=host,user=user,passwd=passwd)
    (resp, content) = os.key_delete(key_name)
    if resp != 200:
        print 'ERROR! Result: %(resp)s' % {'resp': resp}
        sys.exit(3)
    if verbose:
        print('Done')
    return os.rest.response.json()['data']
コード例 #3
0
def add_key(host,user,passwd,key_name,key_type,key_contents, verbose=False):
    if verbose:
        print('Adding key %(keyname)s' % {'keyname': key_name})
    os = Openshift(host=host,user=user,passwd=passwd)
    (resp, content) = os.key_add(name=key_name, type=key_type, key_str=key_contents)
    if resp != 200:
        print('ERROR! Result: %(resp)s' % {'resp': resp})
        sys.exit(2)
    if verbose:
        print('Done')
    return os.rest.response.json()['data']
コード例 #4
0
def get_keys(host,user,passwd):
    os = Openshift(host=host,user=user,passwd=passwd)
    (resp, content) = os.keys_list()
    if resp != 200:
        print('ERROR! Result: %(resp)s' % {'resp': resp})
        sys.exit(1)
    return os.rest.response.json()['data']
コード例 #5
0
def remove_key(host,user,passwd,key_name, verbose=False):
    if verbose:
        print('Removing key %(keyname)s' % {'keyname': key_name})
    os = Openshift(host=host,user=user,passwd=passwd)
    (resp, content) = os.key_delete(key_name)
    if resp != 200:
        print 'ERROR! Result: %(resp)s' % {'resp': resp}
        sys.exit(3)
    if verbose:
        print('Done')
    return os.rest.response.json()['data']
コード例 #6
0
def add_key(host,user,passwd,key_name,key_type,key_contents, verbose=False):
    if verbose:
        print('Adding key %(keyname)s' % {'keyname': key_name})
    os = Openshift(host=host,user=user,passwd=passwd)
    (resp, content) = os.key_add(name=key_name, type=key_type, key_str=key_contents)
    # 200 = ok, 201 = created, 422 = error in key format
    # The latest one is an error, but shouldn't break adding the rest of the keys
    if resp != 200 and resp != 201 and resp != 422:
        print('ERROR! Result: %(resp)s' % {'resp': resp})
        sys.exit(2)
    if verbose:
        print('Done')
    return os.rest.response.json()['data']