Bug 1130151 - 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.5.0
Assignee: Jeremy Cline
QA Contact: Ina Panova
URL:
Whiteboard:
Depends On: 1081030
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-14 12:43 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: 1081030
Environment:
Last Closed: 2014-11-24 21:33:44 UTC


Attachments (Terms of Use)

Description Ina Panova 2014-08-14 12:43:48 UTC
+++ This bug was initially created as a clone of Bug #1081030 +++

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@ip-10-104-226-68.eu-west-1.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:

--- Additional comment from Ina Panova on 2014-03-26 10:10:37 EDT ---

also see https://bugzilla.redhat.com/show_bug.cgi?id=1080626

--- Additional comment from Sayli Karmarkar on 2014-03-28 01:02:22 EDT ---

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.

--- Additional comment from Jeff Ortel on 2014-04-03 09:36:30 EDT ---

build: 2.4.0-0.7.beta

--- Additional comment from Ina Panova on 2014-04-11 09:51:45 EDT ---

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@ip-10-35-136-99.eu-west-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.

--- Additional comment from Randy Barlow on 2014-08-09 02:55:33 EDT ---

This has been fixed in Pulp 2.4.0-1.

Comment 1 Ina Panova 2014-08-14 12:46:16 UTC
appeared in 2.4.1-0.1.alpha
This bz [0] also seems to be very related/similar to the reported one.
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1130084

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

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

Comment 4 Ina Panova 2014-10-02 11:45:24 UTC
1) Remove distributor
# curl -H "Accept: application/json" -X GET  -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/144f7381-ac9a-4e51-b5fe-c0bf1079cd54/'|python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   820  100   820    0     0   2230      0 --:--:-- --:--:-- --:--:--  2234
{
    "_href": "/pulp/api/v2/tasks/144f7381-ac9a-4e51-b5fe-c0bf1079cd54/",
    "_id": {
        "$oid": "542d39e8ad4a68b7cd57fb6c"
    },
    "_ns": "task_status",
    "error": null,
    "exception": null,
    "finish_time": "2014-10-02T11:41:28Z",
    "id": "542d39e8908a3a4ee66219d5",
    "progress_report": {},
    "queue": "reserved_resource_worker-0@ec2-54-217-44-62.eu-west-1.compute.amazonaws.com.dq",
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/a867db9a-67dd-437b-8c93-be1a0cf9f47f/",
            "task_id": "a867db9a-67dd-437b-8c93-be1a0cf9f47f"
        }
    ],
    "start_time": "2014-10-02T11:41:28Z",
    "state": "finished",
    "tags": [
        "pulp:repository:m2",
        "pulp:repository_distributor:yum_distributor",
        "pulp:action:remove_distributor"
    ],
    "task_id": "144f7381-ac9a-4e51-b5fe-c0bf1079cd54",
    "task_type": "pulp.server.tasks.repository.distributor_delete",
    "traceback": null
}

Check bindings:
# curl -H "Accept: application/json" -X GET  -k -u admin:admin 'https://eexample.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     2  100     2    0     0      5      0 --:--:-- --:--:-- --:--:--     5
[]
[root@ec2-54-217-44-62 ~]# 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   685  100   685    0     0   1949      0 --:--:-- --:--:-- --:--:--  1946
[
    {
        "_href": "/pulp/api/v2/consumers/c1/",
        "_id": {
            "$oid": "542c1e3a908a3a4ee88c0b5f"
        },
        "_ns": "consumers",
        "bindings": [],
        "capabilities": {},
        "description": null,
        "display_name": "c1",
        "id": "c1",
        "notes": {},
        "rsa_pub": "-----BEGIN PUBLIC KEY-----\nMIIB//\n-----END PUBLIC KEY-----\n"
    }
]

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.