lib/beaker/dsl/helpers.rb in beaker-1.12.0 vs lib/beaker/dsl/helpers.rb in beaker-1.12.1

- old
+ new

@@ -301,9 +301,28 @@ # @see #run_script_on def run_script(script, opts = {}, &block) run_script_on(default, script, opts, &block) end + # Copy a puppet module from a given source to all hosts under test. + # Assumes each host under test has an associated 'distmoduledir' (set in the + # host configuration YAML file). + # + # @param opts [Hash] + # @option opts [String] :source The location on the test runners box where the files are found + # @option opts [String] :module_name The name of the module to be copied over + def puppet_module_install_on(host, opts = {}) + Array(host).each do |host| + scp_to host, opts[:source], File.join(host['distmoduledir'], opts[:module_name]) + end + end + + # Copy a puppet module from a given source to all hosts under test. + # @see #puppet_module_install_on + def puppet_module_install opts = {} + puppet_module_install_on(hosts, opts) + end + # Limit the hosts a test case is run against # @note This will modify the {Beaker::TestCase#hosts} member # in place unless an array of hosts is passed into it and # {Beaker::TestCase#logger} yielding an object that responds # like {Beaker::Logger#warn}, as well as