Example #1
0
    def index(self, req):
        """
        Return a list of all agent builds. Filter by hypervisor.
        """
        context = req.environ["nova.context"]
        authorize(context)
        hypervisor = None
        agents = []
        if "hypervisor" in req.GET:
            hypervisor = req.GET["hypervisor"]

        for agent_build in db.agent_build_get_all(context, hypervisor):
            agents.append(
                {
                    "hypervisor": agent_build.hypervisor,
                    "os": agent_build.os,
                    "architecture": agent_build.architecture,
                    "version": agent_build.version,
                    "md5hash": agent_build.md5hash,
                    "agent_id": agent_build.id,
                    "url": agent_build.url,
                }
            )

        return {"agents": agents}
Example #2
0
    def list(self, hypervisor=None):
        """Lists all agent builds.
        arguments: <none>"""
        fmt = "%-10s  %-8s  %12s  %s"
        ctxt = context.get_admin_context()
        by_hypervisor = {}
        for agent_build in db.agent_build_get_all(ctxt):
            buildlist = by_hypervisor.get(agent_build.hypervisor)
            if not buildlist:
                buildlist = by_hypervisor[agent_build.hypervisor] = []

            buildlist.append(agent_build)

        for key, buildlist in by_hypervisor.iteritems():
            if hypervisor and key != hypervisor:
                continue

            print _('Hypervisor: %s') % key
            print fmt % ('-' * 10, '-' * 8, '-' * 12, '-' * 32)
            for agent_build in buildlist:
                print fmt % (agent_build.os, agent_build.architecture,
                             agent_build.version, agent_build.md5hash)
                print '    %s' % agent_build.url

            print
Example #3
0
    def index(self, req):
        """Return a list of all agent builds. Filter by hypervisor."""
        context = req.environ['nova.context']
        authorize(context)
        hypervisor = None
        agents = []
        if 'hypervisor' in req.GET:
            hypervisor = req.GET['hypervisor']

        for agent_build in db.agent_build_get_all(context, hypervisor):
            agents.append({'hypervisor': agent_build.hypervisor,
                           'os': agent_build.os,
                           'architecture': agent_build.architecture,
                           'version': agent_build.version,
                           'md5hash': agent_build.md5hash,
                           'agent_id': agent_build.id,
                           'url': agent_build.url})

        return {'agents': agents}
Example #4
0
    def index(self, req):
        """Return a list of all agent builds. Filter by hypervisor."""
        context = req.environ['nova.context']
        authorize(context)
        hypervisor = None
        agents = []
        if 'hypervisor' in req.GET:
            hypervisor = req.GET['hypervisor']

        for agent_build in db.agent_build_get_all(context, hypervisor):
            agents.append({'hypervisor': agent_build.hypervisor,
                           'os': agent_build.os,
                           'architecture': agent_build.architecture,
                           'version': agent_build.version,
                           'md5hash': agent_build.md5hash,
                           'agent_id': agent_build.id,
                           'url': agent_build.url})

        return {'agents': agents}
Example #5
0
 def get_all(cls, context, hypervisor=None):
     db_agents = db.agent_build_get_all(context, hypervisor=hypervisor)
     return base.obj_make_list(context, cls(), objects.Agent, db_agents)
Example #6
0
 def get_all(cls, context, hypervisor=None):
     db_agents = db.agent_build_get_all(context, hypervisor=hypervisor)
     return base.obj_make_list(context, cls(), objects.Agent, db_agents)