lib/beaker-pe/install/pe_utils.rb in beaker-pe-1.4.0 vs lib/beaker-pe/install/pe_utils.rb in beaker-pe-1.5.0

- old
+ new

@@ -1,11 +1,14 @@ [ 'aio_defaults', 'pe_defaults', 'puppet_utils', 'windows_utils' ].each do |lib| require "beaker/dsl/install_utils/#{lib}" end +require "beaker/host_prebuilt_steps" require "beaker-answers" require "timeout" require "json" +require "beaker-pe/options/presets" + module Beaker module DSL module InstallUtils # # This module contains methods to help installing/upgrading PE builds - including Higgs installs @@ -20,10 +23,11 @@ module PEUtils include AIODefaults include PEDefaults include PuppetUtils include WindowsUtils + include HostPrebuiltSteps # Version of PE when we switched from legacy installer to MEEP. MEEP_CUTOVER_VERSION = '2016.2.0' # @!macro [new] common_opts @@ -703,10 +707,16 @@ #@see #install_pe_on def install_pe install_pe_on(hosts, options) end + def disable_analytics(hosts) + logger.info("Disabling analytics on dashboard host(s)") + set_etc_hosts(hosts, "127.0.0.1\tgoogle-analytics.com\n") + set_etc_hosts(hosts, "127.0.0.1\twww.google-analytics.com\n") + end + def check_puppetdb_status_endpoint(host) if version_is_less(host['pe_ver'], '2016.1.0') return true end Timeout.timeout(60) do @@ -772,10 +782,12 @@ # # @note For further installation parameters (such as puppet-agent install) # options, refer to {#do_install} documentation # def install_pe_on(install_hosts, opts) + opts = pe_presets.merge(opts) + confine_block(:to, {}, install_hosts) do sorted_hosts.each do |host| #process the version files if necessary host['pe_dir'] ||= opts[:pe_dir] if host['platform'] =~ /windows/ @@ -789,9 +801,14 @@ end else host['pe_ver'] ||= Beaker::Options::PEVersionScraper.load_pe_version(host[:pe_dir] || opts[:pe_dir], opts[:pe_version_file]) end end + + if opts[:disable_analytics] then + disable_analytics(dashboard) + end + do_install sorted_hosts, opts end end #Upgrade PE based upon global host configuration and global options