コード例 #1
0
def remove_public_key(username, filename):
    from scanner.api import ssh_key
    host = 'vinz-ubuntu-12-04.student.iastate.edu'
    with open(filename) as f:
        result = ssh_key.remove_user_public_key(username, [host], f.read())
    if result[host]['success']:
        print 'Successfully added key for user %s to host %s' % (username, host)
    else:
        print 'FAIL: %s' % (result[host]['error'])
コード例 #2
0
ファイル: user.py プロジェクト: mpdavis/vinz
def remove_user(username, hosts):
    """
    :param username: The username of the user to be removed from the remote machines
    :param hosts: A list of servers to remove the user from
    """

    if username == 'root':
        return

    if not isinstance(username, basestring):
        raise ValueError("Username must be a string")

    user = internal_user.get_user_by_username(username)
    if not user:
        return

    for key in list(user.key_list):
        ssh_key.remove_user_public_key(username, hosts, key.value)
コード例 #3
0
ファイル: user.py プロジェクト: mpdavis/vinz
def remove_user(username, hosts):
    """
    :param username: The username of the user to be removed from the remote machines
    :param hosts: A list of servers to remove the user from
    """

    if username == 'root':
        return

    if not isinstance(username, basestring):
        raise ValueError("Username must be a string")

    user = internal_user.get_user_by_username(username)
    if not user:
        return

    for key in list(user.key_list):
        ssh_key.remove_user_public_key(username, hosts, key.value)
コード例 #4
0
ファイル: manage.py プロジェクト: qinxiaoapp/vinz
def remove_public_key(username, filename):
    from scanner.api import ssh_key
    host = 'vinz-ubuntu-12-04.student.iastate.edu'
    with open(filename) as f:
        result = ssh_key.remove_user_public_key(username, [host], f.read())
    if result[host]['success']:
        print 'Successfully added key for user %s to host %s' % (username, host)
    else:
        print 'FAIL: %s' % (result[host]['error'])