Project

Profile

Help

Issue #2082

closed

Cannot add importer to the repository

Added by Ichimonji10 over 7 years ago. Updated almost 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
3. High
Version:
Master
Platform Release:
2.10.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Sprint 6
Quarter:

Description

It's possible to add an ISO importer to an RPM repository by making an HTTP post request to /pulp/api/v2/repositories/{repo_id}/importers/, with a body of {"importer_type_id": "iso_importer"}. Under the current development version of Pulp (2.10), this fails with an HTTP 500 error. The following message is dumped to the system log:

Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: Unhandled Exception
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000) 'unicode' object has no attribute 'to_transfer_repo'
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000) Traceback (most recent call last):
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     return self.dispatch(request, *args, **kwargs)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     return handler(request, *args, **kwargs)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 241, in _auth_decorator
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     return _verify_auth(self, operation, super_user_only, method, *args, **kwargs)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/decorators.py", line 195, in _verify_auth
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     value = method(self, *args, **kwargs)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/util.py", line 130, in wrapper
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     return func(*args, **kwargs)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/pulp/server/webservices/views/repositories.py", line 341, in post
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     importer_controller.validate_importer_config(repo_id, importer_type, config)
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)   File "/usr/lib/python2.7/site-packages/pulp/server/controllers/importer.py", line 145, in validate_importer_config
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000)     transfer_repo = repo_obj.to_transfer_repo()
Jul 18 10:22:18 pulp.example.com pulp[6541]: pulp.server.webservices.middleware.exception:ERROR: (6541-28000) AttributeError: 'unicode' object has no attribute 'to_transfer_repo'

You can reproduce this error by executing the following:

python -m unittest2 pulp_smash.tests.rpm.api_v2.test_iso_crud.AddImporterDistributorTestCase

For more information about the test:

Actions #2

Updated by ipanova@redhat.com over 7 years ago

  • Project changed from RPM Support to Pulp
  • Subject changed from Cannot add ISO importer to RPM repository to Cannot add importer to the repository
  • Category set to 14
  • Tags Easy Fix added

This issue is present not just for iso importer but for all of them since the bug is in platform
Line that creates the problem https://github.com/pulp/pulp/blob/master/server/pulp/server/webservices/views/repositories.py#L341

Actions #3

Updated by ipanova@redhat.com over 7 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ipanova@redhat.com
Actions #4

Updated by amacdona@redhat.com over 7 years ago

  • Priority changed from Normal to High
  • Severity changed from 2. Medium to 3. High
  • Triaged changed from No to Yes
Actions #5

Updated by ipanova@redhat.com over 7 years ago

  • Status changed from ASSIGNED to POST
Actions #6

Updated by ipanova@redhat.com over 7 years ago

  • Sprint/Milestone set to 24

Added by ipanova@redhat.com over 7 years ago

Revision 3811a335 | View on GitHub

Cannot add importer to the repository.

closes #2082 https://pulp.plan.io/issues/2082

Added by ipanova@redhat.com over 7 years ago

Revision 3811a335 | View on GitHub

Cannot add importer to the repository.

closes #2082 https://pulp.plan.io/issues/2082

Actions #7

Updated by ipanova@redhat.com over 7 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #8

Updated by ipanova@redhat.com over 7 years ago

  • Platform Release set to 2.10.0
Actions #9

Updated by semyers over 7 years ago

  • Status changed from MODIFIED to 5
Actions #10

Updated by Ichimonji10 over 7 years ago

  • Status changed from 5 to 6

Tested against a Pulp 2.10.0 beta system provisioned this morning. Tested with Pulp Smash by commenting out references to this issue and running the relevant tests, and ensuring that the tests passed.

(pulp-smash2) [ichimonji10@beech:pulp-smash]$ python -m unittest2 pulp_smash.tests.rpm.api_v2.test_iso_crud.AddImporterDistributorTestCase
....
----------------------------------------------------------------------
Ran 4 tests in 16.665s

OK
(pulp-smash2) [ichimonji10@beech:pulp-smash]$ git diff
diff --git a/pulp_smash/tests/rpm/api_v2/test_iso_crud.py b/pulp_smash/tests/rpm/api_v2/test_iso_crud.py
index 5cd04e6..c134230 100644
--- a/pulp_smash/tests/rpm/api_v2/test_iso_crud.py
+++ b/pulp_smash/tests/rpm/api_v2/test_iso_crud.py
@@ -222,9 +222,9 @@ class AddImporterDistributorTestCase(utils.BaseAPITestCase):
         4. Re-read the repository's importers and distributors.
         """
         super(AddImporterDistributorTestCase, cls).setUpClass()
-        if (cls.cfg.version >= Version('2.10') and
-                selectors.bug_is_untestable(2082, cls.cfg.version)):
-            raise SkipTest('https://pulp.plan.io/issues/2082')
+        # if (cls.cfg.version >= Version('2.10') and
+        #         selectors.bug_is_untestable(2082, cls.cfg.version)):
+        #     raise SkipTest('https://pulp.plan.io/issues/2082')

         # Steps 1 and 2.
         client = api.Client(cls.cfg, api.json_handler)
(pulp-smash2) [ichimonji10@beech:pulp-smash]$ ssh $hostname rpm -qa | sort | grep -i pulp
pulp-admin-client-2.10.0-0.4.beta.fc24.noarch
pulp-docker-admin-extensions-2.1.0-0.2.beta.fc24.noarch
pulp-docker-plugins-2.1.0-0.2.beta.fc24.noarch
pulp-ostree-admin-extensions-1.1.3-1.fc24.noarch
pulp-ostree-plugins-1.1.3-1.fc24.noarch
pulp-puppet-admin-extensions-2.10.0-0.1.beta.fc24.noarch
pulp-puppet-plugins-2.10.0-0.1.beta.fc24.noarch
pulp-python-admin-extensions-1.1.3-1.fc24.noarch
pulp-python-plugins-1.1.3-1.fc24.noarch
pulp-rpm-admin-extensions-2.10.0-0.4.beta.fc24.noarch
pulp-rpm-plugins-2.10.0-0.4.beta.fc24.noarch
pulp-selinux-2.10.0-0.4.beta.fc24.noarch
pulp-server-2.10.0-0.4.beta.fc24.noarch
python-kombu-3.0.33-6.pulp.fc24.noarch
python-pulp-bindings-2.10.0-0.4.beta.fc24.noarch
python-pulp-client-lib-2.10.0-0.4.beta.fc24.noarch
python-pulp-common-2.10.0-0.4.beta.fc24.noarch
python-pulp-docker-common-2.1.0-0.2.beta.fc24.noarch
python-pulp-oid_validation-2.10.0-0.4.beta.fc24.noarch
python-pulp-ostree-common-1.1.3-1.fc24.noarch
python-pulp-puppet-common-2.10.0-0.1.beta.fc24.noarch
python-pulp-python-common-1.1.3-1.fc24.noarch
python-pulp-repoauth-2.10.0-0.4.beta.fc24.noarch
python-pulp-rpm-common-2.10.0-0.4.beta.fc24.noarch
python-pulp-streamer-2.10.0-0.4.beta.fc24.noarch
Actions #11

Updated by semyers over 7 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE
Actions #13

Updated by bmbouter about 6 years ago

  • Sprint set to Sprint 6
Actions #14

Updated by bmbouter about 6 years ago

  • Sprint/Milestone deleted (24)
Actions #15

Updated by bmbouter almost 5 years ago

  • Tags Pulp 2 added
Actions #16

Updated by bmbouter almost 4 years ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Also available in: Atom PDF