Example #1
0
def process_dud(session, path):
    dud = Dud(filename=path)
    jid = dud.get("X-Debile-Job", None)
    if jid is None:
        return reject_dud(session, dud, "missing-dud-job")

    try:
        dud.validate()
    except DudFileException as e:
        return reject_dud(session, dud, "invalid-dud-upload")

    key = dud.validate_signature()

    try:
        builder = session.query(Builder).filter_by(key=key).one()
    except NoResultFound:
        return reject_dud(session, dud, "invalid-dud-builder")

    try:
        job = session.query(Job).get(jid)
    except NoResultFound:
        return reject_dud(session, dud, "invalid-dud-job")

    if dud.get("X-Debile-Failed", None) is None:
        return reject_dud(session, dud, "no-failure-notice")

    if job.builder != builder:
        return reject_dud(session, dud, "invalid-dud-uploader")

    accept_dud(session, dud, builder)
Example #2
0
def process_dud(session, path):
    dud = Dud(filename=path)
    jid = dud.get("X-Debile-Job", None)
    if jid is None:
        return reject_dud(session, dud, "missing-dud-job")

    try:
        dud.validate()
    except DudFileException as e:
        return reject_dud(session, dud, "invalid-dud-upload")

    key = dud.validate_signature()

    try:
        builder = session.query(Builder).filter_by(key=key).one()
    except NoResultFound:
        return reject_dud(session, dud, "invalid-dud-builder")

    try:
        job = session.query(Job).get(jid)
    except NoResultFound:
        return reject_dud(session, dud, "invalid-dud-job")

    if dud.get("X-Debile-Failed", None) is None:
        return reject_dud(session, dud, "no-failure-notice")

    if job.builder != builder:
        return reject_dud(session, dud, "invalid-dud-uploader")

    accept_dud(session, dud, builder)
Example #3
0
def test_dud():
    with cd("resources"):
        d = Dud()
        d.add_file("file1")
        d.add_file("file2")
        d['Created-By'] = "Test <*****@*****.**>"
        d['Source'] = "fnord"
        d['Version'] = "1.0"
        d['Architecture'] = "all"

        assert ["file1", "file2"] == list(d.files())

        d.write_dud("test.dud")