Ejemplo n.º 1
0
def details(request):
    logger = logging.getLogger('dashboard')
    artifacts = list()
    version = request.GET.get('version')
    license = request.GET.get('license') or 'community'
    os = request.GET.get('os')
    #read all builds from couchbase server
    couchbase = CbClient("localhost", 8091, "Administrator", "password")
    logger.error("connected to couchbase")
    allbuilds = couchbase.query(bucket='default',
                                ddoc='builds',
                                view='metadata',
                                limit=20000)
    #logger.error(allbuilds["rows"])
    #populate builds
    #  emit(doc.name, [doc.name,doc.url,doc.fullversion,doc.arch,doc.version]);
    for item in allbuilds["rows"]:
        value = item["value"]
        if value["fullversion"].find("toy") >= 0:
            continue
        value['buildnumber'] = value["fullversion"][
            value["fullversion"].find("-") + 1:value["fullversion"].rfind("-")]
        license_match = value["name"].find(license) > 0
        logger.error("license_match %s for %s" %
                     (license_match, value["name"]))
        arch_display_name = ''
        if value["arch"] == "x86_64":
            arch_display_name = "64-bit"
        else:
            arch_display_name = "32-bit"
        if version == value["version"] and os == value[
                "os"] and license_match is True:
            artifact_item = {
                "name": value["name"],
                "url": value["url"],
                "fullversion": value["fullversion"],
                "arch": arch_display_name,
                "buildnumber": int(value['buildnumber']),
                "os": value["os"]
            }
            #get the manifest if it exists ?
            artifact_item["manifest"] = manifest_for_build(
                value["fullversion"]) or "not fond"
            artifacts.append(artifact_item)

    couchbase.close()
    os_display_name = ''
    if os == 'rpm':
        os_display_name = 'Centos'
    elif os == 'deb':
        os_display_name = 'Ubuntu'
    elif os == 'windows':
        os_display_name = 'Windows'
    title = "%s builds ( 32-bit and 64-bit) %s edition" % (os_display_name,
                                                           license)
    artifacts = DataHelper.multikeysort(artifacts, ['buildnumber'])
    return render_to_response('../templates/dashboard/details.html', {
        'title': title,
        'data': artifacts
    })
 def read(self, request, build_id):
     couchbase = CbClient("localhost", 8091, "Administrator", "password")
     response = []
     allbuilds = couchbase.query(bucket='default', ddoc='builds',
         view='metadata', limit=200, params={"startkey": "\"%s\"" % (build_id)})
     for item in allbuilds["rows"]:
         row = item["value"]
         response.append(row)
     couchbase.close()
     return response
def details(request):
    logger = logging.getLogger('dashboard')
    artifacts = list()
    version = request.GET.get('version')
    license = request.GET.get('license') or 'community'
    os = request.GET.get('os')
    #read all builds from couchbase server
    couchbase = CbClient("localhost", 8091, "Administrator", "password")
    logger.error("connected to couchbase")
    allbuilds = couchbase.query(bucket='default', ddoc='builds', view='metadata', limit=20000)
    #logger.error(allbuilds["rows"])
    #populate builds
    #  emit(doc.name, [doc.name,doc.url,doc.fullversion,doc.arch,doc.version]);
    for item in allbuilds["rows"]:
        value = item["value"]
        if value["fullversion"].find("toy") >= 0:
            continue
        value['buildnumber'] = value["fullversion"][value["fullversion"].find("-")+1:value["fullversion"].rfind("-")]
        license_match = value["name"].find(license) > 0
        logger.error("license_match %s for %s" % (license_match, value["name"]))
        arch_display_name = ''
        if value["arch"] == "x86_64":
            arch_display_name = "64-bit"
        else:
	        arch_display_name = "32-bit"
        if version == value["version"] and os == value["os"] and license_match is True:
            artifact_item = {"name": value["name"],"url": value["url"], 
                             "fullversion": value["fullversion"],"arch": arch_display_name, 
                             "buildnumber": int(value['buildnumber']),"os": value["os"]}
            #get the manifest if it exists ?
            artifact_item["manifest"] = manifest_for_build(value["fullversion"]) or "not fond"
            artifacts.append(artifact_item)

    couchbase.close()
    os_display_name = ''
    if os == 'rpm':
        os_display_name = 'Centos'
    elif os == 'deb':
        os_display_name = 'Ubuntu'
    elif os == 'windows':
        os_display_name = 'Windows'
    title = "%s builds ( 32-bit and 64-bit) %s edition" % (os_display_name, license)
    artifacts = DataHelper.multikeysort(artifacts, ['buildnumber'])
    return render_to_response('../templates/dashboard/details.html',
            {'title': title, 'data': artifacts})