Example #1
0
    def put(self, env):
        """Update an environment.

        :param env: Required. Environment structure to update
        """
        acl.enforce('environments:update', context.ctx())

        if not env.name:
            raise exceptions.InputException(
                'Name of the environment is not provided.'
            )

        LOG.info("Update environment [name=%s, env=%s]", env.name, env)

        definition = json.loads(wsme_pecan.pecan.request.body.decode())
        definition.pop('name')

        self._validate_environment(
            definition,
            ['description', 'variables', 'scope']
        )

        db_model = db_api.update_environment(env.name, env.to_dict())

        return resources.Environment.from_db_model(db_model)
Example #2
0
    def put(self, environment):
        """Update an environment."""
        if not environment.name:
            raise ValueError('Name of the environment is not provided.')

        LOG.info("Update environment [name=%s, env=%s]" %
                 (environment.name, environment))

        db_model = db_api.update_environment(environment.name,
                                             environment.to_dict())

        return Environment(**db_model.to_dict())
Example #3
0
    def put(self, environment):
        """Update an environment."""
        if not environment.name:
            raise exceptions.InputException(
                'Name of the environment is not provided.')

        LOG.info("Update environment [name=%s, env=%s]" %
                 (environment.name, environment))
        definition = json.loads(wsme_pecan.pecan.request.body)
        definition.pop('name')
        self._validate_environment(definition,
                                   ['description', 'variables', 'scope'])
        db_model = db_api.update_environment(environment.name,
                                             environment.to_dict())

        return Environment(**db_model.to_dict())
Example #4
0
    def put(self, env):
        """Update an environment."""
        if not env.name:
            raise exceptions.InputException(
                'Name of the environment is not provided.'
            )

        LOG.info("Update environment [name=%s, env=%s]" % (env.name, env))

        definition = json.loads(wsme_pecan.pecan.request.body.decode())
        definition.pop('name')

        self._validate_environment(
            definition,
            ['description', 'variables', 'scope']
        )

        db_model = db_api.update_environment(env.name, env.to_dict())

        return Environment.from_dict(db_model.to_dict())