Bug 1081030 - Consumers are not unbounded from distributor in case of distributor's removal
Summary: Consumers are not unbounded from distributor in case of distributor's removal
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: consumers
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: 1130151
TreeView+ depends on / blocked
 
Reported: 2014-03-26 14:09 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:
: 1130151 (view as bug list)
Environment:
Last Closed: 2014-08-09 06:55:33 UTC
Embargoed:


Attachments (Terms of Use)

Description Ina Panova 2014-03-26 14:09:20 UTC
Description of problem:
https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/repo/cud.html#disassociate-a-distributor-from-a-repository

Disassociation of the distributor leads to the situation where distributor is removed but bindings are not removed.

]$ curl -H "Accept: application/json" -X DELETE  -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/m1/distributors/yum_distributor/'|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    129      0  0:00:01  0:00:01 --:--:--   129
{
    "error": null,
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/776b9219-99d5-431f-992d-ccc51f1043bf/",
            "task_id": "776b9219-99d5-431f-992d-ccc51f1043bf"
        }
    ]
}
[ipanova@dhcp130-142 pulp-automation]$ curl -H "Accept: application/json" -X GET  -k -u admin:admin 'https://exampple.com/pulp/api/v2/tasks/776b9219-99d5-431f-992d-ccc51f1043bf/'|python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   886  100   886    0     0    141      0  0:00:06  0:00:06 --:--:--   187
{
    "_href": "/pulp/api/v2/tasks/776b9219-99d5-431f-992d-ccc51f1043bf/",
    "_id": {
        "$oid": "5332d7633965e4939dfabfd1"
    },
    "_ns": "task_status",
    "error": {
        "code": "PLP0003",
        "data": {
            "distributor_id": "yum_distributor",
            "repo_id": "m1"
        },
        "description": "Errors occurred removing bindings on consumers while deleting a distributor for repo m1 and distributor yum_distributor",
        "sub_errors": [
            {
                "code": "PLP0009",
                "data": {
                    "resources": {
                        "distributor": "yum_distributor"
                    }
                },
                "description": "Missing resource(s): distributor=yum_distributor",
                "sub_errors": []
            }
        ]
    },
    "finish_time": 1395840867,
    "queue": "reserved_resource_worker-0.compute.internal",
    "result": null,
    "start_time": 1395840867,
    "state": "finished",
    "tags": [
        "pulp:repository:m1",
        "pulp:repository_distributor:yum_distributor",
        "pulp:action:remove_distributor"
    ],
    "task_id": "776b9219-99d5-431f-992d-ccc51f1043bf"
}


]$ curl -H "Accept: application/json" -X GET  -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/m1/distributors/yum_distributor/'|python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   451  100   451    0     0    397      0  0:00:01  0:00:01 --:--:--   397
{
    "_href": "/pulp/api/v2/repositories/m1/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": "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/?bindings=True'|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   1638      0 --:--:-- --:--:-- --:--:--  1639
[
    {
        "_href": "/pulp/api/v2/consumers/a1/",
        "_id": {
            "$oid": "5332d69933d13e0d01fb06da"
        },
        "_ns": "consumers",
        "bindings": [
            {
                "_href": "/pulp/api/v2/consumers/a1/bindings/m1/yum_distributor/",
                "_id": {
                    "$oid": "5332d6fc33d13e0d01fb06e7"
                },
                "_ns": "consumer_bindings",
                "binding_config": {},
                "consumer_actions": [],
                "consumer_id": "a1",
                "deleted": false,
                "distributor_id": "yum_distributor",
                "id": "5332d6fc33d13e0d01fb06e7",
                "notify_agent": true,
                "repo_id": "m1"
            }
        ],
        "capabilities": {},
        "certificate": "-----BEGIN CERTIFICATE-----\-----END CERTIFICATE-----",
        "description": null,
        "display_name": "a1",
        "id": "a1",
        "notes": {}
    }
]

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 with distributor
3.bind repo to the consumer
4.disassociate distributor from the repo

Actual results:
distributor disassociated, but bindings still present

Expected results:
distributor disassociated, bindings removed

Additional info:

Comment 1 Ina Panova 2014-03-26 14:10:37 UTC
also see https://bugzilla.redhat.com/show_bug.cgi?id=1080626

Comment 2 Sayli Karmarkar 2014-03-28 05:02:22 UTC
This was partly because of the side-effect of the bug https://bugzilla.redhat.com/show_bug.cgi?id=1080626 and is addressed in the PR https://github.com/pulp/pulp/pull/871.

Comment 3 Jeff Ortel 2014-04-03 13:36:30 UTC
build: 2.4.0-0.7.beta

Comment 4 Ina Panova 2014-04-11 13:51:45 UTC
Tested in pulp-server-2.4.0-0.8.beta.fc20.noarch

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


]$ curl -H "Accept: application/json" -X DELETE  -k -u admin:admin 'https://example.com/pulp/api/v2/repositories/test2/distributors/yum_distributor/'| 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    115      0  0:00:01  0:00:01 --:--:--   134
{
    "error": null, 
    "result": null, 
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/802cec33-4a8a-490d-9b77-a4dd6e6d7307/", 
            "task_id": "802cec33-4a8a-490d-9b77-a4dd6e6d7307"
        }
    ]
}

$ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks//802cec33-4a8a-490d-9b77-a4dd6e6d7307/'| python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   758  100   704  100    54    767     58 --:--:-- --:--:-- --:--:--   977
{
    "_href": "/pulp/api/v2/tasks/802cec33-4a8a-490d-9b77-a4dd6e6d7307/", 
    "_id": {
        "$oid": "5347f20ac1386784739656ae"
    }, 
    "_ns": "task_status", 
    "finish_time": "2014-04-11T13:45:47Z", 
    "queue": "reserved_resource_worker-1.compute.internal", 
    "result": null, 
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/d700c85e-b737-49c8-b99a-1c7c0203557b/", 
            "task_id": "d700c85e-b737-49c8-b99a-1c7c0203557b"
        }
    ], 
    "start_time": "2014-04-11T13:45:46Z", 
    "state": "finished", 
    "tags": [
        "pulp:repository:test2", 
        "pulp:repository_distributor:yum_distributor", 
        "pulp:action:remove_distributor"
    ], 
    "task_id": "802cec33-4a8a-490d-9b77-a4dd6e6d7307", 
    "task_type": "pulp.server.tasks.repository.distributor_delete"
}

$ 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    0     2  100    54      0     17  0:00:03  0:00:03 --:--:--    37
[]

Moving to Verified.

Comment 5 Randy Barlow 2014-08-09 06:55:33 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.