test-kitchen / busser

Kitchen Busser - Runs tests for projects in test-kitchen
Other
45 stars 17 forks source link

Kitchen and Busser are ignoring the http_proxy parameter (and it doesn't have a gem source option) #37

Closed dfduarte closed 2 years ago

dfduarte commented 8 years ago

Hello there,

Recently, I started to use Kitchen to make some tests on our cookbooks here. As part of our framework, these cookbooks must be tested on our AWS environment, to assure their reliability and working.

Given that, I made the following kitchen yml file:


---
driver:
  driver_config:
  name: ec2
  aws_ssh_key_id: xxxxxxxxxxxxKey
  shared_credentials_profile: default
  require_chef_omnibus: true
  region: us-east-1
  iam_profile_name: xxxxxxxxxxIAM
  instance_type: t2.large
  associate_public_ip: false
  interface: private

transport:
  ssh_key: '/Users/xxxxx/workspace/Keys/xxxxxx.pem'
  connection_timeout: 10
  connection_retries: 5
  ssh_timeout: 5
  username: centos

provisioner:
  name: chef_zero
  http_proxy: 'http://xxxxxx:3128'
  https_proxy: 'http://xxxx:3128'
  require_chef_omnibus: '12.12.15'
  nodes_path: 'test/nodes'

platforms:
  - name: centos-7.1
    driver:
      image_id: ami-xxxxxxxx
      subnet_id:  subnet-4xxxxxx
      security_group_ids: ["sg-xxxxxxx"]

suites:
  - name: default
    http_proxy: 'http://xxxx:3128'
    https_proxy: 'http://xxxx:3128'
    run_list:
      - recipe[squid-aws::default]
    attributes:
      ddnsupdate:
        no_ddnssec: true
        use_resolv_conf: true
        ttl: 300
      yum:
        main:
          proxy: 'http://xxxxx:3128'

Everything works and has been converged, and we need proxy for every installation at this machine, because our instances there aren't exposed to the internet directly.

But, when we hit the Busser installation stage, we got this:

-----> Verifying <default-centos-71>...
       Preparing files for transfer
D      Creating local sandbox in /var/folders/tl/lcf69pls00q84xm27bxc9b75_fdjrs/T/default-centos-71-sandbox-20160720-72793-1x6udaz
D      [SSH] reusing existing connection centos@10.157.57.233<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>10, :keys_only=>true, :keys=>["/Users/dduarte/workspace/Keys/3cSharedLab.pem"], :auth_methods=>["publickey"], :user=>"centos"}>
D      [SSH] centos@10.157.57.233<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>10, :keys_only=>true, :keys=>["/Users/dduarte/workspace/Keys/3cSharedLab.pem"], :auth_methods=>["publickey"], :user=>"centos"}> (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 --no-format-executable -n /tmp/verifier/bin --no-user-install"
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
  $busser setup
fi

echo "       Installing Busser plugins: $plugins"
$busser plugin install $plugins
')
-----> Installing Busser (busser)
^CD      Cleaning up local sandbox in /var/folders/tl/lcf69pls00q84xm27bxc9b75_fdjrs/T/default-centos-71-sandbox-20160720-72793-1x6udaz
D      [SSH] shutting previous connection centos@xxxxxxxxxxxxx<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>10, :keys_only=>true, :keys=>["/Users/xxxx/workspace/Keys/xxxxxxxx.pem"], :auth_methods=>["publickey"], :user=>"centos"}>
D      [SSH] closing connection to centos@1xxxxxxxx<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>10, :keys_only=>true, :keys=>["/Users/dxxxxxxx/workspace/Keys/xxxxxxxx.pem"], :auth_methods=>["publickey"], :user=>"centos"}>

And the installs hangs for good on "installing busser"

I tried a lot of http_proxy combinations on kitchen yml file, but they haven't worked, and Busser's installation behaves as the same way, not using the proxy.

Any suggestions?

dfduarte commented 8 years ago

Oh additionally: I know Busser is a RubyGem. Would be good, if the mentioned above is not fixable, at least there is a way to pass a remote ruby gem repository.

We use a local Artifactory server as well, and have a way to use it to get the gems, at least, would be good (os is there a way to do that?)

backtorod commented 8 years ago

Hi dfduarte,

Any look with your issue? We are having the same issue with ChefDK 0.10.0

Cheers, Rod

dfduarte commented 8 years ago

@rguareschi A Chef engineer from my company gave me an alternative solution, that is creating a fixture putting a new file in /etc/profile.d with the proxy, or even inside the cookbook.

As the http_proxy it's a requirement for my demand here, I put it directly as a cookbook_file during the provisioning. It worked, since Busser opens a new Kitchen SSH session after provisioning the cookbook. For some reason, it worked for me.

But of course, a http_proxy param for busser would be a neater solution

backtorod commented 8 years ago

Hi @dfduarte thanks for the follow up. I got it working and my kitchen test is working perfectly now setting 3 lines in the kitchen.yml file as per our friend xsmaster https://github.com/test-kitchen/busser/issues/33

I've added this in the driver declaration:

http_proxy: http://<your_proxy:port> https_proxy: http://<your_proxy:port> no_proxy: "<anything_to_bypass>

Have you tried this?

Cheers, Rod

damacus commented 2 years ago

Closing due to inactivity.

If this is still an issue please reopen or open another issue.

Thanks, Test-Kitchen Maintainers