/dev/oops

fiddyspence's blog

New Adventures With Beaker

So - I started having a bit of a hack with Beaker this week and found out some things.

First - openstack support is evolving, so I had to do some fixing to enable multi-region node creation - currently here: https://github.com/puppetlabs/beaker/pull/681

Secondly, installing extra modules doesn’t respect anything like the .fixtures.yml of rspec-puppet, and we don’t allow unrestricted exit to the interwebs from our internal nets, so welcome to a game of:

# Configure all nodes in nodeset
c.before :suite do
  hosts.each do |host|
    target_module_dir = on( host, "echo #{host['distmoduledir']}" ).stdout.chomp
    install_from_git(host, target_module_dir, { :name => 'stdlib', :path => 'http://somegit/stdlib.git', :rev => '4.3.2' })
    install_from_git(host, target_module_dir, { :name => 'apache', :path => 'http://somegit/apache.git', :rev => 'master' })
  end
end

If you’re wondering what you can do, GEMDIR/beaker-/lib/beaker/dsl/helpers.rb is the place to look

Running a lot of stuff remotely has been necessary here - setting up yum repos etc for example

on(host, 'curl -o /etc/yum.repos.d/thing.repo http://webserver/thing.repo')

Oh - nodefiles and options - this is where beaker options go:

HOSTS:
  centos-65-x64-openstack:
    roles:
      - master
    hypervisor : openstack
    flavor: small
    image: OL-6.5.1-latest
    user: cloud
    config:
CONFIG:
  :openstack_keyname: me
  :openstack_api_key: password
  :openstack_username: openstackusername
  :openstack_auth_url: http://identity:5000/v2.0/tokens
  :openstack_tenant: I Like Cows
  :openstack_network: public
  :openstack_region: emeraldcity
  :trace_limit: 500
  type: foss

I spent a lot of time working out how to expand the trace_limit - turns out it’s here!!

More notes when I can be bothered