lib/beaker/hypervisor/aws_sdk.rb in beaker-aws-0.6.0 vs lib/beaker/hypervisor/aws_sdk.rb in beaker-aws-0.7.0

- old
+ new

@@ -610,13 +610,13 @@ # @note f5 hosts are skipped since this isn't a valid step there # # @return [void] # @api private def configure_hosts - non_netdev_hosts = @hosts.select{ |h| !(h['platform'] =~ /f5-|netscaler/) } - non_netdev_hosts.each do |host| - host_entries = non_netdev_hosts.map do |h| + non_netdev_windows_hosts = @hosts.select{ |h| !(h['platform'] =~ /f5-|netscaler|windows/) } + non_netdev_windows_hosts.each do |host| + host_entries = non_netdev_windows_hosts.map do |h| h == host ? etc_hosts_entry(h, :private_ip) : etc_hosts_entry(h) end host_entries.unshift "127.0.0.1\tlocalhost localhost.localdomain\n" set_etc_hosts(host, host_entries.join('')) end @@ -627,11 +627,16 @@ # # @return [void] # @api private def enable_root_on_hosts @hosts.each do |host| - enable_root(host) + if host['disable_root_ssh'] == true + @logger.notify("aws-sdk: Not enabling root for instance as disable_root_ssh is set to 'true'.") + else + @logger.notify("aws-sdk: Enabling root ssh") + enable_root(host) + end end end # Enables root access for a host when username is not root # @@ -707,10 +712,12 @@ @hosts.each do |host| host[:vmhostname] = host.name if host['platform'] =~ /el-7/ # on el-7 hosts, the hostname command doesn't "stick" randomly host.exec(Command.new("hostnamectl set-hostname #{host.name}")) + elsif host['platform'] =~ /windows/ + @logger.notify('aws-sdk: Change hostname on windows is not supported.') else next if host['platform'] =~ /netscaler/ host.exec(Command.new("hostname #{host.name}")) if host['vmname'] =~ /^amazon/ # Amazon Linux requires this to preserve host name changes across reboots. @@ -726,9 +733,11 @@ @hosts.each do |host| host[:vmhostname] = host[:dns_name] if host['platform'] =~ /el-7/ # on el-7 hosts, the hostname command doesn't "stick" randomly host.exec(Command.new("hostnamectl set-hostname #{host.hostname}")) + elsif host['platform'] =~ /windows/ + @logger.notify('aws-sdk: Change hostname on windows is not supported.') else next if host['platform'] =~ /netscaler/ host.exec(Command.new("hostname #{host.hostname}")) if host['vmname'] =~ /^amazon/ # See note above