Skip to content

Commit 652ea2c

Browse files
committed
Add support to rsync fixtures into SUTs
1 parent 844233c commit 652ea2c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/beaker_puppet_helpers/module_utils.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,25 @@ def install_local_module_on(hosts, source = '.')
5656
File.unlink(source_path) if source_path
5757
end
5858
end
59+
60+
# Copies all local dependencies into a SUT via rsync+ssh
61+
#
62+
# install_local_module_on creates an archive, scps it and then unpack it.
63+
# That takes up a lot of time when you've many modules. rsync+ssh is a faster alternative,
64+
# but it requires rsync in the SUT. Use the spec_prep rake task to deploy the dependencies locally.
65+
#
66+
# @param [Beaker::Host, Array<Beaker::Host>, String, Symbol] hosts
67+
# One or more hosts to act upon, or a role (String or Symbol) that
68+
# identifies one or more hosts.
69+
# @param [String] source
70+
# The directory where the modules sit
71+
# @param [String] destination
72+
# The directory where the modules will be placed
73+
def install_puppet_modules_via_rsync(hosts, source = 'spec/fixtures/modules/', destination = '/etc/puppetlabs/code/environments/production/modules')
74+
real_source = File.realpath(source)
75+
block_on hosts do |host|
76+
host.do_rsync_to(real_source, destination)
77+
end
78+
end
5979
end
6080
end

0 commit comments

Comments
 (0)