Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1063778

Summary: Wrong task state when trying to unassociate unit from repo with feed
Product: [Retired] Pulp Reporter: Ina Panova <ipanova>
Component: API/integrationAssignee: Barnaby Court <bcourt>
Status: CLOSED CURRENTRELEASE QA Contact: Ina Panova <ipanova>
Severity: unspecified Docs Contact:
Priority: high    
Version: unspecifiedCC: mhrivnak
Target Milestone: ---   
Target Release: 2.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-09 06:54:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ina Panova 2014-02-11 12:21:25 UTC
Description of problem:
When trying to unassociate unit from repo with feed a task is created and its state transits from 'waiting' to 'finished' instead of 'error'. 

Version-Release number of selected component (if applicable):

pulp-server-2.4.0-0.2.alpha.fc19.noarch

How reproducible:
always

Steps to Reproduce:
1. create and sync repo with feed
2. try to unassociate unit from repo
3. task should fail as it's impossible to remove units from repo with feed

Actual results:
state of the task is 'finished'

Expected results:
state of the task should be 'error'

Additional info:
$ curl -H "Accept: application/json" -X POST -k -u admin:admin  -d '{"criteria": {"type_ids": ["puppet_module"], "filters": {"unit": {"name": "tomcat7_rhel"}}}}' 'https://example.com/pulp/api/v2/repositories/testrepo/actions/unassociate/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   714  100   622  100    92    873    129 --:--:-- --:--:-- --:--:--  1006
{
    "_href": "/pulp/api/v2/tasks/1ff2ef93-b7f7-42c0-aab5-ac9361594a24/", 
    "call_request_group_id": null, 
    "call_request_id": "1ff2ef93-b7f7-42c0-aab5-ac9361594a24", 
    "call_request_tags": [
        "pulp:repository:testrepo", 
        "pulp:action:unassociate"
    ], 
    "dependency_failures": {}, 
    "exception": null, 
    "finish_time": null, 
    "principal_login": "admin", 
    "progress": {}, 
    "reasons": [], 
    "response": "accepted", 
    "result": null, 
    "schedule_id": null, 
    "start_time": null, 
    "state": "waiting", 
    "tags": [
        "pulp:repository:testrepo", 
        "pulp:action:unassociate"
    ], 
    "task_group_id": null, 
    "task_id": "1ff2ef93-b7f7-42c0-aab5-ac9361594a24", 
    "traceback": null
}


$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.com/pulp/api/v2/tasks/1ff2ef93-b7f7-42c0-aab5-ac9361594a24/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   807  100   807    0     0    140      0  0:00:05  0:00:05 --:--:--  1320
{
    "_href": "/pulp/api/v2/tasks/1ff2ef93-b7f7-42c0-aab5-ac9361594a24/", 
    "call_request_group_id": null, 
    "call_request_id": "1ff2ef93-b7f7-42c0-aab5-ac9361594a24", 
    "call_request_tags": [
        "pulp:repository:testrepo", 
        "pulp:action:unassociate"
    ], 
    "dependency_failures": {}, 
    "exception": null, 
    "finish_time": "2014-02-11T12:01:02Z", 
    "principal_login": "admin", 
    "progress": {}, 
    "reasons": [], 
    "response": "accepted", 
    "result": {
        "units_failed": [
            {
                "type_id": "puppet_module", 
                "unit_key": {
                    "author": "llehmijo", 
                    "name": "tomcat7_rhel", 
                    "version": "2.6.0"
                }
            }
        ], 
        "units_successful": []
    }, 
    "schedule_id": null, 
    "start_time": "2014-02-11T12:01:02Z", 
    "state": "finished", 
    "tags": [
        "pulp:repository:testrepo", 
        "pulp:action:unassociate"
    ], 
    "task_group_id": null, 
    "task_id": "1ff2ef93-b7f7-42c0-aab5-ac9361594a24", 
    "traceback": null
}

Comment 1 Michael Hrivnak 2014-02-12 17:32:09 UTC
This previously was by design, but we have changed this behavior in 2.4 to match the expectation you've asserted.

Comment 2 Michael Hrivnak 2014-02-12 20:59:04 UTC
Just to be more clear, as of 2.4, you will be able to remove units from a repository even if they were put into the repo by a sync.

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

Comment 4 Ina Panova 2014-04-10 10:38:53 UTC
Tested in pulp-server-2.4.0-0.8.beta.fc20.noarch

# pulp-admin -u admin -p admin rpm repo list
+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+

Id:                  test1
Display Name:        test1
Description:         None
Content Unit Counts: 
  Erratum:          4
  Package Category: 1
  Package Group:    2
  Rpm:              32


$ curl -H "Accept: application/json" -X POST -k -u admin:admin  -d '{"criteria": {"filters": {"unit": {"name": "zebra"}}}}' 'https://example.com/pulp/api/v2/repositories/test1/actions/unassociate/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   226  100   172  100    54     89     28  0:00:01  0:00:01 --:--:--    90
{
    "error": null,
    "result": null,
    "spawned_tasks": [
        {
            "_href": "/pulp/api/v2/tasks/801462af-2398-4cdf-898f-defbb6896d97/",
            "task_id": "801462af-2398-4cdf-898f-defbb6896d97"
        }
    ]
}


$ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/801462af-2398-4cdf-898f-defbb6896d97/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   790  100   790    0     0    952      0 --:--:-- --:--:-- --:--:--   952
{
    "_href": "/pulp/api/v2/tasks/801462af-2398-4cdf-898f-defbb6896d97/",
    "_id": {
        "$oid": "534663afad9cc51149923ef3"
    },
    "_ns": "task_status",
    "finish_time": "2014-04-10T09:26:07Z",
    "queue": "reserved_resource_worker-0@ip-10-35-136-99.eu-west-1.compute.internal",
    "result": {
        "units_successful": [
            {
                "type_id": "rpm",
                "unit_key": {
                    "arch": "noarch",
                    "checksum": "801a2a2c7dd64cd3997dcdf1e61e16f6cf01ef7cce9b4d527712e58c40eca55f",
                    "checksumtype": "sha256",
                    "epoch": "0",
                    "name": "zebra",
                    "release": "2",
                    "version": "0.1"
                }
            }
        ]
    },
    "spawned_tasks": [],
    "start_time": "2014-04-10T09:26:07Z",
    "state": "finished",
    "tags": [
        "pulp:repository:test1",
        "pulp:action:unassociate"
    ],
    "task_id": "801462af-2398-4cdf-898f-defbb6896d97",
    "task_type": "pulp.server.managers.repo.unit_association.unassociate_by_criteria"
}

# pulp-admin -u admin -p admin rpm repo list --details

+----------------------------------------------------------------------+
                            RPM Repositories
+----------------------------------------------------------------------+
Id:                  test1
Display Name:        test1
Description:         None
Content Unit Counts: 
  Erratum:          4
  Package Category: 1
  Package Group:    2
  Rpm:              31
Notes:               
Importers:           
  Config:           
    Feed: http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/
  Id:               yum_importer
  Importer Type Id: yum_importer
  Last Sync:        2014-04-10T10:28:41Z
  Repo Id:          test1
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
    Checksum Type: sha256
    Http:          False
    Https:         True
    Relative URL:  /repos/pulp/pulp/demo_repos/zoo/
  Distributor Type Id: yum_distributor
  Id:                  yum_distributor
  Last Publish:        2014-04-10T10:28:43Z
  Repo Id:             test1
  Scheduled Publishes: 



Moving to Verified.

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