示例#1
0
文件: init.py 项目: paultag/lucy
def main():
    if not args.files:
        raise Exception("WTF - need a config")

    config = args.files.pop(0)
    obj = json.load(open(config, 'r'))

    machines = obj['machines']
    configs = obj['configs']
    users = obj['users']

    puts("Loading users:")
    for conf in progress.bar(users):
        u = User(**conf)
        u.save()

    puts("Loading machines:")
    for conf in progress.bar(machines):
        m = Machine(**conf)
        m.save()

    puts("Loading configs:")
    for conf in progress.bar(configs):
        c = Config(**conf)
        c.save()
示例#2
0
    def __init__(self,
                 report,
                 builder,
                 package,
                 package_type,
                 job,
                 failed,
                 source=None,
                 type=None,
                 **kwargs):

        if package_type not in ["source", "binary"]:
            raise ValueError("Bad package type")

        loaded_package = None
        if package_type == 'source':
            try:
                loaded_package = Source.load(package)
                if source is None:
                    source = loaded_package['_id']
            except KeyError:
                pass

        if package_type == 'binary':
            try:
                loaded_package = Binary.load(package)
                if source is None:
                    source = loaded_package['source']
            except KeyError:
                pass

        if loaded_package is None:
            raise KeyError("No such package")

        builder = Machine.load(builder)['_id']

        job = Job.load(job)

        if type is None:
            type = job['type']

        if source is None:
            raise ValueError("No source :(")

        super(Report, self).__init__(package_type=package_type,
                                     source=source,
                                     builder=builder,
                                     package=loaded_package['_id'],
                                     report=report,
                                     job=job['_id'],
                                     type=type,
                                     failed=failed,
                                     **kwargs)
示例#3
0
文件: job.py 项目: paultag/lucy
    def __init__(
        self,
        type,
        package,
        package_type,
        arch,
        suite,
        builder=None,
        finished_at=None,
        assigned_at=None,
        source=None,
        **kwargs
    ):

        from lucy.models.source import Source
        from lucy.models.binary import Binary

        if package_type not in ["source", "binary"]:
            raise ValueError("package_type needs to be binary or source")

        if package_type == "source":
            package = Source.load(package)
            if source is None:
                source = package["_id"]

        if package_type == "binary":
            package = Binary.load(package)
            if source is None:
                source = package["source"]

        if package is None:
            raise ValueError("Bad package")

        package = package["_id"]

        if builder:
            builder = Machine.load(builder)["_id"]

        if source is None:
            raise ValueError("Bad source :(")

        super(Job, self).__init__(
            type=type,
            arch=arch,
            suite=suite,
            source=source,
            package=package,
            builder=builder,
            finished_at=finished_at,
            assigned_at=assigned_at,
            package_type=package_type,
            **kwargs
        )
示例#4
0
文件: report.py 项目: paultag/lucy
    def __init__(self, report, builder, package,
                 package_type, job, failed,
                 source=None, type=None, **kwargs):

        if package_type not in ["source", "binary"]:
            raise ValueError("Bad package type")

        loaded_package = None
        if package_type == 'source':
            try:
                loaded_package = Source.load(package)
                if source is None:
                    source = loaded_package['_id']
            except KeyError:
                pass

        if package_type == 'binary':
            try:
                loaded_package = Binary.load(package)
                if source is None:
                    source = loaded_package['source']
            except KeyError:
                pass

        if loaded_package is None:
            raise KeyError("No such package")

        builder = Machine.load(builder)['_id']

        job = Job.load(job)

        if type is None:
            type = job['type']

        if source is None:
            raise ValueError("No source :(")

        super(Report, self).__init__(package_type=package_type,
                                     source=source,
                                     builder=builder,
                                     package=loaded_package['_id'],
                                     report=report,
                                     job=job['_id'],
                                     type=type,
                                     failed=failed,
                                     **kwargs)
示例#5
0
    def __init__(self, type, package, package_type, arch, suite,
                 builder=None, finished_at=None, assigned_at=None,
                 source=None, **kwargs):

        from lucy.models.source import Source
        from lucy.models.binary import Binary

        if package_type not in ["source", "binary"]:
            raise ValueError("package_type needs to be binary or source")

        if package_type == "source":
            package = Source.load(package)
            if source is None:
                source = package['_id']

        if package_type == "binary":
            package = Binary.load(package)
            if source is None:
                source = package['source']

        if package is None:
            raise ValueError("Bad package")

        package = package['_id']

        if builder:
            builder = Machine.load(builder)['_id']

        if source is None:
            raise ValueError("Bad source :(")

        super(Job, self).__init__(
            type=type,
            arch=arch,
            suite=suite,
            source=source,
            package=package,
            builder=builder,
            finished_at=finished_at,
            assigned_at=assigned_at,
            package_type=package_type,
            **kwargs)
示例#6
0
文件: job.py 项目: paultag/lucy
 def get_builder(self):
     builder = self.get("builder", None)
     if builder is None:
         return None
     return Machine.load(builder)
示例#7
0
 def get_builder(self):
     builder = self.get('builder', None)
     if builder is None:
         return None
     return Machine.load(builder)