{"action":"created","comment":{"url":"https://api.github.com/repos/superdesk/superdesk-server/pulls/comments/22514501","id":22514501,"diff_hunk":"@@ -77,29 +77,30 @@ class UpdateIngest(superdesk.Command):\n     def run(self, provider_type=None):\n         for provider in superdesk.get_resource_service('ingest_providers').get(req=None, lookup={}):\n             if is_valid_type(provider, provider_type) and is_scheduled(provider) and not is_closed(provider):\n-                update_provider.delay(str(provider['_id']))\n+                rule_set = None\n+                if provider.get('rule_set'):\n+                    rule_set = superdesk.get_resource_service('rule_sets').find_one(_id=provider['rule_set'], req=None)\n \n+                update_provider.delay(provider, rule_set)\n \n-@celery.task\n-def update_provider(provider_id):\n-    \"\"\"Update provider by given id.\"\"\"\n-    last_updated = utcnow()\n-    provider = superdesk.get_resource_service('ingest_providers').find_one(req=None, _id=provider_id)\n \n-    superdesk.get_resource_service('ingest_providers').update(provider['_id'], {\n-        LAST_UPDATED: last_updated,\n-        app.config['ETAG']: provider.get(app.config['ETAG']),  # keep the etag\n-    })\n+@celery.task\n+def update_provider(provider, rule_set=None):\n+    \"\"\"\n+    Fetches items from ingest provider as per the configuration, ingests them into Superdesk and\n+    updates the provider.\n+    \"\"\"\n \n     for items in providers[provider.get('type')].update(provider):\n-        ingest_items(provider, items)\n+        ingest_items(items, provider, rule_set)\n \n     superdesk.get_resource_service('ingest_providers').update(provider['_id'], {\n+        LAST_UPDATED: utcnow(),\n         'config': provider.get('config', {}),  # persist changes to config if any","path":"superdesk/io/commands/update_ingest.py","position":34,"original_position":34,"commit_id":"da95a04108a08e854ded58f357b5edcc4f323b17","original_commit_id":"da95a04108a08e854ded58f357b5edcc4f323b17","user":{"login":"petrjasek","id":179249,"avatar_url":"https://avatars.githubusercontent.com/u/179249?v=3","gravatar_id":"","url":"https://api.github.com/users/petrjasek","html_url":"https://github.com/petrjasek","followers_url":"https://api.github.com/users/petrjasek/followers","following_url":"https://api.github.com/users/petrjasek/following{/other_user}","gists_url":"https://api.github.com/users/petrjasek/gists{/gist_id}","starred_url":"https://api.github.com/users/petrjasek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrjasek/subscriptions","organizations_url":"https://api.github.com/users/petrjasek/orgs","repos_url":"https://api.github.com/users/petrjasek/repos","events_url":"https://api.github.com/users/petrjasek/events{/privacy}","received_events_url":"https://api.github.com/users/petrjasek/received_events","type":"User","site_admin":false},"body":"it will be changed if not provided","created_at":"2015-01-06T09:16:15Z","updated_at":"2015-01-06T09:16:15Z","html_url":"https://github.com/superdesk/superdesk-server/pull/470#discussion_r22514501","pull_request_url":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470","_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk-server/pulls/comments/22514501"},"html":{"href":"https://github.com/superdesk/superdesk-server/pull/470#discussion_r22514501"},"pull_request":{"href":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470"}}},"pull_request":{"url":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470","id":26630174,"html_url":"https://github.com/superdesk/superdesk-server/pull/470","diff_url":"https://github.com/superdesk/superdesk-server/pull/470.diff","patch_url":"https://github.com/superdesk/superdesk-server/pull/470.patch","issue_url":"https://api.github.com/repos/superdesk/superdesk-server/issues/470","number":470,"state":"open","locked":false,"title":"(feat) Ingest configurations should be committed gracefully","user":{"login":"sivakuna-aap","id":8649779,"avatar_url":"https://avatars.githubusercontent.com/u/8649779?v=3","gravatar_id":"","url":"https://api.github.com/users/sivakuna-aap","html_url":"https://github.com/sivakuna-aap","followers_url":"https://api.github.com/users/sivakuna-aap/followers","following_url":"https://api.github.com/users/sivakuna-aap/following{/other_user}","gists_url":"https://api.github.com/users/sivakuna-aap/gists{/gist_id}","starred_url":"https://api.github.com/users/sivakuna-aap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivakuna-aap/subscriptions","organizations_url":"https://api.github.com/users/sivakuna-aap/orgs","repos_url":"https://api.github.com/users/sivakuna-aap/repos","events_url":"https://api.github.com/users/sivakuna-aap/events{/privacy}","received_events_url":"https://api.github.com/users/sivakuna-aap/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-12-29T01:55:24Z","updated_at":"2015-01-06T09:16:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"288a0c0bb4b6405673b8a478777972c5e389cace","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470/commits","review_comments_url":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470/comments","review_comment_url":"https://api.github.com/repos/superdesk/superdesk-server/pulls/comments/{number}","comments_url":"https://api.github.com/repos/superdesk/superdesk-server/issues/470/comments","statuses_url":"https://api.github.com/repos/superdesk/superdesk-server/statuses/da95a04108a08e854ded58f357b5edcc4f323b17","head":{"label":"sivakuna-aap:sd-1228","ref":"sd-1228","sha":"da95a04108a08e854ded58f357b5edcc4f323b17","user":{"login":"sivakuna-aap","id":8649779,"avatar_url":"https://avatars.githubusercontent.com/u/8649779?v=3","gravatar_id":"","url":"https://api.github.com/users/sivakuna-aap","html_url":"https://github.com/sivakuna-aap","followers_url":"https://api.github.com/users/sivakuna-aap/followers","following_url":"https://api.github.com/users/sivakuna-aap/following{/other_user}","gists_url":"https://api.github.com/users/sivakuna-aap/gists{/gist_id}","starred_url":"https://api.github.com/users/sivakuna-aap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivakuna-aap/subscriptions","organizations_url":"https://api.github.com/users/sivakuna-aap/orgs","repos_url":"https://api.github.com/users/sivakuna-aap/repos","events_url":"https://api.github.com/users/sivakuna-aap/events{/privacy}","received_events_url":"https://api.github.com/users/sivakuna-aap/received_events","type":"User","site_admin":false},"repo":{"id":26628238,"name":"superdesk-server","full_name":"sivakuna-aap/superdesk-server","owner":{"login":"sivakuna-aap","id":8649779,"avatar_url":"https://avatars.githubusercontent.com/u/8649779?v=3","gravatar_id":"","url":"https://api.github.com/users/sivakuna-aap","html_url":"https://github.com/sivakuna-aap","followers_url":"https://api.github.com/users/sivakuna-aap/followers","following_url":"https://api.github.com/users/sivakuna-aap/following{/other_user}","gists_url":"https://api.github.com/users/sivakuna-aap/gists{/gist_id}","starred_url":"https://api.github.com/users/sivakuna-aap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivakuna-aap/subscriptions","organizations_url":"https://api.github.com/users/sivakuna-aap/orgs","repos_url":"https://api.github.com/users/sivakuna-aap/repos","events_url":"https://api.github.com/users/sivakuna-aap/events{/privacy}","received_events_url":"https://api.github.com/users/sivakuna-aap/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sivakuna-aap/superdesk-server","description":"Superdesk API server for ui devs","fork":true,"url":"https://api.github.com/repos/sivakuna-aap/superdesk-server","forks_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/forks","keys_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/teams","hooks_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/hooks","issue_events_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/issues/events{/number}","events_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/events","assignees_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/assignees{/user}","branches_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/branches{/branch}","tags_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/tags","blobs_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/statuses/{sha}","languages_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/languages","stargazers_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/stargazers","contributors_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/contributors","subscribers_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/subscribers","subscription_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/subscription","commits_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/contents/{+path}","compare_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/merges","archive_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/downloads","issues_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/issues{/number}","pulls_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/pulls{/number}","milestones_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/milestones{/number}","notifications_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/labels{/name}","releases_url":"https://api.github.com/repos/sivakuna-aap/superdesk-server/releases{/id}","created_at":"2014-11-14T07:53:48Z","updated_at":"2015-01-05T20:45:49Z","pushed_at":"2015-01-05T20:49:11Z","git_url":"git://github.com/sivakuna-aap/superdesk-server.git","ssh_url":"git@github.com:sivakuna-aap/superdesk-server.git","clone_url":"https://github.com/sivakuna-aap/superdesk-server.git","svn_url":"https://github.com/sivakuna-aap/superdesk-server","homepage":"","size":44266,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"superdesk:master","ref":"master","sha":"c46a04ca737becc80e383f6d1c26f434e671e957","user":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"repo":{"id":10975025,"name":"superdesk-server","full_name":"superdesk/superdesk-server","owner":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/superdesk/superdesk-server","description":"Superdesk API server for ui devs","fork":false,"url":"https://api.github.com/repos/superdesk/superdesk-server","forks_url":"https://api.github.com/repos/superdesk/superdesk-server/forks","keys_url":"https://api.github.com/repos/superdesk/superdesk-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superdesk/superdesk-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superdesk/superdesk-server/teams","hooks_url":"https://api.github.com/repos/superdesk/superdesk-server/hooks","issue_events_url":"https://api.github.com/repos/superdesk/superdesk-server/issues/events{/number}","events_url":"https://api.github.com/repos/superdesk/superdesk-server/events","assignees_url":"https://api.github.com/repos/superdesk/superdesk-server/assignees{/user}","branches_url":"https://api.github.com/repos/superdesk/superdesk-server/branches{/branch}","tags_url":"https://api.github.com/repos/superdesk/superdesk-server/tags","blobs_url":"https://api.github.com/repos/superdesk/superdesk-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superdesk/superdesk-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superdesk/superdesk-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/superdesk/superdesk-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superdesk/superdesk-server/statuses/{sha}","languages_url":"https://api.github.com/repos/superdesk/superdesk-server/languages","stargazers_url":"https://api.github.com/repos/superdesk/superdesk-server/stargazers","contributors_url":"https://api.github.com/repos/superdesk/superdesk-server/contributors","subscribers_url":"https://api.github.com/repos/superdesk/superdesk-server/subscribers","subscription_url":"https://api.github.com/repos/superdesk/superdesk-server/subscription","commits_url":"https://api.github.com/repos/superdesk/superdesk-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/superdesk/superdesk-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/superdesk/superdesk-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/superdesk/superdesk-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/superdesk/superdesk-server/contents/{+path}","compare_url":"https://api.github.com/repos/superdesk/superdesk-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superdesk/superdesk-server/merges","archive_url":"https://api.github.com/repos/superdesk/superdesk-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superdesk/superdesk-server/downloads","issues_url":"https://api.github.com/repos/superdesk/superdesk-server/issues{/number}","pulls_url":"https://api.github.com/repos/superdesk/superdesk-server/pulls{/number}","milestones_url":"https://api.github.com/repos/superdesk/superdesk-server/milestones{/number}","notifications_url":"https://api.github.com/repos/superdesk/superdesk-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superdesk/superdesk-server/labels{/name}","releases_url":"https://api.github.com/repos/superdesk/superdesk-server/releases{/id}","created_at":"2013-06-26T18:02:40Z","updated_at":"2015-01-05T10:37:10Z","pushed_at":"2015-01-05T10:37:10Z","git_url":"git://github.com/superdesk/superdesk-server.git","ssh_url":"git@github.com:superdesk/superdesk-server.git","clone_url":"https://github.com/superdesk/superdesk-server.git","svn_url":"https://github.com/superdesk/superdesk-server","homepage":"","size":47568,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":7,"forks":23,"open_issues":7,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470"},"html":{"href":"https://github.com/superdesk/superdesk-server/pull/470"},"issue":{"href":"https://api.github.com/repos/superdesk/superdesk-server/issues/470"},"comments":{"href":"https://api.github.com/repos/superdesk/superdesk-server/issues/470/comments"},"review_comments":{"href":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470/comments"},"review_comment":{"href":"https://api.github.com/repos/superdesk/superdesk-server/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/superdesk/superdesk-server/pulls/470/commits"},"statuses":{"href":"https://api.github.com/repos/superdesk/superdesk-server/statuses/da95a04108a08e854ded58f357b5edcc4f323b17"}}}}