示例#1
0
def dashboard(user):
    grouped_manifests = {}

    manifests = storage.read_manifests()
    for uuid, manifest in manifests.items():
        if not user['admin'] and user['token'] != manifest['developer']:
            continue

        #manifest['git_to_html_url'] = None 
        if manifest.get('url') is not None:
            try:
                manifest['git_to_html_url'] = "http"+''.join(manifest['url'][3:]) 
            except Exception as err:
                print str(err)
        manifest['developer_username'] = storage.get_username_by_token(manifest['developer'])
        common_manifest_part = grouped_manifests.setdefault(manifest['name'], {})
        common_manifest_part.setdefault('description', manifest['description'])
        common_manifest_part.setdefault('type', manifest['type'])
        common_manifest_part.setdefault('manifests', []).append(manifest)
    runlists = storage.read_runlists()
    print storage.read_hosts()
    storage.delete_alias('test ')
    profiles = storage.read_profiles()
    PROFILE_OPTIONS = PROFILE_OPTION_VALIDATORS.keys()
    return render_template('dashboard.html', hosts=storage.read_hosts(),  **locals())
示例#2
0
def userinfo(user):
    print user
    return jsonify({"result" : "ok", "ACL" : {}, "login" : storage.get_username_by_token(user.get('token'))})