コード例 #1
0
def delete_configs(configs_ids, env_id):
    """
    Delete configs of environment

    :param configs_ids: Id of Configs of environment
    :param env: Id of environment
    """

    for config_id in configs_ids:
        IPConfig.remove(None, env_id, config_id)
    def handle_delete(self, request, user, *args, **kwargs):
        """Treat requests GET to Remove Prefix Configuration.

        URL: /environment/configuration/remove/environment_id/configuration_id/
        """
        try:

            configuration_id = kwargs.get('configuration_id')

            environment_id = kwargs.get('environment_id')

            self._validate_permission(user)

            self._validate_configuration_id(configuration_id)

            self._validate_environment_id(environment_id)

            ip_config = IPConfig.remove(
                self, user, environment_id, configuration_id)

            return self.response(dumps_networkapi({'ip_config': ip_config}))

        except PermissionError:
            return self.not_authorized()

        except IPConfigNotFoundError, e:
            self.log.error(u'IpCofig not registred')
            return self.response_error(301)
コード例 #3
0
    def handle_delete(self, request, user, *args, **kwargs):
        """Treat requests GET to Remove Prefix Configuration.

        URL: /environment/configuration/remove/environment_id/configuration_id/
        """
        try:

            configuration_id = kwargs.get('configuration_id')

            environment_id = kwargs.get('environment_id')

            self._validate_permission(user)

            self._validate_configuration_id(configuration_id)

            self._validate_environment_id(environment_id)

            ip_config = IPConfig.remove(self, user, environment_id,
                                        configuration_id)

            # remove from cidr table
            logging.debug("Remove config from cidr table.")
            Ambiente().delete_cidr([configuration_id])

            return self.response(dumps_networkapi({'ip_config': ip_config}))

        except PermissionError:
            return self.not_authorized()

        except IPConfigNotFoundError, e:
            self.log.error(u'IpCofig not registred')
            return self.response_error(301)