Skip to content

Commit

Permalink
remove a deprecation warning, add datasource/recipient_discard
Browse files Browse the repository at this point in the history
  • Loading branch information
lausser committed Feb 14, 2024
1 parent a28e58b commit 5beda8f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
32 changes: 32 additions & 0 deletions recipes/default/classes/datarecipient_discard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
#
# Copyright Gerhard Lausser.
# This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import logging
import coshsh
from coshsh.datarecipient import Datarecipient
from coshsh.util import compare_attr


logger = logging.getLogger('coshsh')


def __dr_ident__(params={}):
if compare_attr("type", params, "discard"):
return DrDiscard


class DrDiscard(coshsh.datarecipient.Datarecipient):
def __init__(self, **kwargs):
self.name = kwargs["name"]

def read(self, filter=None, objects={}, force=False, **kwargs):
self.objects = objects

def output(self):
# this is only used to prevent the default recipient from kicking in
pass

29 changes: 29 additions & 0 deletions recipes/default/classes/datasource_discard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
#
# Copyright Gerhard Lausser.
# This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import logging
import coshsh
from coshsh.datasource import Datasource
from coshsh.util import compare_attr


logger = logging.getLogger('coshsh')


def __ds_ident__(params={}):
if coshsh.util.compare_attr("type", params, "discard"):
return DsDiscard


class DsDiscard(coshsh.datasource.Datasource):
def __init__(self, **kwargs):
super(self.__class__, self).__init__(**kwargs)

def read(self, filter=None, objects={}, force=False, **kwargs):
self.objects = objects
for k in self.objects.keys():
self.objects[k] = {}

0 comments on commit 5beda8f

Please sign in to comment.