Skip to content

Commit

Permalink
Merge pull request #39 from james-stocks/BKR-967
Browse files Browse the repository at this point in the history
Revert "(BKR-967) Add :disable_analytics option"
  • Loading branch information
kevpl authored Nov 22, 2016
2 parents 0da1b64 + a9fdaac commit 2d17d83
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 66 deletions.
17 changes: 0 additions & 17 deletions lib/beaker-pe/install/pe_utils.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[ '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
Expand All @@ -25,7 +22,6 @@ module PEUtils
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'
Expand Down Expand Up @@ -713,12 +709,6 @@ 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
Expand Down Expand Up @@ -788,8 +778,6 @@ def check_console_status_endpoint(host)
# 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
Expand All @@ -807,11 +795,6 @@ def install_pe_on(install_hosts, opts)
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
Expand Down
9 changes: 0 additions & 9 deletions lib/beaker-pe/options/presets.rb

This file was deleted.

43 changes: 3 additions & 40 deletions spec/beaker-pe/install/pe_utils_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'spec_helper'
require 'beaker'
require 'beaker-pe/options/presets'

class ClassMixedWithDSLInstallUtils
include Beaker::DSL::InstallUtils
Expand Down Expand Up @@ -284,7 +283,6 @@ def prep_host(host)
context 'the do_higgs_install' do
it 'submits the correct installer cmd to invoke Higgs' do
prep_host(host)
allow( subject ).to receive( :options ).and_return( {} )
subject.do_higgs_install(host, opts)
end
end
Expand All @@ -307,7 +305,6 @@ def prep_host(host)
context 'the do_higgs_install' do
it 'submits the correct installer cmd to invoke Higgs' do
prep_host(host)
allow( subject ).to receive( :options ).and_return( {} )
subject.do_higgs_install(host, opts)
end
end
Expand Down Expand Up @@ -892,7 +889,6 @@ def slice_installer_options(host)
end

allow( subject ).to receive( :hosts ).and_return( hosts )
allow( subject ).to receive( :options ).and_return( {} )
#create answers file per-host, except windows
allow( subject ).to receive( :create_remote_file ).with( hosts[0], /answers/, /q/ )
#run installer on all hosts
Expand Down Expand Up @@ -948,7 +944,6 @@ def slice_installer_options(host)
allow( subject ).to receive( :sleep ).and_return( true )

allow( subject ).to receive( :hosts ).and_return( hosts )
allow( subject ).to receive( :options ).and_return( {} )

#run higgs installer command
expect( subject ).to receive( :on ).with( hosts[0],
Expand All @@ -964,7 +959,6 @@ def slice_installer_options(host)
allow( subject ).to receive( :sleep ).and_return( true )

allow( subject ).to receive( :hosts ).and_return( hosts )
allow( subject ).to receive( :options ).and_return( {} )

#run higgs installer command
expect( subject ).to receive( :on ).with( hosts[0],
Expand All @@ -983,35 +977,7 @@ def slice_installer_options(host)
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :hosts ).and_return( hosts_sorted )
allow( subject ).to receive( :do_install ).and_return( true )
allow( subject ).to receive( :set_etc_hosts )
expect( subject ).to receive( :do_install ).with( hosts, pe_presets )
subject.install_pe
end

it 'blocks analytics by default' do
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :hosts ).and_return( hosts_sorted )
allow( subject ).to receive( :do_install ).and_return( true )
allow( subject ).to receive( :set_etc_hosts )
expect( subject ).to receive( :do_install ).with( hosts, pe_presets )
subject.install_pe
end

it 'blocks analytics when disable_analytics is true' do
allow( subject ).to receive( :options ).and_return( {:disable_analytics => true} )
allow( subject ).to receive( :hosts ).and_return( hosts_sorted )
allow( subject ).to receive( :do_install ).and_return( true )
allow( subject ).to receive( :set_etc_hosts )
expect( subject ).to receive( :do_install ).with( hosts, {:disable_analytics => true} )
subject.install_pe
end

it 'does not block analytics when disable_analytics is false' do
allow( subject ).to receive( :options ).and_return( {:disable_analytics => false} )
allow( subject ).to receive( :hosts ).and_return( hosts_sorted )
allow( subject ).to receive( :do_install ).and_return( true )
expect( subject ).to_not receive( :set_etc_hosts )
expect( subject ).to receive( :do_install ).with( hosts, {:disable_analytics => false} )
expect( subject ).to receive( :do_install ).with( hosts, {} )
subject.install_pe
end

Expand All @@ -1023,8 +989,7 @@ def slice_installer_options(host)
allow( subject ).to receive( :hosts ).and_return( hosts_sorted )
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :do_install ).and_return( true )
allow( subject ).to receive( :set_etc_hosts )
expect( subject ).to receive( :do_install ).with( hosts, pe_presets )
expect( subject ).to receive( :do_install ).with( hosts, {} )
subject.install_pe
hosts.each do |h|
expect( h['pe_ver'] ).to be === '2.8'
Expand All @@ -1033,10 +998,8 @@ def slice_installer_options(host)

it 'can act upon a single host' do
allow( subject ).to receive( :hosts ).and_return( hosts )
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :sorted_hosts ).and_return( [hosts[0]] )
allow( subject ).to receive( :set_etc_hosts )
expect( subject ).to receive( :do_install ).with( [hosts[0]], pe_presets )
expect( subject ).to receive( :do_install ).with( [hosts[0]], {} )
subject.install_pe_on(hosts[0], {})
end
end
Expand Down

0 comments on commit 2d17d83

Please sign in to comment.