Coder Social home page Coder Social logo

beaker-vagrant's Introduction

beaker-vagrant

License Test codecov Release RubyGem Version RubyGem Downloads Donated by Puppet Inc

Beaker library to use vagrant hypervisor

How to use this wizardry

This is a gem that allows you to use hosts with vagrant hypervisor with beaker.

With Beaker 3.x

This library is included as a dependency of Beaker 3.x versions, so there's nothing to do.

With Beaker 4.x

As of Beaker 4.0, all hypervisor and DSL extension libraries have been removed and are no longer dependencies. In order to use a specific hypervisor or DSL extension library in your project, you will need to include them alongside Beaker in your Gemfile or project.gemspec. E.g.

# Gemfile
gem 'beaker', '~>4.0'
gem 'beaker-vagrant'
# project.gemspec
s.add_runtime_dependency 'beaker', '~>4.0'
s.add_runtime_dependency 'beaker-vagrant'

Spec tests

Spec test live under the spec folder. There are the default rake task and therefore can run with a simple command:

bundle exec rake test:spec

Acceptance tests

We run beaker's base acceptance tests with this library to see if the hypervisor is working with beaker. There is a simple rake task to invoke acceptance test for the library:

bundle exec rake test:acceptance

Transfer Notice

This plugin was originally authored by Puppet Inc. The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance. Existing pull requests and issues were transferred over, please fork and continue to contribute here.

Previously: https://github.com/puppetlabs/beaker

License

This gem is licensed under the Apache-2 license.

Release information

To make a new release, please do:

  • update the version in lib/beaker-vagrant/version.rb
  • Install gems with bundle install --with release --path .vendor
  • generate the changelog with bundle exec rake changelog
  • Check if the new version matches the closed issues/PRs in the changelog
  • Create a PR with it
  • After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages

beaker-vagrant's People

Contributors

bastelfreak avatar dakta avatar dan33l avatar dependabot[bot] avatar ekohl avatar ericwilliamson avatar genebean avatar highb avatar justinstoller avatar kevpl avatar lmayorga1980 avatar op-ct avatar puppetlabs-jenkins avatar rishijavia avatar smcelmurry avatar traylenator avatar trevor-vaughan avatar treydock avatar tvpartytonight avatar yachub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beaker-vagrant's Issues

rsync_to uses incorrect port when using Beaker with vagrant

Using beaker with beaker-vagrant versions 0.6.7 and above, when I call rsync_to it attempts to connect to the guest on port 2222. This fails as the guest is not listening on that port.

Here is a typical error:

rsync: localhost:/data/ to [email protected]:/data {:ignore => ["spec", "tests", ".git", ".vagrant", "vagrant"]}
rsync returned #<Rsync::Result:0x000055fcd247dd60 @raw="ssh: connect to host 10.255.137.136 port 2222: Connection refused\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(228) [sender=3.2.3]\n", @exitcode=255>

Note, vagrant is forwarding port 22 on the guest to 2222 on the host so rsync_to could successfully connect to localhost port 2222, but not 10.255.137.136 port 2222.

This problem only occurs when using beaker-vagrant versions higher than 0.6.7. I believe the port to use is determined from the ssh config (https://github.com/voxpupuli/beaker/blob/master/lib/beaker/host.rb#L579) so is it possible that this commit in beaker-vagrant has introduced a bug? 5cd6320

(BKR-1697) Fix libvirt support

The information below is being transferred from Jira:

Envrionment
Followed this blog post for environment setup

And then ran export BEAKER_HYPERVISOR=vagrant_libvirt

After implementing the following code changes I was able to get the beaker nodes to work as intended with libvirt.

Suggested code changes:
lib/beaker/hypervisor/vagrant_libvirt.rb

def private_network_generator(host)
  unless host['dhcp_ip'].nil? || host['dhcp_ip'].empty?
    dhcp_ip = host['dhcp_ip']
  else
    dhcp_ip = "172.28.128.0"
  end
  private_network_string = "    v.vm.network :private_network, :type => \"dhcp\", :libvirt__network_address => \"#{dhcp_ip}\"\n"
end

and

def shell_provisioner_generator(provisioner_config)
  unless provisioner_config.nil?
    shell_provisioner_string = "    v.vm.provision 'shell', :inline => 'ip route del default', :run => 'always'\n"
  else
    shell_provisioner_string = "    v.vm.provision 'shell', :inline => 'ip route del default', :run => 'always'\n"
  end
end

Description

beaker-vagrant's libvirt support was missing handling networking information. It should defer out to the defaults specified in the vagrant-libvirt plugin if no options are supplied in the nodeset.

Vagrant-libvirt functions differently than the VirtualBox defaults in that it can build a private network via Libvirt's internal private DHCP settings, and then it will establish an IP Masquerade to forward out the VM's traffic to the internet.

Also, the vagrant-libvirt plugin will handle the networking at the time of provisioning and updates to the Libvirt VM's, therefore the Vagrantfile should delete the default routes and let the plugin fix everything up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.