Skip to content

Commit

Permalink
Add support to rsync fixtures into SUTs
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Sep 3, 2024
1 parent 844233c commit 025b15e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/beaker_puppet_helpers/module_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,26 @@ def install_local_module_on(hosts, source = '.')
File.unlink(source_path) if source_path
end
end

# Copies all local dependencies into a SUT via rsync+ssh
#
# install_local_module_on creates an archive, scps it and then unpack it.
# That takes up a lot of time when you've many modules. rsync+ssh is a faster alternative,
# but it requires rsync in the SUT and on the Host.
# Use the spec_prep rake task to deploy the dependencies locally.
#
# @param [Beaker::Host, Array<Beaker::Host>, String, Symbol] hosts
# One or more hosts to act upon, or a role (String or Symbol) that
# identifies one or more hosts.
# @param [String] source
# The directory where the modules sit
# @param [String] destination
# The directory where the modules will be placed
def install_puppet_modules_via_rsync(hosts, source = 'spec/fixtures/modules/', destination = '/etc/puppetlabs/code/environments/production/modules')
real_source = File.realpath(source)
block_on hosts do |host|
host.do_rsync_to(real_source, destination)
end
end
end
end

0 comments on commit 025b15e

Please sign in to comment.