Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable yum proxy #54

Closed
johnbellone opened this issue Feb 25, 2014 · 14 comments
Closed

Cannot disable yum proxy #54

johnbellone opened this issue Feb 25, 2014 · 14 comments
Assignees
Labels

Comments

@johnbellone
Copy link
Contributor

Using the following Vagrantfile (and setting the environment variables) does not seem to work:

Vagrant.configure('2') do |config|
  config.yum_proxy.http = false
end

Where the environment variables are:

VAGRANT_HTTP_PROXY=$HTTP_PROXY
VAGRANT_HTTPS_PROXY=$HTTPS_PROXY

I've also tried setting VAGRANT_YUM_HTTP_PROXY to nil and it also does not work. Unfortunately I run into this because the image I am provisioning on is already setup with a local RedHat satellite cache for RPMs.

@johnbellone johnbellone self-assigned this Feb 25, 2014
@tmatilai
Copy link
Owner

Hmm, config.yum_proxy.http = false should have higher precedence as VAGRANT_HTTP_PROXY environment variable. But it causes the proxy settings to be removed from the yum config. Is that what you are seeing?

The false for environment variables is empty string. nil causes the variable to not be set at all.

But yeah, I didn't think there would be need for ignoring a config while configuring globally otherwise. I think I'll introduce the enabled attribute to all config classes. I.e. config.yum_proxy.enabled = false and VAGRANT_YUM_PROXY=. I had already planned (and maybe even started, can't remember) some refactoring for those config classes so this fits well there.

But might take some days, as I'm still recovering from an intercontinental moving with my family. =)

@olekhy
Copy link

olekhy commented May 20, 2014

hi@all
It is not possible to work with buggig plugin because proxy for yum is always false and yum can not get network connection on instal/update needed packages.

below maybe helpful outputs to fix this behav. thx for the fixation in advance!

Error: Could not prefetch package provider 'yum': Execution of '/usr/bin/python /usr/lib/ruby/site_ruby/1.8/puppet/provider/package/yumhelper.py' returned 1: Loaded plugins: fastestmirror, presto, versionlock
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 5 - "Couldn't resolve proxy 'false'"
Traceback (most recent call last):
  File "/usr/lib/ruby/site_ruby/1.8/puppet/provider/package/yumhelper.py", line 115, in <module>
    ypl = pkg_lists(my)
  File "/usr/lib/ruby/site_ruby/1.8/puppet/provider/package/yumhelper.py", line 40, in pkg_lists
    my.doTsSetup()
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 84, in doTsSetup
    return self._getTs()
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
    self._getTsInfo(remove_only)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
    pkgSack = self.pkgSack
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 887, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 669, in _getSacks
    self.repos.populateSack(which=repos)
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 279, in populateSack
    self.doSetup()
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 105, in doSetup
    self.ayum.plugins.run('postreposetup')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/fastestmirror.py", line 197, in postreposetup_hook
    if downgrade_ftp and _len_non_ftp(repo.urls) == 1:
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 699, in <lambda>
    urls = property(fget=lambda self: self._geturls(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 696, in _geturls
    self._baseurlSetup()
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 662, in _baseurlSetup
    self.check()
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 426, in check
    'Cannot find a valid baseurl for repo: %s' % self.id
yum.Errors.RepoError: Cannot find a valid baseurl for repo: base

BTW I get trouble with setting of proxy for npm here is the output for

% vagrant provision
[default] Configuring proxy environment variables...
[default] Configuring proxy for npm...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/usr/bin/npm config delete proxy

Stdout from the command:



Stderr from the command:

npm ERR! Error: ENOENT, unlink '/root/.npmrc'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 2.6.32-431.3.1.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "config" "delete" "proxy"
npm ERR! cwd /home/vagrant
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.6
npm ERR! path /root/.npmrc
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/vagrant/npm-debug.log
npm ERR! not ok code 0

1

and cut from Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    # auto detect proxy values from environment
    # ===============================
    config.proxy.http     = ENV['HTTP_PROXY']  || ENV['http_proxy']  || ''
    config.proxy.https    = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ''
    config.proxy.ftp      = ENV['FTP_PROXY']   || ENV['ftp_proxy']   || ''
    config.proxy.no_proxy = ENV['NO_PROXY']    || ENV['no_proxy']    || ''

@tmatilai
Copy link
Owner

@olekhy what vagrant-proxyconf version are you using? Could you please add a link to a gist of full --debug output of a failed Vagrant run.

@olekhy
Copy link

olekhy commented May 21, 2014

  1. % vagrant destroy
  2. % vagrant plugin install vagrant-proxyconf
    Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...  
    Installed the plugin 'vagrant-proxyconf (1.3.1)'!`  
  3. % vagrant up --debug produce error npm remove proxy see vagrant.debug.log
  4. I've get fixed by creating empty file /root/.npmrc as u see in vagrant.debug.log at line 34847 after log in vagrant box.
    npm ERR! Error: ENOENT, unlink '/root/.npmrc'
  5. % vagrant provision --debug
  6. show the ERROR message exact on line 52693 in vagrant.provision.debug.log
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 5 - "Couldn't resolve proxy 'false'"
´´´

@tmatilai
Copy link
Owner

@olekhy thanks a lot, the information really helps!

The first issue is clearly an NPM bug. IT has been reported multiple times (and even by you!): npm/npm#5065, npm/npm#5160, npm/npm#5223. But we can hack around it by creating the rc file if needed.

The yum issue is still a mystery. Based on the logs it seems that vagrant-proxyconf works as expected. I have to see if I can reproduce it (on CentOS I guess).

@olekhy
Copy link

olekhy commented May 22, 2014

Yep centos6. If needed I can paste an URL to the box which we used in vagrant.

@tmatilai
Copy link
Owner

That would probably help. I don't normally work with CentOS and have been using some Bento boxes for testing.

@tmatilai
Copy link
Owner

Sorry, haven't found time for this yet. Trying hard on Thursday.

@olekhy
Copy link

olekhy commented May 27, 2014

Many thx for this because I work by the (crappy) way at office need to install proxyconf and set up proxy in Vagrantfile otherwise at home reverting all.

tmatilai added a commit that referenced this issue May 29, 2014
tmatilai added a commit that referenced this issue May 29, 2014
@tmatilai
Copy link
Owner

@olekhy OK, finally found the time to reproduce the yum issue, and it was actually bug in writing /etc/environment. That and the npm issue should now be fixed in master. I plan on releasing them tomorrow.

@tmatilai
Copy link
Owner

tmatilai commented Jul 7, 2014

Fyi, the npm bug should be fixed in npm v1.4.17 and later.

And the yum bug in vagrant-proxyconf v1.3.2.

@tmatilai tmatilai closed this as completed Jul 7, 2014
@olekhy
Copy link

olekhy commented Jul 7, 2014

thx 🙇

@pdxjohnny
Copy link

fastestmirror still causes issues https://wiki.centos.org/PackageManagement/Yum/FastestMirror says

If you are using the default CentOS configuration, and if you are not behind a proxy server, fastestmirror is highly recommended.

So I think it should be disabled because we are behind a proxy server, I am still having issues with it.

sudo sed -i 's/.*enabled=.*/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf

patch #148 disables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants