コード例 #1
0
def _check_instance(args):
    (node, instances, instance_id) = args
    instance = [i for i in instances if i.name == instance_id][0]
    ip_addr = instance.public_ip[0]
    ssh_status = True  #_test_ssh(ip_addr)
    launch_date = parser.parse(instance.extra['launchdatetime']).utcnow()
    image_id = instance.extra['imageId']
    owner_id = instance.extra['ownerId']
    instance_info = {
        'ip': ip_addr,
        'ssh': ssh_status,
        'launch_date': launch_date,
        'image_id': image_id,
        'owner_id': owner_id,
        'instance_id': instance_id,
        'node_controller': node,
    }
    user = lookupUser(owner_id)
    if user:
        instance_info.update({
            'username':
            user['uid'],
            'email':
            user['mail'],
            'full_name':
            "%s %s" % (user['givenName'], user['sn'])
        })
    return instance_info
コード例 #2
0
def _check_instance(args):
        (node, instances, instance_id) = args
        instance = [i for i in instances if i.name == instance_id][0]
        ip_addr = instance.public_ip[0]
        ssh_status = True#_test_ssh(ip_addr)
        launch_date = parser.parse(instance.extra['launchdatetime']).utcnow()
        image_id = instance.extra['imageId']
        owner_id = instance.extra['ownerId']
        instance_info = {
            'ip':ip_addr,
            'ssh':ssh_status,
            'launch_date':launch_date,
            'image_id': image_id,
            'owner_id': owner_id,
            'instance_id':instance_id,
            'node_controller':node,
        }
        user = lookupUser(owner_id)
        if user:
            instance_info.update({
                'username':user['uid'],
                'email':user['mail'],
                'full_name': "%s %s" % (user['givenName'], user['sn'])
            })
        return instance_info
コード例 #3
0
ファイル: authBackends.py プロジェクト: nickeddy/atmosphere
 def authenticate(self, username=None, password=None, request=None):
     """
     Return user if validated by LDAP.
     Return None otherwise.
     """
     if not ldap_validate(username, password):
         logger.debug("LDAP Authentication failed - "+username)
         return None
     ldap_attrs = lookupUser(username)
     attributes = ldap_formatAttrs(ldap_attrs)
     return makeOrCreateUser(username, attributes)
コード例 #4
0
 def authenticate(self, username=None, password=None, request=None):
     """
     Return user if validated by LDAP.
     Return None otherwise.
     """
     if not ldap_validate(username, password):
         logger.debug("LDAP Authentication failed - " + username)
         return None
     ldap_attrs = lookupUser(username)
     attributes = ldap_formatAttrs(ldap_attrs)
     return makeOrCreateUser(username, attributes)
コード例 #5
0
ファイル: email.py プロジェクト: Angelfirenze/atmosphere
def user_email_info(username):
    logger.debug("user = %s" % username)
    ldap_attrs = lookupUser(username)
    user_email = ldap_attrs.get('mail', [None])[0]
    if not user_email:
        raise Exception("Could not locate email address for User:%s - Attrs: %s" % (username, ldap_attrs))
    user_name = ldap_attrs.get('cn', [""])[0]
    if not user_name:
        user_name = "%s %s" % (ldap_attrs.get("displayName", [""])[0],
                               ldap_attrs.get("sn", [""])[0])
    if not user_name.strip(' '):
        user_name = username

    return (username, user_email, user_name)
コード例 #6
0
ファイル: email.py プロジェクト: 420reich/atmosphere
def user_email_info(username):
    logger.debug("user = %s" % username)
    ldap_attrs = lookupUser(username)
    user_email = ldap_attrs.get('mail', [None])[0]

    if not user_email:
        user_email = "*****@*****.**" % username

    user_name = ldap_attrs.get('cn', [""])[0]
    if not user_name:
        user_name = "%s %s" % (ldap_attrs.get("displayName", [""])[0],
                               ldap_attrs.get("sn", [""])[0])
    if not user_name.strip(' '):
        user_name = username

    return (username, user_email, user_name)
コード例 #7
0
ファイル: email.py プロジェクト: eandhy/atmosphere
def user_email_info(username):
    logger.debug("user = %s" % username)
    ldap_attrs = lookupUser(username)
    user_email = ldap_attrs.get('mail', [None])[0]

    if not user_email:
        user_email = "*****@*****.**" % username

    user_name = ldap_attrs.get('cn', [""])[0]
    if not user_name:
        user_name = "%s %s" % (ldap_attrs.get(
            "displayName", [""])[0], ldap_attrs.get("sn", [""])[0])
    if not user_name.strip(' '):
        user_name = username

    return (username, user_email, user_name)
コード例 #8
0
ファイル: email.py プロジェクト: Angelfirenze/atmosphere
def user_email_info(username):
    logger.debug("user = %s" % username)
    ldap_attrs = lookupUser(username)
    user_email = ldap_attrs.get('mail', [None])[0]
    if not user_email:
        raise Exception(
            "Could not locate email address for User:%s - Attrs: %s" %
            (username, ldap_attrs))
    user_name = ldap_attrs.get('cn', [""])[0]
    if not user_name:
        user_name = "%s %s" % (ldap_attrs.get(
            "displayName", [""])[0], ldap_attrs.get("sn", [""])[0])
    if not user_name.strip(' '):
        user_name = username

    return (username, user_email, user_name)
コード例 #9
0
def _check_instance(args):
    (node, instances, instance_id) = args
    instance = [i for i in instances if i.name == instance_id][0]
    ip_addr = instance.public_ip[0]
    ssh_status = True  # _test_ssh(ip_addr)
    launch_date = parser.parse(instance.extra["launchdatetime"]).utcnow()
    image_id = instance.extra["imageId"]
    owner_id = instance.extra["ownerId"]
    instance_info = {
        "ip": ip_addr,
        "ssh": ssh_status,
        "launch_date": launch_date,
        "image_id": image_id,
        "owner_id": owner_id,
        "instance_id": instance_id,
        "node_controller": node,
    }
    user = lookupUser(owner_id)
    if user:
        instance_info.update(
            {"username": user["uid"], "email": user["mail"], "full_name": "%s %s" % (user["givenName"], user["sn"])}
        )
    return instance_info