Bug 1032132

Summary: puppet repo sync cancel failing
Product: [Retired] Pulp Reporter: Preethi Thomas <pthomas>
Component: puppet-supportAssignee: Jason Connor <jconnor>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.3CC: jortel, mhrivnak, mmccune
Target Milestone: ---Keywords: Triaged
Target Release: 2.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-09 14:31:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Preethi Thomas 2013-11-19 15:32:06 UTC
Description of problem:

Looks like puppet repo sync cancel is not working


Version-Release number of selected component (if applicable):
[root@dell-pe2950-01 ~]# rpm -qa |grep pulp-server
pulp-server-2.3.0-0.36.beta.el6.noarch
[root@dell-pe2950-01 ~]# 


How reproducible:


Steps to Reproduce:
1. Try to cancel a running puppet sync 
2.
3.

Actual results:
[root@dell-pe2950-01 ~]# pulp-admin tasks cancel --task-id ca847b74-8317-484d-b7f6-ebb6c13fbc76
The requested task does not support cancellation.



Expected results:


Additional info:

from pulp.log

2013-11-19 10:10:45,869 pulp.server.dispatch.task:ERROR: cancel() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/dispatch/task.py", line 263, in cancel
    self._call_cancel_control_hook()
  File "/usr/lib/python2.6/site-packages/pulp/server/dispatch/task.py", line 283, in _call_cancel_control_hook
    cancel_hook(self.call_request, self.call_report)
  File "/usr/lib/python2.6/site-packages/pulp_puppet/plugins/importers/importer.py", line 82, in cancel_sync_repo
    sync_runner.cancel_sync()
  File "/usr/lib/python2.6/site-packages/pulp_puppet/plugins/importers/sync.py", line 94, in cancel_sync
    downloader.cancel()
TypeError: cancel() takes exactly 2 arguments (1 given)
2013-11-19 10:10:45,870 pulp.server.webservices.middleware.exception:ERROR: Cancel Not Implemented for Task: ca847b74-8317-484d-b7f6-ebb6c13fbc76
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/middleware/exception.py", line 44, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/middleware/postponed.py", line 39, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 279, in wsgi
    result = self.handle_with_processors()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 26, in _handle_with_processors
    return process(self.processors)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/web/application.py", line 566, in processor
    return handler()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/web/application.py", line 581, in processor
    result = handler()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 25, in process
    return self.handle()
  File "/usr/lib/python2.6/site-packages/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 422, in _delegate
    return f()
  File "/usr/lib/python2.6/site-packages/web/application.py", line 430, in <lambda>
    f = lambda: self._delegate_sub_application(pat, what)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 455, in _delegate_sub_application
    return app.handle_with_processors()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 26, in _handle_with_processors
    return process(self.processors)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/web/application.py", line 566, in processor
    return handler()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in process
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/web/application.py", line 581, in processor
    result = handler()
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 23, in <lambda>
    return p(lambda : process(processors))
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/application.py", line 25, in process
    return self.handle()
  File "/usr/lib/python2.6/site-packages/web/application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 405, in _delegate
    return handle_class(f)
  File "/usr/lib/python2.6/site-packages/web/application.py", line 396, in handle_class
    return tocall(*args)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/decorators.py", line 227, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/dispatch.py", line 104, in DELETE
    raise TaskCancelNotImplemented(call_request_id)
TaskCancelNotImplemented: Cancel Not Implemented for Task: ca847b74-8317-484d-b7f6-ebb6c13fbc76

Comment 1 Michael Hrivnak 2013-11-19 15:58:02 UTC
The bug is here: https://github.com/pulp/pulp_puppet/blob/9be8c67/pulp_puppet_plugins/pulp_puppet/plugins/importers/sync.py#L94

This call to cancel() requires an argument that isn't being passed.

It's worth noting that the cancel method that requires an argument does not actually use that argument. That should be resolved by either removing it or adding the missing logic to use it.

It's confusing that there are different kinds of downloaders with slightly different APIs. The nectar downloaders have a "cancel()" method that takes no arguments, but now the puppet importer apparently has its own objects called "downloaders". They have a cancel method that does take an argument.

It might be less confusing if the "downloaders" in the puppet import had a different name, like DownloadCoordinator. They don't actually do any downloading, but rather are a layer between the importer and the nectar downloaders.

Comment 2 Jason Connor 2013-11-20 17:43:48 UTC
Awaiting review: https://github.com/pulp/pulp_puppet/pull/88

Comment 3 Jeff Ortel 2013-11-26 23:27:40 UTC
build: pulp-2.3.0-0.38.beta.

Comment 4 Preethi Thomas 2013-11-27 16:09:41 UTC
puppet-sync gets cancelled now. It does not give a message. But that was the same behavior in 2.2 as well. So I will write up another bug on it.
[root@pulp-v2-server ~]# rpm -qa pulp-server
pulp-server-2.3.0-0.38.beta.el6.noarch
[root@pulp-v2-server ~]# 


[root@pulp-v2-server ~]#  pulp-admin puppet repo sync run --repo-id puppet-repo 
+----------------------------------------------------------------------+
                 Synchronizing Repository [puppet-repo]
+----------------------------------------------------------------------+

This command may be exited by pressing ctrl+c without affecting the actual
operation on the server.

Downloading metadata...
[==================================================] 100%
Metadata Query: 1/1 items
... completed

Downloading new modules...
[=                                                 ] 2%
Module: 45/1813 items

Comment 5 Preethi Thomas 2013-12-09 14:31:44 UTC
Pulp 2.3 released.