add_enable_repo loses proxy configuration
bhavanki opened this issue · 1 comments
When running repoquery on a host that requires a proxy to access the internet, I'm getting failures reaching a repository specified through the --repofrompath option. Given the option --repofrompath="Cloudera Manager,https://archive.cloudera.com/cm6/6.0.0/redhat7/yum"
, the following error appears repeatedly.
https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/repodata/repomd.xml: [Errno 12] Timeout on https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
It seems that when the repository definition in the option is added by repoquery using add_enable_repo, the proxy configuration in /etc/yum.conf is not preserved. If I add the following lines to the add_enable_repo function, before adding the newly defined repo to self.repos, the error goes away.
newrepo.proxy = self.conf.proxy
newrepo.proxy_username = self.conf.proxy_username
newrepo.proxy_password = self.conf.proxy_password
However, this doesn't seem to be the right fix. There's lots of logic that should be able to surface the proxy settings from /etc/yum.conf (along with everything else that could be in there), but I can't figure out (yet) where they are getting lost.