Bug 1080642 - Cannot retrieve bindings between repo and consumer after repo deletion
Summary: Cannot retrieve bindings between repo and consumer after repo deletion
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: 2.4.0
Assignee: Sayli Karmarkar
QA Contact: Ina Panova
URL:
Whiteboard:
Depends On:
Blocks: 1130153
TreeView+ depends on / blocked
 
Reported: 2014-03-25 20:36 UTC by Ina Panova
Modified: 2015-03-23 01:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1130153 (view as bug list)
Environment:
Last Closed: 2014-08-09 06:54:42 UTC
Embargoed:


Attachments (Terms of Use)

Description Ina Panova 2014-03-25 20:36:56 UTC
Description of problem:
After deletion of the repo that is bound to the consumer(for more info see https://bugzilla.redhat.com/show_bug.cgi?id=1080626) cannot retrieve(list) bindings of the consumer.

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.bind to it 2 repos
3.remove one repo
4. list bindings

Actual results:
404 status code

Expected results:
empty list if no more bindings are present/info about existing bindings 

Additional info:
$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.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  1148  100  1148    0     0   1376      0 --:--:-- --:--:-- --:--:--  1774
[
    {
        "_href": "/pulp/api/v2/consumers/c1/bindings/m2/yum_distributor/", 
        "_id": {
            "$oid": "5331e4c033d13e0d01fb068c"
        }, 
        "_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/m2", 
            "repo_name": "m2", 
            "server_name": "ip-10-104-226-68.eu-west-1.compute.internal"
        }, 
        "distributor_id": "yum_distributor", 
        "id": "5331e4c033d13e0d01fb068c", 
        "notify_agent": true, 
        "repo_id": "m2", 
        "type_id": "yum_distributor"
    }, 
    {
        "_href": "/pulp/api/v2/consumers/c1/bindings/m1/yum_distributor/", 
        "_id": {
            "$oid": "5331e4af33d13e0d01fb0688"
        }, 
        "_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": "5331e4af33d13e0d01fb0688", 
        "notify_agent": true, 
        "repo_id": "m1", 
        "type_id": "yum_distributor"
    }
]

$ curl -H "Accept: application/json" -X DELETE -k -u admin:admin  'https://example.com/pulp/api/v2/repositories/m2/'| 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    122      0  0:00:01  0:00:01 --:--:--   147
{
    "error": null, 
    "result": null, 
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/5e611abe-8d6f-4c5e-b7a5-9ebded56282c/", 
            "task_id": "5e611abe-8d6f-4c5e-b7a5-9ebded56282c"
        }
    ]
}


]$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.com/pulp/api/v2/repositories/m2/'| 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    395      0 --:--:-- --:--:-- --:--:--   523
{
    "_href": "/pulp/api/v2/repositories/m2/", 
    "error": {
        "code": "PLP0009", 
        "data": {
            "resources": {
                "repo": "m2"
            }
        }, 
        "description": "Missing resource(s): repo=m2", 
        "sub_errors": []
    }, 
    "error_message": "Missing resource(s): repo=m2", 
    "exception": null, 
    "http_request_method": "GET", 
    "http_status": 404, 
    "resources": {
        "repo": "m2"
    }, 
    "traceback": null
}




Cannot list all bindings, but can retrieve a particular one:

$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.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   428  100   428    0     0    488      0 --:--:-- --:--:-- --:--:--   663
{
    "_href": "/pulp/api/v2/consumers/c1/bindings/", 
    "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": "GET", 
    "http_status": 404, 
    "resources": {
        "distributor": "yum_distributor"
    }, 
    "traceback": null
}

$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.com/pulp/api/v2/consumers/c1/bindings/m1/yum_distributor/'| python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   572  100   572    0     0    628      0 --:--:-- --:--:-- --:--:--   869
{
    "_href": "/pulp/api/v2/consumers/c1/bindings/m1/yum_distributor/", 
    "_id": {
        "$oid": "5331e4af33d13e0d01fb0688"
    }, 
    "_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": "5331e4af33d13e0d01fb0688", 
    "notify_agent": true, 
    "repo_id": "m1", 
    "type_id": "yum_distributor"
}

Comment 1 Sayli Karmarkar 2014-03-28 07:35:53 UTC
Updated consumer bind to mark binding as deleted before notifying the agent.

https://github.com/pulp/pulp/pull/871

Comment 2 Jeff Ortel 2014-04-03 13:35:52 UTC
build: 2.4.0-0.7.beta

Comment 3 Ina Panova 2014-04-11 13:37:30 UTC
Tested in pulp-server-2.4.0-0.8.beta.fc20.noarch

1)retrieve bindings
$ 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  1224  100  1170  100    54   1042     48  0:00:01  0:00:01 --:--:--  1258
[
    {
        "_href": "/pulp/api/v2/consumers/a1/bindings/test1/yum_distributor/", 
        "_id": {
            "$oid": "5347ed581f6ea802323e40b2"
        }, 
        "_ns": "consumer_bindings", 
        "binding_config": {}, 
        "consumer_actions": [], 
        "consumer_id": "a1", 
        "deleted": false, 
        "details": {
            "ca_cert": null, 
            "client_cert": null, 
            "gpg_keys": [], 
            "protocols": [
                "https"
            ], 
            "relative_path": "/pulp/repos/test1", 
            "repo_name": "test1", 
            "server_name": "ip-10-35-136-99.eu-west-1.compute.internal"
        }, 
        "distributor_id": "yum_distributor", 
        "id": "5347ed581f6ea802323e40b2", 
        "notify_agent": true, 
        "repo_id": "test1", 
        "type_id": "yum_distributor"
    }, 
    {
        "_href": "/pulp/api/v2/consumers/a1/bindings/test2/yum_distributor/", 
        "_id": {
            "$oid": "5347ed611f6ea80231583012"
        }, 
        "_ns": "consumer_bindings", 
        "binding_config": {}, 
        "consumer_actions": [], 
        "consumer_id": "a1", 
        "deleted": false, 
        "details": {
            "ca_cert": null, 
            "client_cert": null, 
            "gpg_keys": [], 
            "protocols": [
                "https"
            ], 
            "relative_path": "/pulp/repos/test2", 
            "repo_name": "test2", 
            "server_name": "ip-10-35-136-99.eu-west-1.compute.internal"
        }, 
        "distributor_id": "yum_distributor", 
        "id": "5347ed611f6ea80231583012", 
        "notify_agent": true, 
        "repo_id": "test2", 
        "type_id": "yum_distributor"
    }
]

2) delete repo
$ curl -H "Accept: application/json" -X DELETE  -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/test1/'| 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    104      0  0:00:01  0:00:01 --:--:--   119
{
    "error": null, 
    "result": null, 
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/13083685-daea-4842-a920-5e46b738c7c4/", 
            "task_id": "13083685-daea-4842-a920-5e46b738c7c4"
        }
    ]
}

3) retrieve bindings again
$ 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   639  100   585  100    54    640     59 --:--:-- --:--:-- --:--:--   817
[
    {
        "_href": "/pulp/api/v2/consumers/a1/bindings/test2/yum_distributor/", 
        "_id": {
            "$oid": "5347ed611f6ea80231583012"
        }, 
        "_ns": "consumer_bindings", 
        "binding_config": {}, 
        "consumer_actions": [], 
        "consumer_id": "a1", 
        "deleted": false, 
        "details": {
            "ca_cert": null, 
            "client_cert": null, 
            "gpg_keys": [], 
            "protocols": [
                "https"
            ], 
            "relative_path": "/pulp/repos/test2", 
            "repo_name": "test2", 
            "server_name": "ip-10-35-136-99.eu-west-1.compute.internal"
        }, 
        "distributor_id": "yum_distributor", 
        "id": "5347ed611f6ea80231583012", 
        "notify_agent": true, 
        "repo_id": "test2", 
        "type_id": "yum_distributor"
    }
]

Moving to Verified.

Comment 4 Randy Barlow 2014-08-09 06:54:42 UTC
This has been fixed in Pulp 2.4.0-1.


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