Example #1
0
 def create(self, os, architecture, version, url, md5hash,
             hypervisor='xen'):
     """Creates a new agent build."""
     ctxt = context.get_admin_context()
     db.agent_build_create(ctxt, {'hypervisor': hypervisor,
                                  'os': os,
                                  'architecture': architecture,
                                  'version': version,
                                  'url': url,
                                  'md5hash': md5hash})
Example #2
0
 def create(self):
     updates = self.obj_get_changes()
     if 'id' in updates:
         raise exception.ObjectActionError(action='create',
                                           reason='Already Created')
     db_agent = db.agent_build_create(self._context, updates)
     self._from_db_object(self._context, self, db_agent)
Example #3
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

        agent = body['agent']
        hypervisor = agent['hypervisor']
        os = agent['os']
        architecture = agent['architecture']
        version = agent['version']
        url = agent['url']
        md5hash = agent['md5hash']

        try:
            agent_build_ref = db.agent_build_create(
                context, {
                    'hypervisor': hypervisor,
                    'os': os,
                    'architecture': architecture,
                    'version': version,
                    'url': url,
                    'md5hash': md5hash
                })
            agent['agent_id'] = agent_build_ref.id
        except exception.AgentBuildExists as ex:
            raise webob.exc.HTTPConflict(explanation=ex.format_message())
        return {'agent': agent}
Example #4
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            agent = body['agent']
            hypervisor = agent['hypervisor']
            os = agent['os']
            architecture = agent['architecture']
            version = agent['version']
            url = agent['url']
            md5hash = agent['md5hash']
        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:
            agent_build_ref = db.agent_build_create(context,
                                                {'hypervisor': hypervisor,
                                                 'os': os,
                                                 'architecture': architecture,
                                                 'version': version,
                                                 'url': url,
                                                 'md5hash': md5hash})
            agent['agent_id'] = agent_build_ref.id
        except exception.AgentBuildExists as ex:
            raise webob.exc.HTTPConflict(explanation=ex.format_message())
        return {'agent': agent}
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

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

        try:
            agent_build_ref = db.agent_build_create(context,
                                                {'hypervisor': hypervisor,
                                                 'os': os,
                                                 'architecture': architecture,
                                                 'version': version,
                                                 'url': url,
                                                 'md5hash': md5hash})
            agent['agent_id'] = agent_build_ref.id
        except Exception as ex:
            raise webob.exc.HTTPServerError(str(ex))
        return {'agent': agent}
Example #6
0
 def create(self, context):
     updates = self.obj_get_changes()
     if 'id' in updates:
         raise exception.ObjectActionError(action='create',
                                           reason='Already Created')
     db_agent = db.agent_build_create(context, updates)
     self._from_db_object(context, self, db_agent)
Example #7
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

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

        try:
            agent_build_ref = db.agent_build_create(
                context, {
                    'hypervisor': hypervisor,
                    'os': os,
                    'architecture': architecture,
                    'version': version,
                    'url': url,
                    'md5hash': md5hash
                })
            agent['agent_id'] = agent_build_ref.id
        except Exception as ex:
            raise webob.exc.HTTPServerError(str(ex))
        return {'agent': agent}
Example #8
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

        agent = body['agent']
        hypervisor = agent['hypervisor']
        os = agent['os']
        architecture = agent['architecture']
        version = agent['version']
        url = agent['url']
        md5hash = agent['md5hash']

        try:
            agent_build_ref = db.agent_build_create(context,
                                                {'hypervisor': hypervisor,
                                                 'os': os,
                                                 'architecture': architecture,
                                                 'version': version,
                                                 'url': url,
                                                 'md5hash': md5hash})
            agent['agent_id'] = agent_build_ref.id
        except exception.AgentBuildExists as ex:
            raise webob.exc.HTTPConflict(explanation=ex.format_message())
        return {'agent': agent}
Example #9
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ["nova.context"]
        authorize(context)

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

        try:
            agent_build_ref = db.agent_build_create(
                context,
                {
                    "hypervisor": hypervisor,
                    "os": os,
                    "architecture": architecture,
                    "version": version,
                    "url": url,
                    "md5hash": md5hash,
                },
            )
            agent["agent_id"] = agent_build_ref.id
        except Exception as ex:
            raise webob.exc.HTTPServerError(str(ex))
        return {"agent": agent}
Example #10
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

        try:
            agent = body['agent']
            hypervisor = agent['hypervisor']
            os = agent['os']
            architecture = agent['architecture']
            version = agent['version']
            url = agent['url']
            md5hash = agent['md5hash']
        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:
            agent_build_ref = db.agent_build_create(
                context, {
                    'hypervisor': hypervisor,
                    'os': os,
                    'architecture': architecture,
                    'version': version,
                    'url': url,
                    'md5hash': md5hash
                })
            agent['agent_id'] = agent_build_ref.id
        except exception.AgentBuildExists as ex:
            raise webob.exc.HTTPConflict(explanation=ex.format_message())
        return {'agent': agent}
Example #11
0
 def create(self,
            os,
            architecture,
            version,
            url,
            md5hash,
            hypervisor='xen'):
     """Creates a new agent build."""
     ctxt = context.get_admin_context()
     db.agent_build_create(
         ctxt, {
             'hypervisor': hypervisor,
             'os': os,
             'architecture': architecture,
             'version': version,
             'url': url,
             'md5hash': md5hash
         })
Example #12
0
 def create(self, os, architecture, version, url, md5hash, hypervisor="xen"):
     """Creates a new agent build."""
     ctxt = context.get_admin_context()
     agent_build = db.agent_build_create(
         ctxt,
         {
             "hypervisor": hypervisor,
             "os": os,
             "architecture": architecture,
             "version": version,
             "url": url,
             "md5hash": md5hash,
         },
     )
Example #13
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

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

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

        try:
            agent_build_ref = db.agent_build_create(
                context, {
                    'hypervisor': hypervisor,
                    'os': os,
                    'architecture': architecture,
                    'version': version,
                    'url': url,
                    'md5hash': md5hash
                })
            agent['agent_id'] = agent_build_ref.id
        except Exception as ex:
            raise webob.exc.HTTPServerError(str(ex))
        return {'agent': agent}
Example #14
0
    def create(self, req, body):
        """Creates a new agent build."""
        context = req.environ['nova.context']
        authorize(context)

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

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

        try:
            agent_build_ref = db.agent_build_create(context,
                                                {'hypervisor': hypervisor,
                                                 'os': os,
                                                 'architecture': architecture,
                                                 'version': version,
                                                 'url': url,
                                                 'md5hash': md5hash})
            agent['agent_id'] = agent_build_ref.id
        except Exception as ex:
            raise webob.exc.HTTPServerError(str(ex))
        return {'agent': agent}
Example #15
0
 def create(self, context):
     updates = self.obj_get_changes()
     if "id" in updates:
         raise exception.ObjectActionError(action="create", reason="Already Created")
     db_agent = db.agent_build_create(context, updates)
     self._from_db_object(context, self, db_agent)