From 61bc150ae6f313bd34583b4711319566c86c470b Mon Sep 17 00:00:00 2001 From: Stefan Oderbolz Date: Wed, 10 Jun 2015 11:19:10 +0200 Subject: [PATCH] Expose clear harvester source as a paster command --- ckanext/harvest/commands/harvester.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ckanext/harvest/commands/harvester.py b/ckanext/harvest/commands/harvester.py index fadd669..75fa163 100644 --- a/ckanext/harvest/commands/harvester.py +++ b/ckanext/harvest/commands/harvester.py @@ -112,6 +112,8 @@ class Harvester(CkanCommand): self.create_harvest_source() elif cmd == "rmsource": self.remove_harvest_source() + elif cmd == 'clearsource': + self.clear_harvest_source() elif cmd == 'sources': self.list_harvest_sources() elif cmd == 'job': @@ -248,6 +250,16 @@ class Harvester(CkanCommand): get_action('harvest_source_delete')(context,{'id':source_id}) print 'Removed harvest source: %s' % source_id + def clear_harvest_source(self): + if len(self.args) >= 2: + source_id = unicode(self.args[1]) + else: + print 'Please provide a source id' + sys.exit(1) + context = {'model': model, 'user': self.admin_user['name'], 'session':model.Session} + get_action('harvest_source_clear')(context,{'id':source_id}) + print 'Cleared harvest source: %s' % source_id + def list_harvest_sources(self): if len(self.args) >= 2 and self.args[1] == 'all': data_dict = {}