Project

Profile

Help

Issue #406

Update importer of unexistant repo should return 404

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

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
2.6.1
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

Description of problem:
https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/repo/cud.html#update-an-importer-associated-with-a-repository

Docs say that an importer associated to a repo can be updated, but in case if there is no repository or importer with the specified IDs it will return 404.
Current api in this case returns a call report with 202 response code and the error is visible only in the task information.

  1. curl -i -H "Accept: application/json" -X PUT -k -u admin:admin -d '{"importer_config":{"num_units":5}}' 'https://ec2-54-217-78-7.eu-west-1.compute.amazonaws.com/pulp/api/v2/repositories/unexistant_repo/importers/yum_importer/'
    HTTP/1.1 202 Accepted
    Date: Thu, 20 Mar 2014 11:16:47 GMT
    Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
    Content-Encoding: utf-8
    Content-Length: 172
    Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/93ea7f3d-347a-4fed-ba7d-dd71db83396b/", "task_id": "93ea7f3d-347a-4fed-ba7d-dd71db83396b"}], "result": null, "error": null}

]# curl H "Accept: application/json" -X GET -k -u admin:admin 'https://ec2-54-217-78-7.eu-west-1.compute.amazonaws.com/pulp/api/v2/tasks/93ea7f3d-347a-4fed-ba7d-dd71db83396b/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1324 100 1324 0 0 5281 0 -
:--:-- --:--:-- --:--:-- 5296
{
"_href": "/pulp/api/v2/tasks/93ea7f3d-347a-4fed-ba7d-dd71db83396b/",
"_id": {
"$oid": "532ace1f6380d1e4b56c74b0"
},
"_ns": "task_status",
"error": {
"code": "PLP0009",
"data": {
"resources": {
"resource_id": "unexistant_repo"
}
},
"description": "Missing resource(s): resource_id=unexistant_repo",
"sub_errors": []
},
"finish_time": 1395314207,
"queue": "",
"start_time": 1395314207,
"state": "error",
"tags": [
"pulp:repository:unexistant_repo",
"pulp:repository_importer:yum_importer",
"pulp:action:update_importer"
],
"task_id": "93ea7f3d-347a-4fed-ba7d-dd71db83396b",
"traceback": "Traceback (most recent call last):\n File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 238, in trace_task\n R = retval = fun(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py\", line 369, in call\n return super(Task, self).__call__(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 416, in protected_call\n return self.run(*args, **kwargs)\n File \"/usr/lib/python2.7/site-packages/pulp/server/managers/repo/importer.py\", line 237, in update_importer_config\n raise MissingResource(repo_id)\nMissingResource: Missing resource(s): resource_id=unexistant_repo\n"
}

This behaviour is a bit confusing and maybe it would be better if the update call will directly return 404 like in case with distributor update call:

  1. curl -i -H "Accept: application/json" -X PUT -k -u admin:admin -d '{ "distributor_config":{"relative_url":"yyy"}}' 'https://example.com/pulp/api/v2/repositories/unexistant_repo/distributors/yum_distributor/'
    HTTP/1.1 404 Not Found
    Date: Thu, 20 Mar 2014 11:21:30 GMT
    Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
    Content-Encoding: utf-8
    Content-Length: 464
    Content-Type: application/json
    {
    "_href": "/pulp/api/v2/repositories/unexistant_repo/distributors/yum_distributor/",
    "error": {
    "code": "PLP0009",
    "data": {
    "resources": {
    "distributor": "yum_distributor"
    }
    },
    "description": "Missing resource(s): distributor=yum_distributor",
    "sub_errors": []
    },
    "error_message": "Missing resource(s): distributor=yum_distributor",
    "exception": null,
    "http_request_method": "PUT",
    "http_status": 404,
    "resources": {
    "distributor": "yum_distributor"
    },
    "traceback": null
    }

Version-Release number of selected component (if applicable):

pulp-server-2.4.0-0.3.alpha.git.13.3215df6.fc20.noarch
How reproducible:
always

Steps to Reproduce:
1. update unexistant importer(or update importer of unexistant repo)
2.
3.

Actual results:

Expected results:

Additional info:

+ This bug was cloned from Bugzilla Bug #1078833 +

History

#1 Updated by ipanova@redhat.com almost 7 years ago

Same behaviour with :
1)'association of importer to unexistant repo':

  1. curl -i -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id":"yum_importer", "importer_config":{}}' 'https://example.com/pulp/api/v2/repositories/unexistant_repo/importers/'
    HTTP/1.1 202 Accepted
    Date: Thu, 20 Mar 2014 11:34:01 GMT
    Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
    Content-Encoding: utf-8
    Content-Length: 172
    Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/329aacf1-b8d3-4ec5-92d5-10df8714b1ec/", "task_id": "329aacf1-b8d3-4ec5-92d5-10df8714b1ec"}], "result": null, "error": null}

2) 'disaasociate importer from unexistant repo':

  1. curl -i -H "Accept: application/json" -X DELETE -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/unexistant_repo/importers/yum_importer/'
    HTTP/1.1 202 Accepted
    Date: Thu, 20 Mar 2014 11:36:12 GMT
    Server: Apache/2.4.6 (Fedora) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
    Content-Encoding: utf-8
    Content-Length: 172
    Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/69604e28-4485-4978-bade-a89d08092b1a/", "task_id": "69604e28-4485-4978-bade-a89d08092b1a"}], "result": null, "error": null}

+ This comment was cloned from Bugzilla #1078833 comment 1 +

#4 Updated by mkovacik@redhat.com almost 7 years ago

Hi,

I've checked with pulp-server-2.6.0-0.5.beta.git.93.014a6ca.fc21.noarch and this seems fixed now --- is it expected in the beta build? If that's the case, I'll mark verified...

+ This comment was cloned from Bugzilla #1078833 comment 4 +

#5 Updated by mkovacik@redhat.com almost 7 years ago

pulled wrong pulp repo; all is OK

+ This comment was cloned from Bugzilla #1078833 comment 5 +

#6 Updated by bcourt over 6 years ago

  • Status changed from MODIFIED to 5

#7 Updated by igulina@redhat.com over 6 years ago

  • Status changed from 5 to 6
  • Severity set to 1. Low

rpm -qa pulp-server

pulp-server-2.6.1-0.2.beta.fc20.noarch

curl -i -H "Accept: application/json" -X PUT -k -u admin:admin -d '{"importer_config":{"num_units":5}}' 'https://localhost/pulp/api/v2/repositories/no_such_repo/importers/yum_importer/'

HTTP/1.1 404 Not Found
Date: Fri, 27 Mar 2015 18:31:41 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: 439
Content-Type: application/json

{"http_request_method": "PUT", "exception": null, "error_message": "Missing resource(s): repository=no_such_repo", "_href": "/pulp/api/v2/repositories/no_such_repo/importers/yum_importer/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"repository": "no_such_repo"}}, "description": "Missing resource(s): repository=no_such_repo", "sub_errors": []}, "traceback": null, "resources": {"repository": "no_such_repo"}}

curl -i -H "Accept: application/json" -X POST -k -u admin:admin -d '{"importer_type_id":"yum_importer", "importer_config":{}}' 'https://localhost/pulp/api/v2/repositories/no_such_repo/importers/'

HTTP/1.1 404 Not Found
Date: Fri, 27 Mar 2015 18:33:40 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: 431
Content-Type: application/json

{"http_request_method": "POST", "exception": null, "error_message": "Missing resource(s): resource_id=no_such_repo", "_href": "/pulp/api/v2/repositories/no_such_repo/importers/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"resource_id": "no_such_repo"}}, "description": "Missing resource(s): resource_id=no_such_repo", "sub_errors": []}, "traceback": null, "resources": {"resource_id": "no_such_repo"}}

curl -i -H "Accept: application/json" -X DELETE -k -u admin:admin 'https://localhost/pulp/api/v2/repositories/no_such_repo/importers/yum_importer/'

HTTP/1.1 404 Not Found
Date: Fri, 27 Mar 2015 18:34:14 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: 442
Content-Type: application/json

{"http_request_method": "DELETE", "exception": null, "error_message": "Missing resource(s): repository=no_such_repo", "_href": "/pulp/api/v2/repositories/no_such_repo/importers/yum_importer/", "http_status": 404, "error": {"code": "PLP0009", "data": {"resources": {"repository": "no_such_repo"}}, "description": "Missing resource(s): repository=no_such_repo", "sub_errors": []}, "traceback": null, "resources": {"repository": "no_such_repo"}}

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

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#10 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

#11 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