Bug 670610 - POST /pulp/api/repositories/<id>/sync/ causes 500 error
Summary: POST /pulp/api/repositories/<id>/sync/ causes 500 error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jason Connor
QA Contact: Preethi Thomas
URL:
Whiteboard:
: 670694 (view as bug list)
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2011-01-18 19:46 UTC by Mike McCune
Modified: 2014-03-31 01:39 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-16 12:08:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Mike McCune 2011-01-18 19:46:50 UTC
You can't POST a sync request:

curl -k -u admin:admin -X POST https://localhost/pulp/api/repositories/some-repo-id/sync/


2011-01-18 11:36:50,879 [ERROR][Dummy-3] report_error() @ base.py:61 - Traceback (most recent call last):
  File "/home/mmccune/devel/pulp/src/pulp/server/webservices/controllers/base.py", line 57, in report_error
    return method(self, *args, **kwargs)
  File "/home/mmccune/devel/pulp/src/pulp/server/webservices/role_check.py", line 131, in check_roles
    result = f(instance, *fargs, **kw)
  File "/home/mmccune/devel/pulp/src/pulp/server/webservices/controllers/repositories.py", line 292, in sync
    task = self.start_task(api._sync, [id, repo_params['skip']],
KeyError: 'skip'

should use get() instead of direct access:

diff --git a/src/pulp/server/webservices/controllers/repositories.py b/src/pulp/server/webservices/controllers/repo
index 62bb0b7..4128e91 100644
--- a/src/pulp/server/webservices/controllers/repositories.py
+++ b/src/pulp/server/webservices/controllers/repositories.py
@@ -289,7 +289,7 @@ class RepositoryActions(AsyncController):
         """
         repo_params = self.params()
         timeout = self.timeout(repo_params)
-        task = self.start_task(api._sync, [id, repo_params['skip']], 
+        task = self.start_task(api._sync, [id, repo_params.get('skip')], 
                 timeout=timeout, unique=True, task_type=RepoSyncTask)

Comment 1 Mike McCune 2011-01-18 19:54:20 UTC
commit 2fb94021c6b5910a53f046015ef54e928dd7b7f6
Author: Mike McCune <mmccune>
Date:   Tue Jan 18 11:48:51 2011 -0800

    670610 - ensure that parameter dictionary access is key safe

Comment 2 Mike McCune 2011-01-19 01:22:18 UTC
*** Bug 670694 has been marked as a duplicate of this bug. ***

Comment 3 Jay Dobies 2011-01-21 19:18:50 UTC
Fixed in 0.130.

Comment 4 Preethi Thomas 2011-01-25 19:24:04 UTC
Trying to verify

Mike could you please see if this is what is expected?

[root@preethi ~]# curl -k -u admin:admin -X POST  https://localhost/pulp/api/repositories/f13/sync/
{"scheduled_time": 0, "exception": null, "status_path": "/pulp/api/repositories/f13/sync/6130655c-28b8-11e0-9824-002564a85a58/", "finish_time": null, "start_time": null, "traceback": null, "method_name": "_sync", "state": "waiting", "result": null, "progress": null, "id": "6130655c-28b8-11e0-9824-002564a85a58"}[root@preethi ~]# 
[root@preethi ~]#

Comment 5 Preethi Thomas 2011-03-11 15:37:14 UTC
[root@preethi ~]# curl -k -u admin:admin -X POST https://localhost/pulp/api/repositories/fedora-repo-with-czech-name/sync/
{"scheduled_time": 0, "exception": null, "status_path": "/pulp/api/repositories/fedora-repo-with-czech-name/sync/10903768-4bf6-11e0-9c07-002564a85a58/", "finish_time": null, "start_time": null, "traceback": null, "method_name": "_sync", "state": "waiting", "result": null, "progress": null, "id": "10903768-4bf6-11e0-9c07-002564a85a58"}[

Comment 6 Preethi Thomas 2011-03-11 15:38:22 UTC
verified[root@preethi ~]# rpm -q pulp
pulp-0.0.146-1.fc14.noarch

Comment 7 Preethi Thomas 2011-08-16 12:08:17 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 8 Preethi Thomas 2011-08-16 12:21:24 UTC
Closing with Community Release 15

pulp-0.0.223-4.


Note You need to log in before you can comment on or make changes to this bug.