beaker-pe 2.10.11 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adf82ae7e4bf51c772f578cbbabf4bbe961b7511
4
- data.tar.gz: 9edefcdcc41d93490132af330f2d49af2243c1ea
3
+ metadata.gz: d489d0aec55279c22ee7c655f3becf5d1dd8b04c
4
+ data.tar.gz: 0097776b4d29049f559cbc7812e052c7c902c6c2
5
5
  SHA512:
6
- metadata.gz: 8a95b3ab8e19123bd7de1e556f3889043ec458f916e28b578ced9ede22531445e501509cd4d29ccf1be01e68af315b8be956e4ff101423434c404b5a187de45d
7
- data.tar.gz: 3bfecf1145cee30a170c4496c9752102aaadadc29142698fd0b333cf3aba0439eb69737a02272a18a7dabbfd1677dfb821c189a6c9be8a12a0788df03622c0b8
6
+ metadata.gz: 13203aa9ab9d23a07434ce414696c35aa4e513a0488a10eb0a0a842fedb554e6fe1f6dc2c67c56bd204396a8a2604aa1fc192a9f2f0fddba3eee74680810ff08
7
+ data.tar.gz: cfa8218a3cf30dbeff6c2e41ae9601505e709604451ab447a47816ff036d6a9ad6132eea0bc1e3abba6de10926d637f98d61c0ee164c598786b82bb3d609bc20
@@ -291,7 +291,8 @@ module Beaker
291
291
  if opts[:fetch_local_then_push_to_host]
292
292
  fetch_and_push_pe(host, path, filename, extension)
293
293
  else
294
- on host, "cd #{host['working_dir']}; curl -O #{path}/#{filename}#{extension}"
294
+ curlopts = opts[:use_proxy] ? " --proxy #{opts[:proxy_hostname]}:3128" : ""
295
+ on host, "cd #{host['working_dir']}; curl -O #{path}/#{filename}#{extension}#{curlopts}"
295
296
  end
296
297
  end
297
298
  end
@@ -326,7 +327,8 @@ module Beaker
326
327
  fetch_and_push_pe(host, path, filename, extension)
327
328
  on host, "cd #{host['working_dir']}; chmod 644 #{filename}#{extension}"
328
329
  elsif host.is_cygwin?
329
- on host, "cd #{host['working_dir']}; curl -O #{path}/#{filename}#{extension}"
330
+ curlopts = opts[:use_proxy] ? " --proxy #{opts[:proxy_hostname]}:3128" : ""
331
+ on host, "cd #{host['working_dir']}; curl -O #{path}/#{filename}#{extension}#{curlopts}"
330
332
  else
331
333
  on host, powershell("$webclient = New-Object System.Net.WebClient; $webclient.DownloadFile('#{path}/#{filename}#{extension}','#{host['working_dir']}\\#{filename}#{extension}')")
332
334
  end
@@ -378,7 +380,8 @@ module Beaker
378
380
  fetch_and_push_pe(host, path, filename, extension)
379
381
  command_file_push = 'cat '
380
382
  else
381
- command_file_push = "curl #{path}/"
383
+ curlopts = opts[:use_proxy] ? "--proxy #{opts[:proxy_hostname]}:3128 " : ""
384
+ command_file_push = "curl #{curlopts}#{path}/"
382
385
  end
383
386
  on host, "cd #{host['working_dir']}; #{command_file_push}#{filename}#{extension} | #{unpack}"
384
387
 
@@ -572,7 +575,7 @@ module Beaker
572
575
  verify_network_resources(hosts, options[:net_diag_hosts])
573
576
  verify_vm_resources(hosts)
574
577
  if opts[:use_proxy]
575
- config_master_for_proxy_access
578
+ config_hosts_for_proxy_access(hosts - hosts_as('proxy'))
576
579
  end
577
580
  case install_type
578
581
  when :pe_managed_postgres
@@ -682,34 +685,80 @@ module Beaker
682
685
 
683
686
 
684
687
  # Configure the master to use a proxy and drop unproxied connections
685
- def config_master_for_proxy_access
686
- step "configuring master to use proxy" do
687
- @osmirror_host = "osmirror.delivery.puppetlabs.net"
688
- @osmirror_host_ip = IPSocket.getaddress(@osmirror_host)
689
- @delivery_host = "enterprise.delivery.puppetlabs.net"
690
- @delivery_host_ip = IPSocket.getaddress(@delivery_host)
691
- @proxy_ip = @options[:proxy_ip]
692
- @proxy_hostname = @options[:proxy_hostname]
693
- @master_ip = on master, "hostname -I | tr '\n' ' '"
694
- on master, "echo \"#{@proxy_ip} #{@proxy_hostname}\" >> /etc/hosts"
695
- on master, "echo \"#{@master_ip.stdout} #{master.connection.vmhostname}\" >> /etc/hosts"
696
- on master, "echo \"#{@osmirror_host_ip} #{@osmirror_host}\" >> /etc/hosts"
697
- on master, "echo \"#{@delivery_host_ip} #{@delivery_host}\" >> /etc/hosts"
698
- on master, "iptables -A OUTPUT -p tcp -d #{master.connection.vmhostname} -j ACCEPT"
699
- # the next two lines clear the internal puppet lan
700
- on master, "iptables -A OUTPUT -p tcp -d 10.16.0.0/16 -j ACCEPT"
701
- on master, "iptables -A OUTPUT -p tcp -d 10.32.0.0/16 -j ACCEPT"
702
- on master, "iptables -A OUTPUT -p tcp --dport 3128 -d #{@proxy_hostname} -j ACCEPT"
703
- on master, "iptables -A OUTPUT -p tcp -d #{@osmirror_host_ip} -j DROP"
704
- on master, "iptables -A OUTPUT -p tcp -d #{@delivery_host_ip} -j DROP"
705
- on master, "iptables -P OUTPUT DROP"
706
- on master, "curl --proxy #{@proxy_hostname}:3128 http://#{@osmirror_host}", :acceptable_exit_codes => [0]
707
- on master, "curl -k https://#{@osmirror_host}", :acceptable_exit_codes => [1,7]
708
- if master.host_hash[:platform].include?("ubuntu")
709
- on master, "echo 'Acquire::http::Proxy \"http://'#{@proxy_hostname}':3128/\";' >> /etc/apt/apt.conf"
710
- on master, "echo 'Acquire::https::Proxy \"http://'#{@proxy_hostname}':3128/\";' >> /etc/apt/apt.conf"
711
- else
712
- on master, "echo \"proxy=http://#{@proxy_hostname}:3128\" >> /etc/yum.conf"
688
+ def config_hosts_for_proxy_access hosts
689
+ hosts.each do |host|
690
+ step "Configuring #{host} to use proxy" do
691
+ @osmirror_host = "osmirror.delivery.puppetlabs.net"
692
+ @osmirror_host_ip = IPSocket.getaddress(@osmirror_host)
693
+ @delivery_host = "enterprise.delivery.puppetlabs.net"
694
+ @delivery_host_ip = IPSocket.getaddress(@delivery_host)
695
+ @test_forge_host = "api-forge-aio02-petest.puppet.com"
696
+ @test_forge_host_ip = IPSocket.getaddress(@test_forge_host)
697
+ @github_host = "github.com"
698
+ @github_host_ip = IPSocket.getaddress(@github_host)
699
+ @proxy_ip = @options[:proxy_ip]
700
+ @proxy_hostname = @options[:proxy_hostname]
701
+
702
+ #sles does not support the -I all-ip-addresses flag
703
+ hostname_flag = host.host_hash[:platform].include?("sles") ? '-i' : '-I'
704
+ @master_ip = on master, "hostname #{hostname_flag} | tr '\n' ' '"
705
+
706
+ on host, "echo \"#{@proxy_ip} #{@proxy_hostname}\" >> /etc/hosts"
707
+ on host, "echo \"#{@master_ip.stdout} #{master.connection.vmhostname}\" >> /etc/hosts"
708
+ on host, "echo \"#{@osmirror_host_ip} #{@osmirror_host}\" >> /etc/hosts"
709
+ on host, "echo \"#{@delivery_host_ip} #{@delivery_host}\" >> /etc/hosts"
710
+ on host, "echo \"#{@test_forge_host_ip} #{@test_forge_host}\" >> /etc/hosts"
711
+ on host, "echo \"#{@github_host_ip} #{@github_host}\" >> /etc/hosts"
712
+
713
+ on host, "iptables -A OUTPUT -p tcp -d #{master.connection.vmhostname} -j ACCEPT"
714
+ # Treat these hosts as if they were outside the puppet lan
715
+ on host, "iptables -A OUTPUT -p tcp -d #{@osmirror_host_ip} -j DROP"
716
+ on host, "iptables -A OUTPUT -p tcp -d #{@delivery_host_ip} -j DROP"
717
+ on host, "iptables -A OUTPUT -p tcp -d #{@test_forge_host_ip} -j DROP"
718
+ # The next two lines clear the rest of the internal puppet lan
719
+ on host, "iptables -A OUTPUT -p tcp -d 10.16.0.0/16 -j ACCEPT"
720
+ on host, "iptables -A OUTPUT -p tcp -d 10.32.0.0/16 -j ACCEPT"
721
+ # This allows udp on a port bundler requires
722
+ on host, 'iptables -A OUTPUT -p udp -m udp --dport 53 -j ACCEPT'
723
+ # Next two lines allow host to access itself via localhost or 127.0.0.1
724
+ on host, 'iptables -A INPUT -i lo -j ACCEPT'
725
+ on host, 'iptables -A OUTPUT -o lo -j ACCEPT'
726
+ #Opens up port that git uses
727
+ on host, "iptables -A OUTPUT -p tcp -d #{@github_host_ip} -j ACCEPT"
728
+ on host, "iptables -A INPUT -p tcp -d #{@github_host_ip} --dport 9143 -j ACCEPT"
729
+
730
+ #Platform9
731
+ on host, "iptables -A OUTPUT -p tcp -d 10.234.0.0/16 -j ACCEPT"
732
+ #enterprise.delivery.puppetlabs.net network, required if running from your work laptop over the network
733
+ on host, "iptables -A OUTPUT -p tcp -d 10.0.25.0/16 -j ACCEPT"
734
+
735
+ on host, "iptables -A OUTPUT -p tcp --dport 3128 -d #{@proxy_hostname} -j ACCEPT"
736
+ on host, "iptables -P OUTPUT DROP"
737
+ # Verify we can reach osmirror via the proxy
738
+ on host, "curl --proxy #{@proxy_hostname}:3128 http://#{@osmirror_host}", :acceptable_exit_codes => [0]
739
+ # Verify we can't reach it without the proxy
740
+ on host, "curl -k http://#{@osmirror_host} -m 5", :acceptable_exit_codes => [28]
741
+ if host.host_hash[:platform].include?("ubuntu")
742
+ on host, "echo 'Acquire::http::Proxy \"http://'#{@proxy_hostname}':3128/\";' >> /etc/apt/apt.conf"
743
+ on host, "echo 'Acquire::https::Proxy \"http://'#{@proxy_hostname}':3128/\";' >> /etc/apt/apt.conf"
744
+ elsif host.host_hash[:platform].include?("sles")
745
+ on host, 'rm /etc/sysconfig/proxy'
746
+ on host, 'echo "PROXY_ENABLED=\"yes\"" >> /etc/sysconfig/proxy'
747
+ on host, "echo 'HTTP_PROXY=\"http://#{@proxy_hostname}:3128\"' >> /etc/sysconfig/proxy"
748
+ on host, "echo 'HTTPS_PROXY=\"http://#{@proxy_hostname}:3128\"' >> /etc/sysconfig/proxy"
749
+ #Needs to not use proxy on the host itself, and master (in order to download the agent)
750
+ no_proxy_list="localhost,127.0.0.1,#{host.hostname},#{master.hostname}"
751
+ if any_hosts_as?('compile_master')
752
+ no_proxy_list.concat(",#{compile_master}")
753
+ end
754
+ on host, "echo \"NO_PROXY='#{no_proxy_list}'\" >> /etc/sysconfig/proxy"
755
+ else
756
+ #Hacky work around until we configure puppet_enteprise::repo::config to set proxy=_none_ in the puppet_enteprrise.repo
757
+ repo_list = on(host, "ls /etc/yum.repos.d/").output.strip.split("\n")
758
+ repo_list.each do |repo|
759
+ on host, "echo \"proxy=http://#{@proxy_hostname}:3128\" >> /etc/yum.repos.d/#{repo}"
760
+ end
761
+ end
713
762
  end
714
763
  end
715
764
  end
@@ -3,7 +3,7 @@ module Beaker
3
3
  module PE
4
4
 
5
5
  module Version
6
- STRING = '2.10.11'
6
+ STRING = '2.11.0'
7
7
  end
8
8
 
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-pe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.11
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec