Project

Profile

Help

Issue #827

Retrieve all/single content source url should accept only GET

Added by ipanova@redhat.com over 6 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
2.7.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

Currently we have Views that are sharing more than one url, this causes the situation when url accepts other methods than the allowed one. One of the solution would be to slpit and have one url per View.

$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin  "https://localhost/pulp/api/v2/content/sources/"
HTTP/1.1 200 OK
Date: Tue, 31 Mar 2015 11:33:03 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Length: 694
Content-Type: application/json

[{"name": "Content World", "url": "/x86_64/os/", "max_concurrent": "10", "ssl_validation": "true", "expires": "3d", "enabled": "1", "base_url": "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/", "priority": "0", "max_speed": "1000", "source_id": "content-zoo222", "type": "yum", "_href": "/pulp/api/v2/content/sources/content-zoo222/"}, {"name": "Content World", "url": "/x86_64/os/", "max_concurrent": "10", "ssl_validation": "true", "expires": "3d", "enabled": "1", "base_url": "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/", "priority": "0", "max_speed": "1000", "source_id": "content-zoo", "type": "yum", "_href": "/pulp/api/v2/content/sources/content-zoo/"}][ipanova@ina pulp]$ 

$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X PUT -k -u admin:admin  "https://localhost/pulp/api/v2/content/sources/"
HTTP/1.1 405 METHOD NOT ALLOWED
Date: Tue, 31 Mar 2015 11:33:13 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Allow: GET, POST, HEAD, OPTIONS
Content-Length: 0
Content-Type: text/html; charset=utf-8

[ipanova@ina pulp]$ curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X POST -k -u admin:admin  "https://localhost/pulp/api/v2/content/sources/"
HTTP/1.1 500 INTERNAL SERVER ERROR
Date: Tue, 31 Mar 2015 11:33:25 GMT
Server: Apache/2.4.10 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.5 Python/2.7.5
Content-Encoding: utf-8
Content-Length: 1275
Connection: close
Content-Type: application/json

{"http_request_method": "POST", "exception": ["TypeError: post() takes exactly 3 arguments (2 given)\n"], "error_message": "post() takes exactly 3 arguments (2 given)", "_href": "/pulp/api/v2/content/sources/", "http_status": 500, "traceback": ["  File \"/usr/lib/python2.7/site-packages/django/core/handlers/base.py\", line 112, in get_response\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\n", "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 69, in view\n    return self.dispatch(request, *args, **kwargs)\n", "  File \"/usr/lib/python2.7/site-packages/django/views/generic/base.py\", line 87, in dispatch\n    return handler(request, *args, **kwargs)\n", "  File \"/home/ipanova/pulp_development/pulp/server/pulp/server/webservices/controllers/decorators.py\", line 241, in _auth_decorator\n    return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)\n", "  File \"/home/ipanova/pulp_development/pulp/server/pulp/server/webservices/controllers/decorators.py\", line 195, in _verify_auth\n    value = method(self, *args, **kwargs)\n", "  File \"/home/ipanova/pulp_development/pulp/server/pulp/server/webservices/views/util.py\", line 83, in wrapper\n    return func(*args, **kwargs)\n"]}

pulp/api/v2/content/sources/ and pulp/api/v2/content/action/refresh share same View
pulp/api/v2/content/sources/<source_id/ and pulp/api/v2/content/sources/<source-id>/action/refresh share same View

Associated revisions

Revision 857679c1 View on GitHub
Added by jortel@redhat.com over 6 years ago

ref #827, separate view for collection actions.

Revision 857679c1 View on GitHub
Added by jortel@redhat.com over 6 years ago

ref #827, separate view for collection actions.

History

#1 Updated by ipanova@redhat.com over 6 years ago

  • Description updated (diff)

#2 Updated by mhrivnak over 6 years ago

  • Triaged changed from No to Yes
  • Tags Easy Fix added

#3 Updated by jortel@redhat.com over 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to jortel@redhat.com

#4 Updated by jortel@redhat.com over 6 years ago

  • Status changed from ASSIGNED to POST
  • Platform Release set to 2.7.0

#5 Updated by jortel@redhat.com over 6 years ago

  • Status changed from POST to MODIFIED

#6 Updated by dkliban@redhat.com over 6 years ago

  • Status changed from MODIFIED to 5

#8 Updated by pthomas@redhat.com over 6 years ago

verified

[root@qe-blade-10 ~]# rpm -qa pulp-server
pulp-server-2.7.0-0.3.beta.el6.noarch
[root@qe-blade-10 ~]# 
[root@qe-blade-10 ~]# 
[root@qe-blade-10 ~]# curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X GET -k -u admin:admin  "https://localhost/pulp/api/v2/content/sources/"
HTTP/1.1 200 OK
Date: Wed, 01 Jul 2015 13:46:22 GMT
Server: Apache/2.2.15 (Red Hat)
Content-Length: 2
Connection: close
Content-Type: application/json

[][root@qe-blade-10 ~]curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X PUT -k -u admin:admin  "https://localhost/pulp/api/v2/content/sources/" 
HTTP/1.1 405 METHOD NOT ALLOWED
Date: Wed, 01 Jul 2015 13:46:31 GMT
Server: Apache/2.2.15 (Red Hat)
Allow: get, head
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8

[root@qe-blade-10 ~]# curl -i -H "Accept: application/json" -H "WebFrameworkSwitch: django" -X PUT -k -u admin:admin  "https://localhost/pulp/api/v2/content/sources/" 
HTTP/1.1 405 METHOD NOT ALLOWED
Date: Wed, 01 Jul 2015 13:46:47 GMT
Server: Apache/2.2.15 (Red Hat)
Allow: get, head
Content-Length: 0
Connection: close
Content-Type: text/html; charset=utf-8

[root@qe-blade-10 ~]# 

#9 Updated by pthomas@redhat.com over 6 years ago

  • Status changed from 5 to 6

#10 Updated by amacdona@redhat.com almost 6 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#12 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

#13 Updated by bmbouter over 1 year ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Please register to edit this issue

Also available in: Atom PDF