Example #1
0
    def resource_list(self, up=None):
        with session_scope() as session:
            resources = QResources(session)
            if up:
                resources = resources.up()
            else:
                resources = resources.on()

            for resource in resources.all():
                msg = "{id} - {name} pool={pool} tags={tags} status={status}"
                tags = ','.join(list(resource.tag_set))
                print(
                    msg.format(
                        id=resource.id,
                        name=resource.name,
                        pool=resource.pool,
                        tags=tags,
                        status=resource.state,
                    ))
Example #2
0
    def resource_list(self, up=None):
        with session_scope() as session:
            resources = QResources(session)
            if up:
                resources = resources.up()
            else:
                resources = resources.on()

            for resource in resources.all():
                msg = ("{id} - {name} pool={pool} tags={tags} status={status} "
                       "releases={releases} ticket={ticket}")
                tags = ','.join(list(resource.tag_set))
                print(
                    msg.format(
                        id=resource.id,
                        name=resource.name,
                        pool=resource.pool,
                        tags=tags,
                        status=resource.state,
                        releases=resource.releases_counter,
                        ticket=resource.ticket.id
                        if resource.ticket else 'NULL',
                    ))