lib/beaker/dsl/install_utils.rb in beaker-2.5.1 vs lib/beaker/dsl/install_utils.rb in beaker-2.6.0

- old
+ new

@@ -707,11 +707,11 @@ raise "install_puppet() called for unsupported platform '#{host['platform']}' on '#{host.name}'" end end # Certain install paths may not create the config dirs/files needed - on host, "mkdir -p #{host['puppetpath']}" + on host, "mkdir -p #{host['puppetpath']}" unless host[:type] =~ /aio/ on host, "echo '' >> #{host.puppet['hiera_config']}" end nil end @@ -768,22 +768,22 @@ # # @api dsl # @return nil def configure_puppet_on(host, opts = {}) if host['platform'] =~ /windows/ - puppet_conf = "#{host['puppetpath']}\\puppet.conf" + puppet_conf = host.puppet['config'] conf_data = '' opts.each do |section,options| conf_data << "[#{section}]`n" options.each do |option,value| conf_data << "#{option}=#{value}`n" end conf_data << "`n" end on host, powershell("\$text = \\\"#{conf_data}\\\"; Set-Content -path '#{puppet_conf}' -value \$text") else - puppet_conf = "#{host['puppetpath']}/puppet.conf" + puppet_conf = host.puppet['config'] conf_data = '' opts.each do |section,options| conf_data << "[#{section}]\n" options.each do |option,value| conf_data << "#{option}=#{value}\n" @@ -1424,20 +1424,30 @@ opts = {:source => './', :target_module_path => host['distmoduledir'], :ignore_list => PUPPET_MODULE_INSTALL_IGNORE}.merge(opts) ignore_list = build_ignore_list(opts) target_module_dir = on( host, "echo #{opts[:target_module_path]}" ).stdout.chomp - source = File.expand_path( opts[:source] ) + source_path = File.expand_path( opts[:source] ) + source_dir = File.dirname(source_path) + source_name = File.basename(source_path) if opts.has_key?(:module_name) module_name = opts[:module_name] else - _, module_name = parse_for_modulename( source ) + _, module_name = parse_for_modulename( source_path ) end opts[:protocol] ||= 'scp' case opts[:protocol] when 'scp' - scp_to host, source, File.join(target_module_dir, module_name), {:ignore => ignore_list} + #move to the host + scp_to host, source_path, target_module_dir, {:ignore => ignore_list} + #rename to the selected module name, if not correct + cur_path = File.join(target_module_dir, source_name) + new_path = File.join(target_module_dir, module_name) + if cur_path != new_path + # NOTE: this will need to be updated to handle powershell only windows SUTs + on host, "mv #{cur_path} #{new_path}" + end when 'rsync' rsync_to host, source, File.join(target_module_dir, module_name), {:ignore => ignore_list} else logger.debug "Unsupported transfer protocol, returning nil" nil