@requires_rw
    def remove_prefix(self, auth, spec, recursive = False):

        self._logger.debug("remove_prefix called; spec: %s" % str(spec))

        # sanity check - do we have all attributes?
        if 'id' in spec:
            # recursive requires a prefix, so translate id to prefix
            p = self.list_prefix(auth, spec)[0]
            del spec['id']
            spec['prefix'] = p['prefix']
            spec['vrf_id'] = p['vrf_id']
        elif 'prefix' in spec:
            pass
        else:
            raise NipapMissingInputError('missing prefix or id of prefix')

        prefixes = self.list_prefix(auth, spec)

        if recursive:
            spec['type'] = 'host'
            self._db_remove_prefix(spec, recursive)
            del spec['type']
            self._db_remove_prefix(spec, recursive)
        else:
            self._db_remove_prefix(spec)

        # write to audit table
        audit_params = {
            'username': auth.username,
            'authenticated_as': auth.authenticated_as,
            'full_name': auth.full_name,
            'authoritative_source': auth.authoritative_source
        }
        for p in prefixes:
            audit_params['prefix_id'] = p['id']
            audit_params['prefix_prefix'] = p['prefix']
            audit_params['description'] = 'Removed prefix %s' % p['prefix']
            audit_params['vrf_id'] = p['vrf_id']
            audit_params['vrf_rt'] = p['vrf_rt']
            audit_params['vrf_name'] = p['vrf_name']
            sql, params = self._sql_expand_insert(audit_params)
            self._execute('INSERT INTO ip_net_log %s' % sql, params)

            if p['pool_id'] is not None:
                pool = self._get_pool(auth, { 'id': p['pool_id'] })
                audit_params2 = {
                    'pool_id': pool['id'],
                    'pool_name': pool['name'],
                    'prefix_id': p['id'],
                    'prefix_prefix': p['prefix'],
                    'description': 'Prefix %s removed from pool %s' % (p['prefix'], pool['name']),
                    'username': auth.username,
                    'authenticated_as': auth.authenticated_as,
                    'full_name': auth.full_name,
                    'authoritative_source': auth.authoritative_source
                }
                sql, params = self._sql_expand_insert(audit_params2)
                self._execute('INSERT INTO ip_net_log %s' % sql, params)
Create a new serial job given a taskmaster.
dataset/ETHPy150Open SpriteLink/NIPAP/nipap/nipap/backend.py/Nipap.remove_prefix--crossover with--dataset/ETHPy150Open kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Job.py/Serial.__init__