lib/beaker-pe/install/pe_utils.rb in beaker-pe-1.34.0 vs lib/beaker-pe/install/pe_utils.rb in beaker-pe-1.35.0
- old
+ new
@@ -446,10 +446,43 @@
raise "Failed to add pe_repo packages, PE Master node group is not available"
end
end
end
+ # Check for availability of required network resources
+ # @param [Array<Host>] hosts
+ # @param [Array<String>] network_resources
+ #
+ # @example
+ # verify_network_resources(hosts, network_resources)
+ #
+ # @return nil
+ #
+ # @api private
+ def verify_network_resources(hosts, network_resources)
+ logger.notify("Checking the availability of network resources.")
+ hosts.each do |host|
+ # if options[:net_diag_hosts] isn't set, skip this check
+ if network_resources != nil
+ network_resources.each do |resource|
+ # curl the network resource silently (-s), only connect (-I), and don't print the output
+ on host, "curl -I -s #{resource} > /dev/null", :accept_all_exit_codes => true
+ if host.connection.logger.last_result.exit_code != 0
+ logger.warn("Connection error: #{host.host_hash[:vmhostname]} was unable to connect to #{resource}. Please ensure that your test does not require this resource.")
+ end
+ end
+ end
+ hosts.each do |target_host|
+ ping_opts = host['platform'] =~ /windows/ ? "-n 1" : "-c1"
+ on host, "ping #{ping_opts} #{target_host.host_hash[:vmhostname]} > /dev/null", :accept_all_exit_codes => true
+ if host.connection.logger.last_result.exit_code != 0
+ logger.warn("Connection error: #{host.host_hash[:vmhostname]} was unable to connect to #{target_host.host_hash[:vmhostname]} in your testing infrastructure.")
+ end
+ end
+ end
+ end
+
#Perform a Puppet Enterprise upgrade or install
# @param [Array<Host>] hosts The hosts to install or upgrade PE on
# @param [Hash{Symbol=>Symbol, String}] opts The options
# @option opts [String] :pe_dir Default directory or URL to pull PE package from
# (Otherwise uses individual hosts pe_dir)
@@ -478,10 +511,11 @@
# @api private
#
def do_install hosts, opts = {}
# detect the kind of install we're doing
install_type = determine_install_type(hosts, opts)
+ verify_network_resources(hosts, options[:net_diag_hosts])
if opts[:use_proxy]
config_master_for_proxy_access
end
case install_type
when :pe_managed_postgres
@@ -562,10 +596,10 @@
# Set PE distribution on the agents, creates working directories
prepare_hosts(all_hosts, opts)
fetch_pe([master], opts)
prepare_host_installer_options(master)
- generate_installer_conf_file_for(master, [master], opts)
+ generate_installer_conf_file_for(master, all_hosts, opts)
step "Install PE on master" do
on master, installer_cmd(master, opts)
end
step "Stop agent on master" do