Ejemplo n.º 1
0
 def authenticate_machine(self, machine, password):
     machine = Machine.load(machine)
     if machine.auth(password):
         NAMESPACE.machine = machine
         machine.ping()
         return True
     return False
Ejemplo n.º 2
0
 def authenticate_machine(self, machine, password):
     machine = Machine.load(machine)
     if machine.auth(password):
         NAMESPACE.machine = machine
         machine.ping()
         return True
     return False
Ejemplo n.º 3
0
def accept_binary(config, changes):
    key = changes.validate_signature()

    arch = changes['Architecture']
    if " " in arch:
        arches = set(arch.split(" "))
        if "all" in arches:
            arches.remove("all")

        arches = list(arches)
        if len(arches) != 1:
            return reject(config, changes, 'too-many-arches')

        arch = changes._data['Architecture'] = arches[0]


    suite = changes['Distribution']
    binaries = changes.get_files()

    try:
        job = changes['x-lucy-job']
    except KeyError:
        return reject(config, changes, 'no-job')

    try:
        job = Job.load(job)
    except KeyError:
        return reject(config, changes, 'invalid-job')

    try:
        buildd = Machine.get_by_key(key)
    except KeyError:
        return reject(config, changes, 'youre-not-a-machine')

    binary = Binary(job=job['_id'],
                    arch=arch,
                    suite=suite,
                    binaries=[os.path.basename(x) for x in binaries],
                    builder=buildd['_id'])
    binary.save()
    add_jobs(binary, 'binary', config, 'binary', changes)

    path = move_to_pool(config, binary['source'], changes, root=arch)
    os.unlink(changes.get_filename())
    print("accept binary")
Ejemplo n.º 4
0
def accept_binary(config, changes):
    key = changes.validate_signature()

    arch = changes['Architecture']
    if " " in arch:
        arches = set(arch.split(" "))
        if "all" in arches:
            arches.remove("all")

        arches = list(arches)
        if len(arches) != 1:
            return reject(config, changes, 'too-many-arches')

        arch = changes._data['Architecture'] = arches[0]

    suite = changes['Distribution']
    binaries = changes.get_files()

    try:
        job = changes['x-lucy-job']
    except KeyError:
        return reject(config, changes, 'no-job')

    try:
        job = Job.load(job)
    except KeyError:
        return reject(config, changes, 'invalid-job')

    try:
        buildd = Machine.get_by_key(key)
    except KeyError:
        return reject(config, changes, 'youre-not-a-machine')

    binary = Binary(job=job['_id'],
                    arch=arch,
                    suite=suite,
                    binaries=[os.path.basename(x) for x in binaries],
                    builder=buildd['_id'])
    binary.save()
    add_jobs(binary, 'binary', config, 'binary', changes)

    path = move_to_pool(config, binary['source'], changes, root=arch)
    os.unlink(changes.get_filename())
    print("accept binary")