예제 #1
0
파일: agents.py 프로젝트: 674009287/nova
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            para = body['agent']
            url = para['url']
            md5hash = para['md5hash']
            version = para['version']
        except TypeError as e:
            raise webob.exc.HTTPBadRequest()
        except KeyError as e:
            raise webob.exc.HTTPBadRequest(explanation=_(
                "Could not find %s parameter in the request") % e.args[0])

        try:
            utils.check_string_length(url, 'url', max_length=255)
            utils.check_string_length(md5hash, 'md5hash', max_length=255)
            utils.check_string_length(version, 'version', max_length=255)
        except exception.InvalidInput as exc:
            raise webob.exc.HTTPBadRequest(explanation=exc.format_message())

        try:
            db.agent_build_update(context, id,
                                {'version': version,
                                 'url': url,
                                 'md5hash': md5hash})
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=ex.format_message())

        return {"agent": {'agent_id': id, 'version': version,
                'url': url, 'md5hash': md5hash}}
예제 #2
0
파일: agents.py 프로젝트: wingo1990/nova
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            para = body['agent']
            url = para['url']
            md5hash = para['md5hash']
            version = para['version']
        except TypeError as e:
            raise webob.exc.HTTPBadRequest()
        except KeyError as e:
            raise webob.exc.HTTPBadRequest(
                explanation=_("Could not find %s parameter in the request") %
                e.args[0])

        try:
            db.agent_build_update(context, id, {
                'version': version,
                'url': url,
                'md5hash': md5hash
            })
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=ex.format_message())

        return {
            "agent": {
                'agent_id': id,
                'version': version,
                'url': url,
                'md5hash': md5hash
            }
        }
예제 #3
0
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        para = body['agent']
        url = para['url']
        md5hash = para['md5hash']
        version = para['version']

        try:
            db.agent_build_update(context, id, {
                'version': version,
                'url': url,
                'md5hash': md5hash
            })
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=ex.format_message())

        return {
            "agent": {
                'agent_id': id,
                'version': version,
                'url': url,
                'md5hash': md5hash
            }
        }
예제 #4
0
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            para = body['para']
            url = para['url']
            md5hash = para['md5hash']
            version = para['version']
        except (TypeError, KeyError):
            raise webob.exc.HTTPUnprocessableEntity()

        try:
            db.agent_build_update(context, id, {
                'version': version,
                'url': url,
                'md5hash': md5hash
            })
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=str(ex))

        return {
            "agent": {
                'agent_id': id,
                'version': version,
                'url': url,
                'md5hash': md5hash
            }
        }
예제 #5
0
파일: agents.py 프로젝트: vasart/nova
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            para = body['para']
            url = para['url']
            md5hash = para['md5hash']
            version = para['version']
        except (TypeError, KeyError):
            raise webob.exc.HTTPUnprocessableEntity()

        try:
            utils.check_string_length(url, 'url', max_length=255)
            utils.check_string_length(md5hash, 'md5hash', max_length=255)
            utils.check_string_length(version, 'version', max_length=255)
        except exception.InvalidInput as exc:
            raise webob.exc.HTTPBadRequest(explanation=exc.format_message())

        try:
            db.agent_build_update(context, id,
                                {'version': version,
                                 'url': url,
                                 'md5hash': md5hash})
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=ex.format_message())

        # NOTE(alex_xu): The agent_id should be integer that consistent with
        # create/index actions. But parameter 'id' is string type that parsed
        # from url. This is a bug, but because back-compatibility, it can't be
        # fixed for v2 API. This will be fixed after v3 API feature exposed by
        # micro-version in the future. lp bug #1333494
        return {"agent": {'agent_id': id, 'version': version,
                'url': url, 'md5hash': md5hash}}
예제 #6
0
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            para = body['para']
            url = para['url']
            md5hash = para['md5hash']
            version = para['version']
        except (TypeError, KeyError):
            raise webob.exc.HTTPUnprocessableEntity()

        try:
            utils.check_string_length(url, 'url', max_length=255)
            utils.check_string_length(md5hash, 'md5hash', max_length=255)
            utils.check_string_length(version, 'version', max_length=255)
        except exception.InvalidInput as exc:
            raise webob.exc.HTTPBadRequest(explanation=exc.format_message())

        try:
            db.agent_build_update(context, id,
                                {'version': version,
                                 'url': url,
                                 'md5hash': md5hash})
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=ex.format_message())

        return {"agent": {'agent_id': id, 'version': version,
                'url': url, 'md5hash': md5hash}}
예제 #7
0
 def modify(self, os, architecture, version, url, md5hash,
            hypervisor='xen'):
     """Update an existing agent build."""
     ctxt = context.get_admin_context()
     agent_build_ref = db.agent_build_get_by_triple(ctxt,
                               hypervisor, os, architecture)
     db.agent_build_update(ctxt, agent_build_ref['id'],
                           {'version': version,
                            'url': url,
                            'md5hash': md5hash})
예제 #8
0
파일: agents.py 프로젝트: nobuking/nova
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ["nova.context"]
        authorize(context)

        try:
            para = body["para"]
            url = para["url"]
            md5hash = para["md5hash"]
            version = para["version"]
        except (TypeError, KeyError):
            raise webob.exc.HTTPUnprocessableEntity()

        try:
            db.agent_build_update(context, id, {"version": version, "url": url, "md5hash": md5hash})
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=str(ex))

        return {"agent": {"agent_id": id, "version": version, "url": url, "md5hash": md5hash}}
예제 #9
0
파일: agents.py 프로젝트: rrader/nova
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        para = body['agent']
        url = para['url']
        md5hash = para['md5hash']
        version = para['version']

        try:
            db.agent_build_update(context, id,
                                {'version': version,
                                 'url': url,
                                 'md5hash': md5hash})
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=ex.format_message())

        return {"agent": {'agent_id': id, 'version': version,
                'url': url, 'md5hash': md5hash}}
예제 #10
0
파일: agents.py 프로젝트: DSpeichert/nova
    def update(self, req, id, body):
        """Update an existing agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            para = body['para']
            url = para['url']
            md5hash = para['md5hash']
            version = para['version']
        except (TypeError, KeyError):
            raise webob.exc.HTTPUnprocessableEntity()

        try:
            db.agent_build_update(context, id,
                                {'version': version,
                                 'url': url,
                                 'md5hash': md5hash})
        except exception.AgentBuildNotFound as ex:
            raise webob.exc.HTTPNotFound(explanation=str(ex))

        return {"agent": {'agent_id': id, 'version': version,
                'url': url, 'md5hash': md5hash}}
예제 #11
0
파일: agent.py 프로젝트: Dynavisor/nova
 def save(self):
     updates = self.obj_get_changes()
     db.agent_build_update(self._context, self.id, updates)
     self.obj_reset_changes()
예제 #12
0
 def save(self, context):
     updates = self.obj_get_changes()
     db.agent_build_update(context, self.id, updates)
     self.obj_reset_changes()
예제 #13
0
파일: manage.py 프로젝트: comstud/nova
 def modify(self, os, architecture, version, url, md5hash, hypervisor="xen"):
     """Update an existing agent build."""
     ctxt = context.get_admin_context()
     agent_build_ref = db.agent_build_get_by_triple(ctxt, hypervisor, os, architecture)
     db.agent_build_update(ctxt, agent_build_ref["id"], {"version": version, "url": url, "md5hash": md5hash})