Description of problem: https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/repo/cud.html#delete-a-repository Deletion of a repository that has consumers bound to it should be done in two steps(as docs state). First step is deletion of the repo and second step is removal of bindings between repo and consumers. Issue consists in the fact that repo is removed but bindings remain. 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.register consumer 2. create repo and bind it to the consumer 3. delete repo Actual results: repo is deleted but bindings not Expected results: bindings removed Additional info: 1)bind consumer to the repo: $ curl -i -H "Accept: application/json" -X POST -k -u admin:admin -d '{"repo_id":"m1","distributor_id":"yum_distributor"}' 'https://example.com/pulp/api/v2/consumers/c1/bindings/' HTTP/1.1 202 Accepted Date: Tue, 25 Mar 2014 19:05: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: 436 Content-Type: application/json {"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/e1108177-ae68-4d51-aa50-b77aa9c843f1/", "task_id": "e1108177-ae68-4d51-aa50-b77aa9c843f1"}], "result": {"notify_agent": true, "repo_id": "m1", "deleted": false, "_ns": "consumer_bindings", "distributor_id": "yum_distributor", "consumer_id": "c1", "consumer_actions": [], "binding_config": {}, "_id": {"$oid": "5331d38b33d13e0d01fb05db"}, "id": "5331d38b33d13e0d01fb05db"}, "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/consumers/c1/bindings/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 574 100 574 0 0 637 0 --:--:-- --:--:-- --:--:-- 820 [ { "_href": "/pulp/api/v2/consumers/c1/bindings/m1/yum_distributor/", "_id": { "$oid": "5331d38b33d13e0d01fb05db" }, "_ns": "consumer_bindings", "binding_config": {}, "consumer_actions": [], "consumer_id": "c1", "deleted": false, "details": { "ca_cert": null, "client_cert": null, "gpg_keys": [], "protocols": [ "https" ], "relative_path": "/pulp/repos/m1", "repo_name": "m1", "server_name": "ip-10-104-226-68.eu-west-1.compute.internal" }, "distributor_id": "yum_distributor", "id": "5331d38b33d13e0d01fb05db", "notify_agent": true, "repo_id": "m1", "type_id": "yum_distributor" } ] 2) delete repo : $ curl -H "Accept: application/json" -X DELETE -k -u admin:admin 'https://ec2-54-217-78-7.eu-west-1.compute.amazonaws.com/pulp/api/v2/repositories/m1/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 172 100 172 0 0 125 0 0:00:01 0:00:01 --:--:-- 147 { "error": null, "result": null, "spawned_tasks": [ { "_href": "/pulp/api/v2/tasks/6c798311-21bc-4cb7-a61e-494a0fc8bf58/", "task_id": "6c798311-21bc-4cb7-a61e-494a0fc8bf58" } ] } Poll the task: $ 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/6c798311-21bc-4cb7-a61e-494a0fc8bf58/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 348 100 348 0 0 390 0 --:--:-- --:--:-- --:--:-- 506 { "_href": "/pulp/api/v2/tasks/6c798311-21bc-4cb7-a61e-494a0fc8bf58/", "_id": { "$oid": "5331d4733965e4939dfabfc5" }, "queue": "reserved_resource_worker-0.compute.internal", "start_time": 1395774579, "state": "running", "tags": [ "pulp:repository:m1", "pulp:action:delete" ], "task_id": "6c798311-21bc-4cb7-a61e-494a0fc8bf58" } Wait several minutes, poll the task again: $ 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/6c798311-21bc-4cb7-a61e-494a0fc8bf58/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 348 100 348 0 0 410 0 --:--:-- --:--:-- --:--:-- 541 { "_href": "/pulp/api/v2/tasks/6c798311-21bc-4cb7-a61e-494a0fc8bf58/", "_id": { "$oid": "5331d4733965e4939dfabfc5" }, "queue": "reserved_resource_worker-0.compute.internal", "start_time": 1395774579, "state": "running", "tags": [ "pulp:repository:m1", "pulp:action:delete" ], "task_id": "6c798311-21bc-4cb7-a61e-494a0fc8bf58" } Note the 'state' of the task 'running' that will never finish. ]# pulp-admin -u admin -p admin tasks list Operations: delete Resources: m1 (repository) State: Running Start Time: 1395774579 Finish Time: Incomplete Result: Incomplete Task Id: 6c798311-21bc-4cb7-a61e-494a0fc8bf58 Operations: agent_unbind Resources: c1 (consumer), m1 (repository), yum_distributor (repository_distributor) State: Unknown Start Time: Unstarted Finish Time: Incomplete Result: Unknown Task Id: 570a38be-82b2-4a28-ab71-14406412536f Repo is removed, but the binding is not: $ 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/repositories/m1/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 342 100 342 0 0 403 0 --:--:-- --:--:-- --:--:-- 522 { "_href": "/pulp/api/v2/repositories/m1/", "error": { "code": "PLP0009", "data": { "resources": { "repo": "m1" } }, "description": "Missing resource(s): repo=m1", "sub_errors": [] }, "error_message": "Missing resource(s): repo=m1", "exception": null, "http_request_method": "GET", "http_status": 404, "resources": { "repo": "m1" }, "traceback": 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/consumers/?bindings=True&details=False'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1428 100 1428 0 0 1581 0 --:--:-- --:--:-- --:--:-- 2106 [ { "_href": "/pulp/api/v2/consumers/c1/", "_id": { "$oid": "5331d28033d13e0d01fb05cd" }, "_ns": "consumers", "bindings": [ { "_href": "/pulp/api/v2/consumers/c1/bindings/m1/yum_distributor/", "_id": { "$oid": "5331d38b33d13e0d01fb05db" }, "_ns": "consumer_bindings", "binding_config": {}, "consumer_actions": [], "consumer_id": "c1", "deleted": false, "distributor_id": "yum_distributor", "id": "5331d38b33d13e0d01fb05db", "notify_agent": true, "repo_id": "m1" } ], "capabilities": {}, "certificate": "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----", "description": null, "display_name": "c1", "id": "c1", "notes": {} } ] Fact that binding was not removed is confirmed by the presence of the deleted repo in 'yum repolist' on the consumer. # yum repolist Loaded plugins: pulp-profile-update repo id repo name status fedora/20/x86_64 Fedora 20 - x86_64 38,597 m1 m2 0 pulp-local-build pulp local build 0 pulp-v2-testing/20/x86_64 Pulp v2 Testing Builds 53 updates/20/x86_64 Fedora 20 - x86_64 - Updates 14,482 repolist: 53,132
There were couple of issues here. The repo delete on the cli was hanging and the task was stuck in the running state because of a bug in parsing PulpCodedException. The second issue was inability to remove bindings from the consumer. Both are addressed here - https://github.com/pulp/pulp/pull/871
build: 2.4.0-0.7.beta
Tested in pulp-server-2.4.0-0.8.beta.fc20.noarch 1) repo deletion task finishes $ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/3cbd2fa3-b5d0-4f65-9f4f-3d703b025f0c/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 687 100 633 100 54 702 59 --:--:-- --:--:-- --:--:-- 896 { "_href": "/pulp/api/v2/tasks/3cbd2fa3-b5d0-4f65-9f4f-3d703b025f0c/", "_id": { "$oid": "5347e6f7c1386784739656ac" }, "_ns": "task_status", "finish_time": "2014-04-11T12:59:12Z", "queue": "reserved_resource_worker-1.compute.internal", "result": null, "spawned_tasks": [ { "_href": "/pulp/api/v2/tasks/86a0f47e-933b-4aa2-b612-e5e064d1a176/", "task_id": "86a0f47e-933b-4aa2-b612-e5e064d1a176" } ], "start_time": "2014-04-11T12:59:12Z", "state": "finished", "tags": [ "pulp:repository:test1", "pulp:action:delete" ], "task_id": "3cbd2fa3-b5d0-4f65-9f4f-3d703b025f0c", "task_type": "pulp.server.tasks.repository.delete" 2) bindings removed $ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/86a0f47e-933b-4aa2-b612-e5e064d1a176/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 884 100 830 100 54 922 59 --:--:-- --:--:-- --:--:-- 1199 { "_href": "/pulp/api/v2/tasks/86a0f47e-933b-4aa2-b612-e5e064d1a176/", "_id": { "$oid": "5347e7201f6ea810d968f894" }, "_ns": "task_status", "error": null, "finish_time": "2014-04-11T12:59:12Z", "id": "5347e7201f6ea810d968f894", "progress_report": {}, "queue": "agent", "result": { "details": { "puppet_distributor": [ { "details": {}, "repo_id": "test1", "succeeded": true } ], "yum_distributor": [ { "details": {}, "repo_id": "test1", "succeeded": true } ] }, "num_changes": 0, "reboot": { "details": {}, "scheduled": false }, "succeeded": true }, "spawned_tasks": [], "start_time": "2014-04-11T12:59:12Z", "state": "finished", "tags": [ "pulp:consumer:a1", "pulp:repository:test1", "pulp:repository_distributor:yum_distributor", "pulp:action:agent_unbind" ], "task_id": "86a0f47e-933b-4aa2-b612-e5e064d1a176", "task_type": null, "traceback": null } ]$ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/consumers/a1/bindings/'| python -m json.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 56 100 2 100 54 1 42 0:00:02 0:00:01 0:00:01 59 [] $ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/consumers/?bindings=True&details=False/'| python -m json.tool [ { "_href": "/pulp/api/v2/consumers/a1/", "_id": { "$oid": "5347c1731f6ea80231582fdd" }, "_ns": "consumers", "bindings": [], "capabilities": {}, "description": null, "display_name": "a1", "id": "a1", "notes": {}, "rsa_pub": "-----BEGIN PUBLIC KEY----------END PUBLIC KEY-----\n" } ] Moving to Verified.
This has been fixed in Pulp 2.4.0-1.