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

No Proxy Settings in Setup Phase #821

Closed
LevonBecker opened this issue Aug 25, 2015 · 9 comments
Closed

No Proxy Settings in Setup Phase #821

LevonBecker opened this issue Aug 25, 2015 · 9 comments
Labels

Comments

@LevonBecker
Copy link

So the client I'm currently working for has an obnoxious proxy that requires creds etc.

Environment

  • Mac OS X Yosemite
  • ChefDK 0.7.0
    • Kitchen 1.4.2
    • kitchen-vagrant 0.18.0
  • VirtualBox 5.0.0
  • Vagrant 1.7.4
  • Charles Proxy 3.10.2
  • CentOS 6.6/7.1 Guest

Kitchen Config (.kitchen.yml)

provisioner:
  name: chef_zero
  require_chef_omnibus: 12.3.0
  http_proxy: http://10.0.2.2:8888
  https_proxy: http://10.0.2.2:8888
  no_proxy: 'localhost,127.0.0.1,10.0.2.,33.33.33.,.customerdomain.com'

Proxy Settings Not Included in Setup/Verfy Stage

Adding the above to the .kitchen.yml fixes everything up to the phase where it needs to download Gems for ServerSpec. It seems the proxy is not set during the _setup_ stage.

As a test I added the following to the vagrant user _~/.bashrc_ and it _Fixes_ the problem.

export http_proxy=http://10.0.2.2:8888
export https_proxy=https://10.0.2.2:8888
export no_proxy=localhost,127.0.0.1,10.0.2.,33.33.33.,.customerdomain.com

Charles Proxy is basically a application that runs your own local proxy that you point all you Dev tools to and it saves your creds securely and in one spot (Easier for when changing password). So from a Vagrant guest to get to the hosted system it's IP 10.0.2.2 blah, and whatever port you tell Charles Proxy to listen on 8888 blah.

Bam, that fixes the issue. Which proves that the proxy is not getting set by the Kitchen code during the _setup_ stage.

I have not had time to dig into the Kitchen code to find exactly where the problem is... If I have time I will.

Errror

-----> Starting Kitchen (v1.4.2)
-----> Setting up <base-rh-centos-66>...
       Finished setting up <base-rh-centos-66> (0m0.00s).
-----> Verifying <base-rh-centos-66>...
       Preparing files for transfer
-----> Installing Busser (busser)
       ERROR:  Could not find a valid gem 'busser' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/specs.4.8.gz)
       sh: line 23: /tmp/verifier/gems/bin/busser: No such file or directory
       Installing Busser plugins: busser-serverspec
       sudo: /tmp/verifier/bin/busser: command not found
>>>>>> Verify failed on instance <base-rh-centos-66>.
>>>>>> Please see .kitchen/logs/base-rh-centos-66.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '

BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE
ruby="/opt/chef/embedded/bin/ruby"
gem="/opt/chef/embedded/bin/gem"
version="busser"
gem_install_args="busser --no-rdoc --no-ri"
busser="sudo -E /tmp/verifier/bin/busser"
plugins="busser-serverspec"

$gem list busser -i 2>&1 >/dev/null
if test $? -ne 0; then
  echo "-----> Installing Busser ($version)"
  $gem install $gem_install_args
else
  echo "-----> Busser installation detected ($version)"
fi

if test ! -f "$BUSSER_ROOT/bin/busser"; then
  gem_bindir=`$ruby -rrubygems -e "puts Gem.bindir"`
  $gem_bindir/busser setup
fi

echo "       Installing Busser plugins: $plugins"
$busser plugin install $plugins
']
>>>>>> ----------------------
zlib(finalizer): the stream was freed prematurely.

Thanks in advance for any help!

-=Levon

@LevonBecker LevonBecker changed the title Damn Proxy! :) No Proxy Settings in Verify Phase Aug 25, 2015
@LevonBecker LevonBecker changed the title No Proxy Settings in Verify Phase No Proxy Settings in Setup Phase Aug 25, 2015
@fnichol
Copy link
Contributor

fnichol commented Aug 26, 2015

Wow, thank you for such a thorough report! I can confirm that this is an issue and will need a fix in the Busser gem to make it proxy-aware.

@LevonBecker
Copy link
Author

Glad to help :)

@acqant
Copy link

acqant commented Oct 6, 2015

+1

@jblaine
Copy link

jblaine commented Oct 27, 2015

+12

@eriepasquare
Copy link

+1

@gurumaia
Copy link

gurumaia commented Dec 4, 2015

Also being impacted by this, using the Docker driver:

-----> Setting up <default-centos-64>...
$$$$$$ Running legacy setup for 'Docker' Driver
-----> Installing Busser (busser)
       ERROR:  Could not find a valid gem 'busser' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Connection timed out - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/specs.4.8.gz)
       sh: line 23: /tmp/verifier/gems/bin/busser: No such file or directory
       Installing Busser plugins: busser-serverspec
       sudo: /tmp/verifier/bin/busser: command not found

AFAIK, this is not to do with the busser gem, but with the gem process not using the proxy to fetch any gems, in this case busser. I'll try @LevonBecker's workaround.

@gurumaia
Copy link

gurumaia commented Dec 4, 2015

I can confirm that the workaround works.

@acqant
Copy link

acqant commented Dec 17, 2015

Not working for me anymore
When I kitchen login I see no_proxy set but when the gem wants to install it's not getting passed into the script.

vagrant@kitchen-bvlt-r1nBase:~$ cat /proc/15713/cmdline 
sh-c
http_proxy="http://devproxyfarm:82/"; export http_proxy
HTTP_PROXY="http://devproxyfarm:82/"; export HTTP_PROXY
https_proxy="http://devproxyfarm:82/"; export https_proxy
HTTPS_PROXY="http://devproxyfarm82/"; export HTTPS_PROXY

@cheeseplus
Copy link

Going to close this in favor of more actionable issue on busser - I copied the issue text directly and thanks again for the report!

test-kitchen/busser#33

@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants