Bug 1096886 - Task state should be 'error' if import content into a repo fails
Summary: Task state should be 'error' if import content into a repo fails
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: async/tasks
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: ---
Assignee: pulp-bugs
QA Contact: Ina Panova
URL:
Whiteboard:
Depends On:
Blocks: 1096883
TreeView+ depends on / blocked
 
Reported: 2014-05-12 15:20 UTC by Ina Panova
Modified: 2015-02-28 22:06 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:06:08 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 428 0 None None None Never

Description Ina Panova 2014-05-12 15:20:43 UTC
Description of problem:
The state of the task created for the import of the uploaded content into the repo is 'finished' regardless error specified in the 'result'

$ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/1a6f35ae-9b41-495e-bec0-8315f83a4932/'|python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   770  100   770    0     0    587      0  0:00:01  0:00:01 --:--:--   587
{
    "_href": "/pulp/api/v2/tasks/1a6f35ae-9b41-495e-bec0-8315f83a4932/",
    "_id": {
        "$oid": "5370e3fc930c1f4a8635b4dc"
    },
    "_ns": "task_status",
    "error": null,
    "exception": null,
    "finish_time": "2014-05-12T15:08:44Z",
    "id": "5370e3fcd428846387488552",
    "progress_report": {},
    "queue": "reserved_resource_worker-0@ec2-54-220-72-88.eu-west-1.compute.amazonaws.com",
    "result": {
        "details": {
            "errors": [
                "metadata for the given package could not be extracted"
            ]
        },
        "success_flag": false,
        "summary": ""
    },
    "spawned_tasks": [],
    "start_time": "2014-05-12T15:08:44Z",
    "state": "finished",
    "tags": [
        "pulp:repository:m2",
        "pulp:action:import_upload"
    ],
    "task_id": "1a6f35ae-9b41-495e-bec0-8315f83a4932",
    "task_type": "pulp.server.managers.content.upload.import_uploaded_unit",
    "traceback": null
}


Version-Release number of selected component (if applicable):
pulp-2.4.0-0.13.beta

How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:
task state 'finished', when import fails

Expected results:
task state 'error', when import fails

Additional info:

Comment 1 Chris Duryee 2014-05-16 20:15:20 UTC
This appears to be fixed by bcourt's patch

https://github.com/pulp/pulp_rpm/pull/491

Comment 2 Randy Barlow 2014-05-29 18:07:27 UTC
This was fixed in pulp-2.4.0-0.19.beta.

Comment 3 Ina Panova 2014-06-03 09:32:45 UTC
# pulp-admin -u admin -p admin rpm repo uploads rpm --repo-id m2 --file ~/some.iso 
+----------------------------------------------------------------------+
                              Unit Upload
+----------------------------------------------------------------------+

Extracting necessary metadata for each request...
[==================================================] 100%
Analyzing: some.iso
... completed

Creating upload requests on the server...
[==================================================] 100%
Initializing: some.iso
... completed

Starting upload of selected units. If this process is stopped through ctrl+c,
the uploads will be paused and may be resumed later using the resume command or
cancelled entirely using the cancel command.

Uploading: some.iso
... completed

Importing into the repository...
This command may be exited via ctrl+c without affecting the request.


[\]
Running...

Task Failed

metadata for the given package could not be extracted


Deleting the upload request...
... completed

$ curl -H "Accept: application/json" -X GET -k -u admin:admin 'https://example.com/pulp/api/v2/tasks/431dd6bb-aacf-4f7b-98dc-eb5b05d364ec/'|python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   772  100   772    0     0    480      0  0:00:01  0:00:01 --:--:--   480
{
    "_href": "/pulp/api/v2/tasks/431dd6bb-aacf-4f7b-98dc-eb5b05d364ec/",
    "_id": {
        "$oid": "538d95920c759879a2927ade"
    },
    "_ns": "task_status",
    "error": null,
    "exception": null,
    "finish_time": "2014-06-03T09:29:54Z",
    "id": "538d9592591d260beec5f884",
    "progress_report": {},
    "queue": "reserved_resource_worker-0@example.com.dq",
    "result": {
        "details": {
            "errors": [
                "metadata for the given package could not be extracted"
            ]
        },
        "success_flag": false,
        "summary": ""
    },
    "spawned_tasks": [],
    "start_time": "2014-06-03T09:29:54Z",
    "state": "finished",
    "tags": [
        "pulp:repository:m2",
        "pulp:action:import_upload"
    ],
    "task_id": "431dd6bb-aacf-4f7b-98dc-eb5b05d364ec",
    "task_type": "pulp.server.managers.content.upload.import_uploaded_unit",
    "traceback": null
}

State of the task is still 'finished' instead of 'error'

Comment 4 Chris Duryee 2014-06-04 20:25:27 UTC
We can change the task state, but not for pulp 2.4. Moving to medium/no release.

We could also add additional checks to was_successful() in pulp/bindings/responses.py but I think it would be better to just fix it in the json result.

Comment 5 Ina Panova 2014-06-06 09:45:52 UTC
It would affect qe automation but we could put 'pass' for 2.4 version.

Comment 6 Brian Bouterse 2015-02-28 22:06:08 UTC
Moved to https://pulp.plan.io/issues/428


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