Bug 1130153 - 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.5.0
Assignee: Jeremy Cline
QA Contact: Ina Panova
URL:
Whiteboard:
Depends On: 1080642
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-14 12:51 UTC by Ina Panova
Modified: 2014-11-24 21:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1080642
Environment:
Last Closed: 2014-11-24 21:33:50 UTC
Embargoed:


Attachments (Terms of Use)

Description Ina Panova 2014-08-14 12:51:09 UTC
+++ This bug was initially created as a clone of Bug #1080642 +++

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"
}

--- Additional comment from Sayli Karmarkar on 2014-03-28 03:35:53 EDT ---

Updated consumer bind to mark binding as deleted before notifying the agent.

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

--- Additional comment from Jeff Ortel on 2014-04-03 09:35:52 EDT ---

build: 2.4.0-0.7.beta

--- Additional comment from Ina Panova on 2014-04-11 09:37:30 EDT ---

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.

--- Additional comment from Randy Barlow on 2014-08-09 02:54:42 EDT ---

This has been fixed in Pulp 2.4.0-1.

Comment 1 Ina Panova 2014-08-14 12:53:12 UTC
appeared in 2.4.1-0.1.alpha
See related bugs : https://bugzilla.redhat.com/show_bug.cgi?id=1130084
                   https://bugzilla.redhat.com/show_bug.cgi?id=1130151

Comment 2 Jeremy Cline 2014-08-15 21:24:11 UTC
https://github.com/pulp/pulp/pull/1114

Comment 3 Chris Duryee 2014-09-30 13:52:32 UTC
build: 2.5.0-0.6.beta

Comment 4 Ina Panova 2014-10-02 09:57:53 UTC
Bindings before repo delete:
# 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  1187  100  1187    0     0   3342      0 --:--:-- --:--:-- --:--:--  3353
[
    {
        "_href": "/pulp/api/v2/consumers/c1/bindings/m1/yum_distributor/",
        "_id": {
            "$oid": "542d2064908a3a4ee66219cf"
        },
        "_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/repos/pulp/pulp/demo_repos/zoo/",
            "repo_name": "m1",
            "server_name": "ec2-54-217-44-62.eu-west-1.compute.amazonaws.com"
        },
        "distributor_id": "yum_distributor",
        "id": "542d2064908a3a4ee66219cf",
        "notify_agent": true,
        "repo_id": "m1",
        "type_id": "yum_distributor"
    },
    {
        "_href": "/pulp/api/v2/consumers/c1/bindings/m2/yum_distributor/",
        "_id": {
            "$oid": "542d2067908a3a4ee88c0b7b"
        },
        "_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": "ec2-54-217-44-62.eu-west-1.compute.amazonaws.com"
        },
        "distributor_id": "yum_distributor",
        "id": "542d2067908a3a4ee88c0b7b",
        "notify_agent": true,
        "repo_id": "m2",
        "type_id": "yum_distributor"
    }
]


Bindings after repo delete:

# 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   579  100   579    0     0   1587      0 --:--:-- --:--:-- --:--:--  1590
[
    {
        "_href": "/pulp/api/v2/consumers/c1/bindings/m2/yum_distributor/",
        "_id": {
            "$oid": "542d2067908a3a4ee88c0b7b"
        },
        "_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": "ec2-54-217-44-62.eu-west-1.compute.amazonaws.com"
        },
        "distributor_id": "yum_distributor",
        "id": "542d2067908a3a4ee88c0b7b",
        "notify_agent": true,
        "repo_id": "m2",
        "type_id": "yum_distributor"
    }
]

Tested in 2.5.0-0.6.beta
Moving to Verified.


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