Actions
Issue #6569
closedUnable to add metadata_signing_service to existing repository
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 72
Quarter:
Description
Having an existing AsciiArmoredDetachedSigningService and RPMRepository, it is not possible to add the signing service to the repository. The worker will error out with this:
pulp: rq.worker:ERROR: rest_framework.exceptions.ValidationError: {'metadata_signing_service': [ErrorDetail(string='Unexpected field', code='invalid')]}
Traceback (most recent call last):
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/worker.py", line 886, in perform_job
rv = job.perform()
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/job.py", line 664, in perform
self._result = self._execute()
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/job.py", line 670, in _execute
return self.func(*self.args, **self.kwargs)
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/pulpcore/app/tasks/repository.py", line 39, in update
serializer.is_valid(raise_exception=True)
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rest_framework/serializers.py", line 243, in is_valid
raise ValidationError(self.errors)
rest_framework.exceptions.ValidationError: {'metadata_signing_service': [ErrorDetail(string='Unexpected field', code='invalid')]}
Traceback (most recent call last):
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/worker.py", line 886, in perform_job
rv = job.perform()
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/job.py", line 664, in perform
self._result = self._execute()
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/job.py", line 670, in _execute
return self.func(*self.args, **self.kwargs)
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/pulpcore/app/tasks/repository.py", line 39, in update
serializer.is_valid(raise_exception=True)
File "/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rest_framework/serializers.py", line 243, in is_valid
raise ValidationError(self.errors)
rest_framework.exceptions.ValidationError: {'metadata_signing_service': [ErrorDetail(string='Unexpected field', code='invalid')]}
See the full http requests and responses below:
▲ src/Pulp/pulp_workdir http :24817/pulp/api/v3/repositories/rpm/rpm/f7ead468-5b89-468f-bede-030f61fd8582/
HTTP/1.1 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 402
Content-Type: application/json
Date: Fri, 24 Apr 2020 08:17:36 GMT
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"description": null,
"latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/f7ead468-5b89-468f-bede-030f61fd8582/versions/0/",
"metadata_signing_service": null,
"name": "foo",
"pulp_created": "2020-04-24T08:03:29.906931Z",
"pulp_href": "/pulp/api/v3/repositories/rpm/rpm/f7ead468-5b89-468f-bede-030f61fd8582/",
"versions_href": "/pulp/api/v3/repositories/rpm/rpm/f7ead468-5b89-468f-bede-030f61fd8582/versions/"
}
▲ src/Pulp/pulp_workdir http :24817/pulp/api/v3/signing-services/76df3b27-b955-4001-82c0-7989df073096/
HTTP/1.1 200 OK
Allow: GET, HEAD, OPTIONS
Connection: close
Content-Length: 205
Content-Type: application/json
Date: Fri, 24 Apr 2020 08:17:47 GMT
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"name": "sign-metadata",
"pulp_created": "2020-04-24T08:01:41.459819Z",
"pulp_href": "/pulp/api/v3/signing-services/76df3b27-b955-4001-82c0-7989df073096/",
"script": "/home/lieter/src/Pulp/pulp_workdir/sign.sh"
}
▲ src/Pulp/pulp_workdir http PATCH :24817/pulp/api/v3/repositories/rpm/rpm/f7ead468-5b89-468f-bede-030f61fd8582/ metadata_signing_service=/pulp/api/v3/signing-services/76df3b27-b955-4001-82c0-7989df073096/
HTTP/1.1 202 Accepted
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 67
Content-Type: application/json
Date: Fri, 24 Apr 2020 08:18:06 GMT
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"task": "/pulp/api/v3/tasks/54c1b300-daa3-4b14-8288-ffa23195b0aa/"
}
▲ src/Pulp/pulp_workdir http :24817/pulp/api/v3/tasks/54c1b300-daa3-4b14-8288-ffa23195b0aa/
HTTP/1.1 200 OK
Allow: GET, PATCH, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 1429
Content-Type: application/json
Date: Fri, 24 Apr 2020 08:18:19 GMT
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"child_tasks": [],
"created_resources": [],
"error": {
"description": "{'metadata_signing_service': [ErrorDetail(string='Unexpected field', code='invalid')]}",
"traceback": " File \"/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/worker.py\", line 886, in perform_job\n rv = job.perform()\n File \"/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/job.py\", line 664, in perform\n self._result = self._execute()\n File \"/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rq/job.py\", line 670, in _execute\n return self.func(*self.args, **self.kwargs)\n File \"/home/lieter/src/Pulp/pulpcore/pulpcore/app/tasks/repository.py\", line 39, in update\n serializer.is_valid(raise_exception=True)\n File \"/home/lieter/.virtualenvs/pulp3-devel/lib/python3.8/site-packages/rest_framework/serializers.py\", line 243, in is_valid\n raise ValidationError(self.errors)\n"
},
"finished_at": "2020-04-24T08:18:06.781140Z",
"name": "pulpcore.app.tasks.repository.update",
"parent_task": null,
"progress_reports": [],
"pulp_created": "2020-04-24T08:18:06.705529Z",
"pulp_href": "/pulp/api/v3/tasks/54c1b300-daa3-4b14-8288-ffa23195b0aa/",
"reserved_resources_record": [
"/pulp/api/v3/repositories/rpm/rpm/f7ead468-5b89-468f-bede-030f61fd8582/"
],
"started_at": "2020-04-24T08:18:06.764787Z",
"state": "failed",
"task_group": null,
"worker": "/pulp/api/v3/workers/fcb1a9f7-3b94-4c04-8183-1ca3bc84bf49/"
}
Creating a new repository with a signing service does work:
▲ src/Pulp/pulp_rpm http :24817/pulp/api/v3/repositories/rpm/rpm/ name="bar" metadata_signing_service='/pulp/api/v3/signing-services/76df3b27-b955-4001-82c0-7989df073096/'
HTTP/1.1 201 Created
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 489
Content-Type: application/json
Date: Fri, 24 Apr 2020 08:37:01 GMT
Location: /pulp/api/v3/repositories/rpm/rpm/7ed592d8-2aa1-4da9-b37f-bbeac50b8cb4/
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"description": null,
"latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/7ed592d8-2aa1-4da9-b37f-bbeac50b8cb4/versions/0/",
"metadata_signing_service": "http://localhost:24817/pulp/api/v3/signing-services/76df3b27-b955-4001-82c0-7989df073096/",
"name": "bar",
"pulp_created": "2020-04-24T08:37:01.614998Z",
"pulp_href": "/pulp/api/v3/repositories/rpm/rpm/7ed592d8-2aa1-4da9-b37f-bbeac50b8cb4/",
"versions_href": "/pulp/api/v3/repositories/rpm/rpm/7ed592d8-2aa1-4da9-b37f-bbeac50b8cb4/versions/"
}
Installed versions:
Pulpcore: 3.4.0.dev (d522ac42a4d418b42ae244cccb1264a3c6c833ca) Pulp-rpm: 3.4.0b1.dev (f57c667026ca88f04547d1bbe4c18d0809ab9d51)
Actions
Revamp Repository tasks
Repository update and delete now use general_update and general_delete, which automatically select the proper resources to work on.
fixes #6569 https://pulp.plan.io/issues/6569