Bug 787682

Summary: Assigning sync plan to a product fails after repo sync
Product: Red Hat Satellite Reporter: Tomas Strachota <tstrachota>
Component: APIAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Og Maciel <omaciel>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: omaciel
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 18:24:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Tomas Strachota 2012-02-06 14:06:16 UTC
Description of problem:

When a sync plan is assigned to a product with a repository that has been synchronized by immediate sync it fails. This happens only for the first time when we run the command. Next attempts are successful.


Version-Release number of selected component (if applicable):
katello-0.1.219-1
katello-cli-0.1.50-1

Steps to Reproduce:
1. create a product with repo
2. create a sync plan
3. sync the repo
4. try to set sync plan for the product
  
Actual results:
Fails in Pulp with error "'NoneType' object has no attribute 'items'"

Expected results:
Should set new synchronization time to all product repositories.

Katello API Traceback:
exception when talking to a remote client: Pulp::Repository: 500 Internal Server Error "Traceback (most recent call last):\n  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py\", line 48, in report_error\n    return method(self, *args, **kwargs)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py\", line 127, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py\", line 753, in PUT\n    scheduled_sync.update_repo_schedule(repo, new_schedule, new_options)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py\", line 254, in update_repo_schedule\n    _update_repo_scheduled_sync_task(repo, task)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py\", line 201, in _update_repo_scheduled_sync_task\n    return async.reschedule_async(task, new_scheduler)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/async.py\", line 106, in reschedule_async\n    return _queue.reschedule(task, scheduler)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/taskqueue/queue.py\", line 374, in reschedule\n    self.enqueue(task)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/taskqueue/queue.py\", line 262, in enqueue\n    task.schedule() # UnscheduledTaskException\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 382, in schedule\n    _log.warn(_('%s missed %d scheduled runs') % (str(self), adjustments - 1))\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 213, in __str__\n    return 'Task %s: %s(%s, %s)' % (self.id, _name(), _args(), _kwargs())\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 199, in _kwargs\n    return ', '.join(['='.join((str(k), str(v))) for k, v in self.kwargs.items()])\nAttributeError: 'NoneType' object has no attribute 'items'\n" (PUT /pulp/api/repositories/ACME_Corporation-zoo-zoo/schedules/sync/) RestClient::InternalServerError: Pulp::Repository: 500 Internal Server Error "Traceback (most recent call last):\n  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py\", line 48, in report_error\n    return method(self, *args, **kwargs)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/decorators.py\", line 127, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py\", line 753, in PUT\n    scheduled_sync.update_repo_schedule(repo, new_schedule, new_options)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py\", line 254, in update_repo_schedule\n    _update_repo_scheduled_sync_task(repo, task)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py\", line 201, in _update_repo_scheduled_sync_task\n    return async.reschedule_async(task, new_scheduler)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/async.py\", line 106, in reschedule_async\n    return _queue.reschedule(task, scheduler)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/taskqueue/queue.py\", line 374, in reschedule\n    self.enqueue(task)\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/taskqueue/queue.py\", line 262, in enqueue\n    task.schedule() # UnscheduledTaskException\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 382, in schedule\n    _log.warn(_('%s missed %d scheduled runs') % (str(self), adjustments - 1))\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 213, in __str__\n    return 'Task %s: %s(%s, %s)' % (self.id, _name(), _args(), _kwargs())\n  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 199, in _kwargs\n    return ', '.join(['='.join((str(k), str(v))) for k, v in self.kwargs.items()])\nAttributeError: 'NoneType' object has no attribute 'items'\n" (PUT /pulp/api/repositories/ACME_Corporation-zoo-zoo/schedules/sync/)
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/resource.rb:80:in `put'
/home/tstracho/Work/katello/src/lib/http_resource.rb:119:in `put'
/home/tstracho/Work/katello/src/lib/resources/pulp.rb:215:in `update_schedule'
/home/tstracho/Work/katello/src/app/models/glue/pulp/repo.rb:328:in `set_sync_schedule'
/home/tstracho/Work/katello/src/app/models/glue/pulp/repos.rb:379:in `setup_sync_schedule'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/relation.rb:13:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/relation.rb:13:in `__send__'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/relation.rb:13:in `each'
/home/tstracho/Work/katello/src/app/models/glue/pulp/repos.rb:378:in `setup_sync_schedule'
/home/tstracho/Work/katello/src/app/models/glue.rb:138:in `send'
/home/tstracho/Work/katello/src/app/models/glue.rb:138:in `execute'
/home/tstracho/Work/katello/src/app/models/glue.rb:97:in `process'
/home/tstracho/Work/katello/src/app/models/glue.rb:93:in `each'
/home/tstracho/Work/katello/src/app/models/glue.rb:93:in `process'
/home/tstracho/Work/katello/src/app/models/glue.rb:32:in `on_save'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:220:in `_conditional_callback_around_930'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:424:in `_run_save_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/callbacks.rb:273:in `create_or_update'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/persistence.rb:60:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/validations.rb:49:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:245:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:292:in `with_transaction_returning_status'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:207:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:245:in `save!'
/home/tstracho/Work/katello/src/app/models/lazy_accessor.rb:108:in `save!'
/home/tstracho/Work/katello/src/app/controllers/api/products_controller.rb:75:in `set_sync_plan'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:150:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rendering.rb:11:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:18:in `process_action'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:452:in `_run__569591491__process_action__1656564938__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:221:in `_conditional_callback_around_2679'
/home/tstracho/Work/katello/src/lib/util/threadsession.rb:79:in `thread_locals'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:220:in `_conditional_callback_around_2679'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:441:in `_run__569591491__process_action__1656564938__callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `run_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rescue.rb:17:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:119:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:41:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:138:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:178:in `action'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:27:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:148:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:93:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:103:in `optimized_each'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/code_generation.rb:92:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rack-mount-0.6.14/lib/rack/mount/route_set.rb:139:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:493:in `call'
/usr/lib/ruby/gems/1.8/gems/warden-1.1.0/lib/warden/manager.rb:35:in `call'
/usr/lib/ruby/gems/1.8/gems/warden-1.1.0/lib/warden/manager.rb:34:in `catch'
/usr/lib/ruby/gems/1.8/gems/warden-1.1.0/lib/warden/manager.rb:34:in `call'
/usr/lib/ruby/gems/1.8/gems/sass-3.1.12/lib/sass/../sass/plugin/rack.rb:54:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/head.rb:14:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/flash.rb:182:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/cookies.rb:302:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:32:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:12:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:31:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:46:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/sendfile.rb:106:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/rack/logger.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/runtime.rb:17:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/lock.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/lock.rb:13:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/lock.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:168:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `send'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/urlmap.rb:47:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/urlmap.rb:41:in `each'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/urlmap.rb:41:in `call'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/rack/log_tailer.rb:14:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/content_length.rb:13:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/handler/webrick.rb:52:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/handler/webrick.rb:13:in `run'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/server.rb:217:in `start'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/commands/server.rb:65:in `start'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/commands.rb:30
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/commands.rb:27:in `tap'
/usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/commands.rb:27
./script/rails:45:in `require'
./script/rails:45

Comment 1 Tomas Strachota 2012-02-13 13:10:09 UTC
I'm working on 788073 and this bug seems to be related. I'm taking it as well.

Comment 2 Tomas Strachota 2012-02-14 12:44:47 UTC
It turned out to be issue in Pulp. It appears only when you try to schedule sync in past.

I'll file new bug against Pulp and add constraint in Katello.

Comment 3 Tomas Strachota 2012-02-14 22:18:18 UTC
Waiting for this bug 790602 to be fixed in Pulp.

Comment 4 Tomas Strachota 2012-03-01 12:56:41 UTC
Fixed with Pulp v1.

Comment 5 Og Maciel 2012-03-01 16:54:06 UTC
Validated:
* candlepin-0.5.23-1.el6.noarch
* candlepin-tomcat6-0.5.23-1.el6.noarch
* katello-0.1.300-1.el6.noarch
* katello-all-0.1.300-1.el6.noarch
* katello-certs-tools-1.0.2-2.el6.noarch
* katello-cli-0.1.100-2.el6.noarch
* katello-cli-common-0.1.100-2.el6.noarch
* katello-common-0.1.300-1.el6.noarch
* katello-configure-0.1.100-7.el6.noarch
* katello-glue-candlepin-0.1.300-1.el6.noarch
* katello-glue-foreman-0.1.300-1.el6.noarch
* katello-glue-pulp-0.1.300-1.el6.noarch
* katello-httpd-ssl-key-pair-1.0-1.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-repos-0.1.5-1.el6.noarch
* katello-selinux-0.1.7-1.el6.noarch
* katello-trusted-ssl-cert-1.0-1.noarch
* pulp-1.0.0-4.el6.noarch
* pulp-common-1.0.0-4.el6.noarch
* pulp-selinux-server-1.0.0-4.el6.noarch