Issue #4063
closedAttributeError: 'RpmRemote' object has no attribute '_download_factory' if something failed during factory instantiation
Description
I tried to sync from CDN https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/,
I set ssl_client_certificate and ssl_client_key on a Remote.
SSL cert/key are in PEM format.
Sync failed:
Oct 05 15:04:13 pulp3 rq[18441]: Traceback (most recent call last):
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp/plugin/pulpcore/plugin/models/remote.py", line 40, in download_factory
Oct 05 15:04:13 pulp3 rq[18441]: return self._download_factory
Oct 05 15:04:13 pulp3 rq[18441]: AttributeError: 'RpmRemote' object has no attribute '_download_factory'
Oct 05 15:04:13 pulp3 rq[18441]: During handling of the above exception, another exception occurred:
Oct 05 15:04:13 pulp3 rq[18441]: Traceback (most recent call last):
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/rq/worker.py", line 793, in perform_job
Oct 05 15:04:13 pulp3 rq[18441]: rv = job.perform()
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/rq/job.py", line 599, in perform
Oct 05 15:04:13 pulp3 rq[18441]: self._result = self._execute()
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/.virtualenvs/pulp/lib64/python3.6/site-packages/rq/job.py", line 605, in _execute
Oct 05 15:04:13 pulp3 rq[18441]: return self.func(*self.args, **self.kwargs)
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp_rpm/pulp_rpm/app/tasks/synchronizing.py", line 70, in synchronize
Oct 05 15:04:13 pulp3 rq[18441]: loop.run_until_complete(pipeline)
Oct 05 15:04:13 pulp3 rq[18441]: File "/usr/lib64/python3.6/asyncio/base_events.py", line 468, in run_until_complete
Oct 05 15:04:13 pulp3 rq[18441]: return future.result()
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp/plugin/pulpcore/plugin/stages/api.py", line 128, in create_pipeline
Oct 05 15:04:13 pulp3 rq[18441]: await asyncio.gather(*futures)
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp_rpm/pulp_rpm/app/tasks/synchronizing.py", line 192, in __call__
Oct 05 15:04:13 pulp3 rq[18441]: 'repodata/repomd.xml'))
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp/plugin/pulpcore/plugin/models/remote.py", line 61, in get_downloader
Oct 05 15:04:13 pulp3 rq[18441]: return self.download_factory.build(url, **kwargs)
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp/plugin/pulpcore/plugin/models/remote.py", line 42, in download_factory
Oct 05 15:04:13 pulp3 rq[18441]: self._download_factory = DownloaderFactory(self)
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp/plugin/pulpcore/plugin/download/factory.py", line 59, in __init__
Oct 05 15:04:13 pulp3 rq[18441]: self._session = self._make_aiohttp_session_from_remote()
Oct 05 15:04:13 pulp3 rq[18441]: File "/home/vagrant/devel/pulp/plugin/pulpcore/plugin/download/factory.py", line 84, in _make_aiohttp_session_from_remote
Oct 05 15:04:13 pulp3 rq[18441]: self._remote.ssl_client_certificate.name
Oct 05 15:04:13 pulp3 rq[18441]: ssl.SSLError: [SSL] PEM lib (_ssl.c:3423)
This issue is to track AttributeErro only.
SSL error is tracked separately: https://pulp.plan.io/issues/4062
Updated by jortel@redhat.com about 6 years ago
The AttributeError is anticipated and caught. But, the DownloadFactory.__init__() is raising an SSL exception in this case due to the issue fixed on #4063. However, It's reasonable to assume that DownloadFactory.__init__() could fail for any number of other reasons. The trace in the logged exception would be much clearer if the Remote._download_factory was initialized properly and the property did not rely on the AttributeError and instead tested to see if _download_factory had been assigned.
This should be cleaned up but I don't think it's a blocker.
Updated by daviddavis about 4 years ago
- Status changed from NEW to CLOSED - WORKSFORME