I’m working on converting the perl script to work with pulp 3 here: https://github.com/mattatnersc/pulp_centos_errata_import. I’ve converted the various “pulp” calls to API calls. It worked, then it stopped working and now I’m baffled. If anyone can figure out why a file like this doesn’t upload, then we’ll be in business:
{
"status": "final",
"version": "1",
"release": "2.el8",
"description": "Not available",
"pkglist": [
{
"packages": [
{
"epoch": "0",
"filename": "watchdog-5.15-2.el8.x86_64.rpm",
"version": "5.15",
"arch": "x86_64",
"name": "watchdog",
"release": "2.el8"
}
],
"name": "collection-0",
"shortname": ""
}
],
"issued_date": "2021-11-09 00:00:00",
"summary": "CentOS watchdog Update",
"references": [
{
"href": "https://access.redhat.com/errata/RHBA-2021:4379",
"type": "Bug Fix Advisory",
"title": "CentOS watchdog Update",
"id": "CEBA-2021:4379"
}
],
"id": "CEBA-2021:4379",
"updated_date": "2021-11-09 00:00:00",
"type": "bugfix",
"title": "CentOS watchdog Update",
"severity": "",
"fromstr": "email@steve-meier.de"
}
http \
--cert ~/.pulp/cert.pem \
--cert-key ~/.pulp/priv.pem \
--form POST \
'https://foreman.example.com/pulp/api/v3/content/rpm/advisories/' \
file@./"$JSON_FILE" \
repository='/pulp/api/v3/repositories/rpm/rpm/bba16ffb-1796-4dca-1234-9dd63432c743/'
The resulting task complains of:
{
"pulp_href": "/pulp/api/v3/tasks/dfd45719-9b8a-497c-a4e6-b7862ebe51f5/",
"pulp_created": "2021-12-16T23:24:23.950390Z",
"state": "failed",
"name": "pulpcore.app.tasks.base.general_create_from_temp_file",
"logging_cid": "f8a8f7f331bd4ae786d9f5246bb03788",
"started_at": "2021-12-16T23:24:24.281947Z",
"finished_at": "2021-12-16T23:24:24.613998Z",
"error": {
"traceback": " File \"/usr/lib/python3.6/site-packages/pulpcore/tasking/pulpcore_worker.py\", line 317, in _perform_task\n result = func(*args, **kwargs)\n File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/base.py\", line 18, in general_create_from_temp_file\n general_create(app_label, serializer_name, data=data, *args, **kwargs)\n File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/base.py\", line 35, in general_create\n serializer.save()\n File \"/usr/lib/python3.6/site-packages/rest_framework/serializers.py\", line 205, in save\n self.instance = self.create(validated_data)\n File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/serializers/advisory.py\", line 135, in create\n raise serializers.ValidationError(\"Advisory already exists in Pulp.\")\n",
"description": "[ErrorDetail(string='Advisory already exists in Pulp.', code='invalid')]"
},
"worker": "/pulp/api/v3/workers/a5fe8c87-d11a-495b-b60f-b1cb731dcc6d/",
"parent_task": null,
"child_tasks": [],
"task_group": null,
"progress_reports": [],
"created_resources": [],
"reserved_resources_record": [
"/pulp/api/v3/repositories/rpm/rpm/bba16ffb-1796-4dca-1234-9dd63432c743/"
]
}