Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making unit_key a non-required field #1087

Merged
merged 1 commit into from
Feb 27, 2018
Merged

Conversation

daviddavis
Copy link
Contributor

None was a valid value for unit_key until a commit began requiring it.
This fixes the backward incompatible change.

fixes #3307
https://pulp.plan.io/issues/3307

None was a valid value for unit_key until a commit began requiring it.
This fixes the backward incompatible change.

fixes pulp#3307
https://pulp.plan.io/issues/3307
@ipanova
Copy link
Member

ipanova commented Feb 27, 2018

Before patch:

$ curl -k -u admin:admin -X POST -d '{"override_config": {}, "unit_type_id": "rpm", "upload_id": "3d5d089b-0e2d-4f1f-9a0e-be32a8bc1f60", "unit_key": null, "unit_metadata": {}}' https://localhost/pulp/api/v2/repositories/zoo/actions/import_upload/ -H "Content-Type: application/json"
{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/8efbb7b8-9ca3-4590-b21b-77683c25054f/", "task_id": "8efbb7b8-9ca3-4590-b21b-77683c25054f"}], "result": null, "error": null}[ipanova@ina pulp_rpm]$ 
[ipanova@ina pulp_rpm]$ 
[ipanova@ina pulp_rpm]$ $ pulp-admin -vv tasks details --task-id 8efbb7b8-9ca3-4590-b21b-77683c25054f

+----------------------------------------------------------------------+
                              Task Details
+----------------------------------------------------------------------+

2018-02-27 11:11:59,493 - DEBUG - sending GET request to /pulp/api/v2/tasks/8efbb7b8-9ca3-4590-b21b-77683c25054f/
2018-02-27 11:11:59,579 - INFO - GET request to /pulp/api/v2/tasks/8efbb7b8-9ca3-4590-b21b-77683c25054f/ with parameters None
2018-02-27 11:11:59,579 - INFO - Response status : 200 

2018-02-27 11:11:59,579 - INFO - Response body :
 {
  "exception": null, 
  "task_type": "pulp.server.managers.content.upload.import_uploaded_unit", 
  "_href": "/pulp/api/v2/tasks/8efbb7b8-9ca3-4590-b21b-77683c25054f/", 
  "task_id": "8efbb7b8-9ca3-4590-b21b-77683c25054f", 
  "tags": [
    "pulp:repository:zoo", 
    "pulp:action:import_upload"
  ], 
  "finish_time": "2018-02-27T10:11:49Z", 
  "_ns": "task_status", 
  "start_time": "2018-02-27T10:11:49Z", 
  "traceback": "Traceback (most recent call last):\n  File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 240, in trace_task\n    R = retval = fun(*args, **kwargs)\n  File \"/home/ipanova/pulp_development/pulp/server/pulp/server/async/tasks.py\", line 529, in __call__\n    return super(Task, self).__call__(*args, **kwargs)\n  File \"/home/ipanova/pulp_development/pulp/server/pulp/server/async/tasks.py\", line 107, in __call__\n    return super(PulpTask, self).__call__(*args, **kwargs)\n  File \"/usr/lib/python2.7/site-packages/celery/app/trace.py\", line 438, in __protected_call__\n    return self.run(*args, **kwargs)\n  File \"/home/ipanova/pulp_development/pulp/server/pulp/server/managers/content/upload.py\", line 223, in import_uploaded_unit\n    unit_type=unit_type_id, summary=result['summary'], details=result['details']\nPulpCodedException: The importer yum_importer indicated a failed response when uploading rpm unit to repository zoo.\n", 
  "spawned_tasks": [], 
  "progress_report": {}, 
  "queue": "reserved_resource_worker-0@ina.dq", 
  "state": "error", 
  "worker_name": "reserved_resource_worker-0@ina", 
  "result": null, 
  "error": {
    "code": "PLP0047", 
    "data": {
      "unit_type": "rpm", 
      "importer_id": "yum_importer", 
      "repo_id": "zoo", 
      "details": {
        "errors": [
          "unexpected error occurred importing uploaded file: 'NoneType' object has no attribute 'items'"
        ]
      }, 
      "summary": ""
    }, 
    "description": "The importer yum_importer indicated a failed response when uploading rpm unit to repository zoo.", 
    "sub_errors": []
  }, 
  "_id": {
    "$oid": "5a952ee51008f2b6763469c5"
  }, 
  "id": "5a952ee51008f2b6763469c5"
}

Operations:       import_upload
Resources:        zoo (repository)
State:            Failed
Start Time:       2018-02-27T10:11:49Z
Finish Time:      2018-02-27T10:11:49Z
Result:           N/A
Task Id:          8efbb7b8-9ca3-4590-b21b-77683c25054f
Progress Report:  
Traceback:        Traceback (most recent call last):   File
                  "/usr/lib/python2.7/site-packages/celery/app/trace.py", line
                  240, in trace_task     R = retval = fun(*args, **kwargs)  
                  File
                  "/home/ipanova/pulp_development/pulp/server/pulp/server/async/
                  tasks.py", line 529, in __call__     return super(Task,
                  self).__call__(*args, **kwargs)   File
                  "/home/ipanova/pulp_development/pulp/server/pulp/server/async/
                  tasks.py", line 107, in __call__     return super(PulpTask,
                  self).__call__(*args, **kwargs)   File
                  "/usr/lib/python2.7/site-packages/celery/app/trace.py", line
                  438, in __protected_call__     return self.run(*args,
                  **kwargs)   File
                  "/home/ipanova/pulp_development/pulp/server/pulp/server/manage
                  rs/content/upload.py", line 223, in import_uploaded_unit    
                  unit_type=unit_type_id, summary=result['summary'],
                  details=result['details'] PulpCodedException: The importer
                  yum_importer indicated a failed response when uploading rpm
                  unit to repository zoo. 

After patch:

curl -k -u admin:admin -X POST -d '{"override_config": {}, "unit_type_id": "rpm", "upload_id": "11a92ebb-6344-43a7-8597-b04742fbf524", "unit_key": null, "unit_metadata": {}}' https://localhost/pulp/api/v2/repositories/zoo/actions/import_upload/ -H "Content-Type: application/json"
{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/21f98d0d-7219-4926-b65a-c88c600a608b/", "task_id": "21f98d0d-7219-4926-b65a-c88c600a608b"}], "result": null, "error": null}[ipanova@ina pulp_rpm]$ ^C
[ipanova@ina pulp_rpm] $ pulp-admin tasks details --task-id 21f98d0d-7219-4926-b65a-c88c600a608b
Warning: path should have mode 0700 because it may contain sensitive information: /home/ipanova/.pulp/

+----------------------------------------------------------------------+
                              Task Details
+----------------------------------------------------------------------+

Operations:       import_upload
Resources:        zoo (repository)
State:            Successful
Start Time:       2018-02-27T10:15:10Z
Finish Time:      2018-02-27T10:15:10Z
Result:           
  Details:      
  Success Flag: True
  Summary:      
Task Id:          21f98d0d-7219-4926-b65a-c88c600a608b
Progress Report:  

@daviddavis daviddavis merged commit 7f150cb into pulp:master Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants