2 require 'beaker/puppet_install_helper'
4 run_puppet_install_helper
8 proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
9 modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
11 # Readable test descriptions
12 c.formatter = :documentation
14 # Configure all nodes in nodeset
16 # Install module and dependencies
20 install_package host, 'git'
22 zuul_ref = ENV['ZUUL_REF']
23 zuul_branch = ENV['ZUUL_BRANCH']
24 zuul_url = ENV['ZUUL_URL']
26 repo = 'openstack/puppet-openstack-integration'
28 # Start out with clean moduledir, don't trust r10k to purge it
29 on host, "rm -rf /etc/puppet/modules/*"
30 # Install dependent modules via git or zuul
31 r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] }
33 zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner '
34 zuul_clone_cmd += '--cache-dir /opt/git '
35 zuul_clone_cmd += "--zuul-ref #{zuul_ref} "
36 zuul_clone_cmd += "--zuul-branch #{zuul_branch} "
37 zuul_clone_cmd += "--zuul-url #{zuul_url} "
38 zuul_clone_cmd += "git://git.openstack.org #{repo}"
39 on host, zuul_clone_cmd
41 on host, "git clone https://git.openstack.org/#{repo} #{repo}"
44 on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/install_modules.sh"
46 # Install the module being tested
47 on host, "rm -fr /etc/puppet/modules/#{modname}"
48 puppet_module_install(:source => proj_root, :module_name => modname)
50 on host, "rm -fr #{repo}"
52 # List modules installed to help with debugging
53 on host, puppet('module','list'), { :acceptable_exit_codes => 0 }