beaker 1.8.1 → 1.8.2

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.
Files changed (39) hide show
  1. checksums.yaml +8 -8
  2. data/bin/beaker +1 -1
  3. data/lib/beaker.rb +1 -1
  4. data/lib/beaker/cli.rb +15 -35
  5. data/lib/beaker/host_prebuilt_steps.rb +335 -0
  6. data/lib/beaker/hypervisor.rb +53 -4
  7. data/lib/beaker/hypervisor/aixer.rb +2 -2
  8. data/lib/beaker/hypervisor/blimper.rb +5 -5
  9. data/lib/beaker/hypervisor/fusion.rb +3 -3
  10. data/lib/beaker/hypervisor/solaris.rb +2 -2
  11. data/lib/beaker/hypervisor/vagrant.rb +6 -16
  12. data/lib/beaker/hypervisor/vcloud.rb +6 -6
  13. data/lib/beaker/hypervisor/vcloud_pooled.rb +4 -4
  14. data/lib/beaker/hypervisor/vsphere.rb +3 -3
  15. data/lib/beaker/network_manager.rb +51 -37
  16. data/lib/beaker/options/presets.rb +1 -0
  17. data/lib/beaker/shared.rb +2 -2
  18. data/lib/beaker/shared/host_role_parser.rb +36 -0
  19. data/lib/beaker/version.rb +1 -1
  20. data/spec/beaker/host_prebuilt_steps_spec.rb +421 -0
  21. data/spec/beaker/hypervisor/google_compute.rb +23 -0
  22. data/spec/beaker/hypervisor/vagrant_spec.rb +5 -4
  23. data/spec/beaker/hypervisor/vcloud_pooled_spec.rb +2 -2
  24. data/spec/beaker/hypervisor/vcloud_spec.rb +2 -2
  25. data/spec/beaker/hypervisor/vsphere_spec.rb +2 -2
  26. data/spec/beaker/options/parser_spec.rb +1 -1
  27. data/spec/beaker/shared/host_role_parser_spec.rb +58 -0
  28. metadata +10 -18
  29. data/lib/beaker/shared/host_handler.rb +0 -51
  30. data/lib/beaker/utils.rb +0 -7
  31. data/lib/beaker/utils/ntp_control.rb +0 -57
  32. data/lib/beaker/utils/repo_control.rb +0 -90
  33. data/lib/beaker/utils/setup_helper.rb +0 -66
  34. data/lib/beaker/utils/validator.rb +0 -36
  35. data/spec/beaker/shared/host_handler_spec.rb +0 -104
  36. data/spec/beaker/utils/ntp_control_spec.rb +0 -70
  37. data/spec/beaker/utils/repo_control_spec.rb +0 -168
  38. data/spec/beaker/utils/setup_helper_spec.rb +0 -82
  39. data/spec/beaker/utils/validator_spec.rb +0 -91
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe GoogleCompute do
5
+ let( :gc ) { Beaker::GoogleCompute.new( @hosts, make_opts ) }
6
+
7
+ before :each do
8
+ @hosts = make_hosts()
9
+ apiclient = double()
10
+
11
+ end
12
+
13
+ it "can provision hosts" do
14
+ gc.provision
15
+
16
+ end
17
+
18
+
19
+
20
+
21
+ end
22
+
23
+ end
@@ -2,7 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe Vagrant do
5
- let( :vagrant ) { Beaker::Vagrant.new( @hosts, make_opts ) }
5
+ let( :options ) { make_opts.merge({ 'logger' => double().as_null_object }) }
6
+ let( :vagrant ) { Beaker::Vagrant.new( @hosts, options ) }
6
7
 
7
8
  before :each do
8
9
  @hosts = make_hosts()
@@ -61,7 +62,7 @@ module Beaker
61
62
 
62
63
  Command.should_receive( :new ).with("sudo su -c \"cp -r .ssh /root/.\"").once
63
64
 
64
- vagrant.copy_ssh_to_root( host )
65
+ vagrant.copy_ssh_to_root( host, options )
65
66
 
66
67
  end
67
68
 
@@ -71,7 +72,7 @@ module Beaker
71
72
 
72
73
  Command.should_receive( :new ).with("sudo su -c \"cp -r .ssh /home/Administrator/.\"").once
73
74
 
74
- vagrant.copy_ssh_to_root( host )
75
+ vagrant.copy_ssh_to_root( host, options )
75
76
 
76
77
  end
77
78
  end
@@ -140,7 +141,7 @@ module Beaker
140
141
  @hosts.each do |host|
141
142
  host_prev_name = host['user']
142
143
  vagrant.should_receive( :set_ssh_config ).with( host, 'vagrant' ).once
143
- vagrant.should_receive( :copy_ssh_to_root ).with( host ).once
144
+ vagrant.should_receive( :copy_ssh_to_root ).with( host, options ).once
144
145
  vagrant.should_receive( :set_ssh_config ).with( host, host_prev_name ).once
145
146
  end
146
147
  vagrant.should_receive( :hack_etc_hosts ).with( @hosts ).once
@@ -50,7 +50,7 @@ module Beaker
50
50
  vcloud.stub( :sleep ).and_return( true )
51
51
  vcloud.provision
52
52
 
53
- hosts = vcloud.instance_variable_get( :@vcloud_hosts )
53
+ hosts = vcloud.instance_variable_get( :@hosts )
54
54
  hosts.each do | host |
55
55
  expect( host['vmhostname'] ).to be === 'pool'
56
56
  end
@@ -70,7 +70,7 @@ module Beaker
70
70
  vcloud.provision
71
71
  vcloud.cleanup
72
72
 
73
- hosts = vcloud.instance_variable_get( :@vcloud_hosts )
73
+ hosts = vcloud.instance_variable_get( :@hosts )
74
74
  hosts.each do | host |
75
75
  name = host.name
76
76
  vm = MockVsphereHelper.find_vm( name )
@@ -29,7 +29,7 @@ module Beaker
29
29
  vcloud.stub( :sleep ).and_return( true )
30
30
  vcloud.provision
31
31
 
32
- hosts = vcloud.instance_variable_get( :@vcloud_hosts )
32
+ hosts = vcloud.instance_variable_get( :@hosts )
33
33
  hosts.each do | host |
34
34
  name = host['vmhostname']
35
35
  vm = MockVsphereHelper.find_vm( name )
@@ -54,7 +54,7 @@ module Beaker
54
54
  vcloud.provision
55
55
  vcloud.cleanup
56
56
 
57
- hosts = vcloud.instance_variable_get( :@vcloud_hosts )
57
+ hosts = vcloud.instance_variable_get( :@hosts )
58
58
  vm_names = hosts.map {|h| h['vmhostname'] }.compact
59
59
  vm_names.each do | name |
60
60
  vm = MockVsphereHelper.find_vm( name )
@@ -17,7 +17,7 @@ module Beaker
17
17
 
18
18
  vsphere.provision
19
19
 
20
- hosts = vsphere.instance_variable_get( :@vsphere_hosts )
20
+ hosts = vsphere.instance_variable_get( :@hosts )
21
21
  hosts.each do |host|
22
22
  expect( MockVsphereHelper.find_vm( host.name ).powerState ) == "poweredOn"
23
23
  end
@@ -53,7 +53,7 @@ module Beaker
53
53
  vsphere = Beaker::Vsphere.new( make_hosts(), make_opts )
54
54
  vsphere.cleanup
55
55
 
56
- hosts = vsphere.instance_variable_get( :@vsphere_hosts )
56
+ hosts = vsphere.instance_variable_get( :@hosts )
57
57
  hosts.each do |host|
58
58
  expect( MockVsphereHelper.find_vm( host.name ).powerState ) == "poweredOff"
59
59
  end
@@ -133,7 +133,7 @@ module Beaker
133
133
  it "can correctly combine arguments from different sources" do
134
134
  FakeFS.deactivate!
135
135
  args = ["-h", hosts_path, "--log-level", "debug", "--type", "git", "--install", "PUPPET/1.0,HIERA/hello"]
136
- expect(parser.parse_args(args)).to be === {:log_level=>"debug", :trace_limit=>10, :hosts_file=>hosts_path, :options_file=>nil, :type=>"git", :provision=>true, :preserve_hosts=>'never', :root_keys=>false, :quiet=>false, :xml=>false, :color=>true, :dry_run=>false, :timeout=>300, :fail_mode=>'slow', :timesync=>false, :repo_proxy=>false, :add_el_extras=>false, :consoleport=>443, :pe_dir=>"/opt/enterprise/dists", :pe_version_file=>"LATEST", :pe_version_file_win=>"LATEST-win", :dot_fog=>"#{home}/.fog", :help=>false, :ec2_yaml=>"config/image_templates/ec2.yaml", :ssh=>{:config=>false, :paranoid=>false, :timeout=>300, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["#{home}/.ssh/id_rsa"], :user_known_hosts_file=>"#{home}/.ssh/known_hosts"}, :install=>["git://github.com/puppetlabs/puppet.git#1.0", "git://github.com/puppetlabs/hiera.git#hello"], :HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], :vmname=>"pe-ubuntu-lucid", :platform=>"ubuntu-10.04-i386", :snapshot=>"clean-w-keys", :hypervisor=>"fusion"}, :"pe-centos6"=>{:roles=>["agent"], :vmname=>"pe-centos6", :platform=>"el-6-i386", :hypervisor=>"fusion", :snapshot=>"clean-w-keys"}}, :nfs_server=>"none", :helper=>[], :load_path=>[], :tests=>[], :pre_suite=>[], :post_suite=>[], :modules=>[]}
136
+ expect(parser.parse_args(args)).to be === {:log_level=>"debug", :trace_limit=>10, :hosts_file=>hosts_path, :options_file=>nil, :type=>"git", :provision=>true, :preserve_hosts=>'never', :root_keys=>false, :quiet=>false, :xml=>false, :color=>true, :dry_run=>false, :timeout=>300, :fail_mode=>'slow', :timesync=>false, :repo_proxy=>false, :add_el_extras=>false, :add_master_entry=>false, :consoleport=>443, :pe_dir=>"/opt/enterprise/dists", :pe_version_file=>"LATEST", :pe_version_file_win=>"LATEST-win", :dot_fog=>"#{home}/.fog", :help=>false, :ec2_yaml=>"config/image_templates/ec2.yaml", :ssh=>{:config=>false, :paranoid=>false, :timeout=>300, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["#{home}/.ssh/id_rsa"], :user_known_hosts_file=>"#{home}/.ssh/known_hosts"}, :install=>["git://github.com/puppetlabs/puppet.git#1.0", "git://github.com/puppetlabs/hiera.git#hello"], :HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], :vmname=>"pe-ubuntu-lucid", :platform=>"ubuntu-10.04-i386", :snapshot=>"clean-w-keys", :hypervisor=>"fusion"}, :"pe-centos6"=>{:roles=>["agent"], :vmname=>"pe-centos6", :platform=>"el-6-i386", :hypervisor=>"fusion", :snapshot=>"clean-w-keys"}}, :nfs_server=>"none", :helper=>[], :load_path=>[], :tests=>[], :pre_suite=>[], :post_suite=>[], :modules=>[]}
137
137
  end
138
138
 
139
139
  it "ensures that fail-mode is one of fast/slow" do
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ module Shared
5
+ describe HostRoleParser do
6
+ let( :host_handler ) { Beaker::Shared::HostRoleParser }
7
+ let( :platform ) { @platform || 'unix' }
8
+ let( :hosts ) { hosts = make_hosts( { :platform => platform } )
9
+ hosts[0][:roles] = ['agent']
10
+ hosts[1][:roles] = ['master', 'dashboard', 'agent', 'database']
11
+ hosts[2][:roles] = ['agent']
12
+ hosts }
13
+
14
+ context "hosts_with_role" do
15
+ it "can find the master in a set of hosts" do
16
+
17
+ expect( host_handler.hosts_with_role( hosts, 'master' ) ).to be === [hosts[1]]
18
+
19
+ end
20
+
21
+ it "can find all agents in a set of hosts" do
22
+
23
+ expect( host_handler.hosts_with_role( hosts, 'agent' ) ).to be === hosts
24
+
25
+ end
26
+
27
+ it "returns [] when no match is found in a set of hosts" do
28
+
29
+ expect( host_handler.hosts_with_role( hosts, 'surprise' ) ).to be === []
30
+
31
+ end
32
+
33
+ end
34
+
35
+ context "only_host_with_role" do
36
+ it "can find the single master in a set of hosts" do
37
+
38
+ expect( host_handler.only_host_with_role( hosts, 'master' ) ).to be === hosts[1]
39
+
40
+ end
41
+
42
+ it "throws an error when more than one host with matching role is found" do
43
+
44
+ expect{ host_handler.only_host_with_role( hosts, 'agent' ) }.to raise_error(ArgumentError)
45
+
46
+ end
47
+
48
+ it "throws an error when no host is found matching the role" do
49
+
50
+ expect{ host_handler.only_host_with_role( hosts, 'surprise' ) }.to raise_error(ArgumentError)
51
+
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -301,6 +301,7 @@ files:
301
301
  - lib/beaker/host/windows/group.rb
302
302
  - lib/beaker/host/windows/pkg.rb
303
303
  - lib/beaker/host/windows/user.rb
304
+ - lib/beaker/host_prebuilt_steps.rb
304
305
  - lib/beaker/hypervisor.rb
305
306
  - lib/beaker/hypervisor/aixer.rb
306
307
  - lib/beaker/hypervisor/blimper.rb
@@ -325,17 +326,12 @@ files:
325
326
  - lib/beaker/result.rb
326
327
  - lib/beaker/shared.rb
327
328
  - lib/beaker/shared/error_handler.rb
328
- - lib/beaker/shared/host_handler.rb
329
+ - lib/beaker/shared/host_role_parser.rb
329
330
  - lib/beaker/shared/repetition.rb
330
331
  - lib/beaker/shared/timed.rb
331
332
  - lib/beaker/ssh_connection.rb
332
333
  - lib/beaker/test_case.rb
333
334
  - lib/beaker/test_suite.rb
334
- - lib/beaker/utils.rb
335
- - lib/beaker/utils/ntp_control.rb
336
- - lib/beaker/utils/repo_control.rb
337
- - lib/beaker/utils/setup_helper.rb
338
- - lib/beaker/utils/validator.rb
339
335
  - lib/beaker/version.rb
340
336
  - spec/beaker/answers_spec.rb
341
337
  - spec/beaker/cli_spec.rb
@@ -348,10 +344,12 @@ files:
348
344
  - spec/beaker/dsl/structure_spec.rb
349
345
  - spec/beaker/dsl/wrappers_spec.rb
350
346
  - spec/beaker/host/windows/group_spec.rb
347
+ - spec/beaker/host_prebuilt_steps_spec.rb
351
348
  - spec/beaker/host_spec.rb
352
349
  - spec/beaker/hypervisor/aixer_spec.rb
353
350
  - spec/beaker/hypervisor/blimper_spec.rb
354
351
  - spec/beaker/hypervisor/fusion_spec.rb
352
+ - spec/beaker/hypervisor/google_compute.rb
355
353
  - spec/beaker/hypervisor/hypervisor_spec.rb
356
354
  - spec/beaker/hypervisor/solaris_spec.rb
357
355
  - spec/beaker/hypervisor/vagrant_spec.rb
@@ -374,15 +372,11 @@ files:
374
372
  - spec/beaker/platform_spec.rb
375
373
  - spec/beaker/puppet_command_spec.rb
376
374
  - spec/beaker/shared/error_handler_spec.rb
377
- - spec/beaker/shared/host_handler_spec.rb
375
+ - spec/beaker/shared/host_role_parser_spec.rb
378
376
  - spec/beaker/shared/repetition_spec.rb
379
377
  - spec/beaker/ssh_connection_spec.rb
380
378
  - spec/beaker/test_case_spec.rb
381
379
  - spec/beaker/test_suite_spec.rb
382
- - spec/beaker/utils/ntp_control_spec.rb
383
- - spec/beaker/utils/repo_control_spec.rb
384
- - spec/beaker/utils/setup_helper_spec.rb
385
- - spec/beaker/utils/validator_spec.rb
386
380
  - spec/helpers.rb
387
381
  - spec/matchers.rb
388
382
  - spec/mock_blimpy.rb
@@ -427,10 +421,12 @@ test_files:
427
421
  - spec/beaker/dsl/structure_spec.rb
428
422
  - spec/beaker/dsl/wrappers_spec.rb
429
423
  - spec/beaker/host/windows/group_spec.rb
424
+ - spec/beaker/host_prebuilt_steps_spec.rb
430
425
  - spec/beaker/host_spec.rb
431
426
  - spec/beaker/hypervisor/aixer_spec.rb
432
427
  - spec/beaker/hypervisor/blimper_spec.rb
433
428
  - spec/beaker/hypervisor/fusion_spec.rb
429
+ - spec/beaker/hypervisor/google_compute.rb
434
430
  - spec/beaker/hypervisor/hypervisor_spec.rb
435
431
  - spec/beaker/hypervisor/solaris_spec.rb
436
432
  - spec/beaker/hypervisor/vagrant_spec.rb
@@ -453,15 +449,11 @@ test_files:
453
449
  - spec/beaker/platform_spec.rb
454
450
  - spec/beaker/puppet_command_spec.rb
455
451
  - spec/beaker/shared/error_handler_spec.rb
456
- - spec/beaker/shared/host_handler_spec.rb
452
+ - spec/beaker/shared/host_role_parser_spec.rb
457
453
  - spec/beaker/shared/repetition_spec.rb
458
454
  - spec/beaker/ssh_connection_spec.rb
459
455
  - spec/beaker/test_case_spec.rb
460
456
  - spec/beaker/test_suite_spec.rb
461
- - spec/beaker/utils/ntp_control_spec.rb
462
- - spec/beaker/utils/repo_control_spec.rb
463
- - spec/beaker/utils/setup_helper_spec.rb
464
- - spec/beaker/utils/validator_spec.rb
465
457
  - spec/helpers.rb
466
458
  - spec/matchers.rb
467
459
  - spec/mock_blimpy.rb
@@ -1,51 +0,0 @@
1
- module Beaker
2
- module Shared
3
- module HostHandler
4
-
5
- # NOTE: this code is shamelessly stolen from facter's 'domain' fact, but
6
- # we don't have access to facter at this point in the run. Also, this
7
- # utility method should perhaps be moved to a more central location in the
8
- # framework.
9
- def get_domain_name(host)
10
- domain = nil
11
- search = nil
12
- resolv_conf = host.exec(Command.new("cat /etc/resolv.conf")).stdout
13
- resolv_conf.each_line { |line|
14
- if line =~ /^\s*domain\s+(\S+)/
15
- domain = $1
16
- elsif line =~ /^\s*search\s+(\S+)/
17
- search = $1
18
- end
19
- }
20
- return domain if domain
21
- return search if search
22
- end
23
-
24
- def get_ip(host)
25
- host.exec(Command.new("ip a|awk '/global/{print$2}' | cut -d/ -f1 | head -1")).stdout.chomp
26
- end
27
-
28
- def set_etc_hosts(host, etc_hosts)
29
- host.exec(Command.new("echo '#{etc_hosts}' > /etc/hosts"))
30
- end
31
-
32
- def hosts_with_role(hosts, desired_role = nil)
33
- hosts.select do |host|
34
- desired_role.nil? or host['roles'].include?(desired_role.to_s)
35
- end
36
- end
37
-
38
- def only_host_with_role(hosts, role)
39
- a_host = hosts_with_role(hosts, role)
40
- case
41
- when a_host.length == 0
42
- raise ArgumentError, "There should be one host with #{role} defined!"
43
- when a_host.length > 1
44
- host_string = ( a_host.map { |host| host.name } ).join( ', ')
45
- raise ArgumentError, "There should be only one host with #{role} defined, but I found #{a_host.length} (#{host_string})"
46
- end
47
- a_host.first
48
- end
49
- end
50
- end
51
- end
data/lib/beaker/utils.rb DELETED
@@ -1,7 +0,0 @@
1
- [ 'ntp_control', 'setup_helper', 'repo_control', 'validator' ].each do |file|
2
- begin
3
- require "beaker/utils/#{file}"
4
- rescue LoadError
5
- require File.expand_path(File.join(File.dirname(__FILE__), 'utils', file))
6
- end
7
- end
@@ -1,57 +0,0 @@
1
- module Beaker
2
- module Utils
3
- class NTPControl
4
- NTPSERVER = 'pool.ntp.org'
5
- SLEEPWAIT = 5
6
- TRIES = 5
7
- def initialize(options, hosts)
8
- @options = options.dup
9
- @hosts = hosts
10
- @logger = options[:logger]
11
- end
12
-
13
- def timesync
14
- @logger.notify "Update system time sync"
15
- @logger.notify "run ntpdate against NTP pool systems"
16
- @hosts.each do |host|
17
- if host['platform'].include? 'windows'
18
- # The exit code of 5 is for Windows 2008 systems where the w32tm /register command
19
- # is not actually necessary.
20
- host.exec(Command.new("w32tm /register"), :acceptable_exit_codes => [0,5])
21
- host.exec(Command.new("net start w32time"), :acceptable_exit_codes => [0,2])
22
- host.exec(Command.new("w32tm /config /manualpeerlist:#{NTPSERVER} /syncfromflags:manual /update"))
23
- host.exec(Command.new("w32tm /resync"))
24
- @logger.notify "NTP date succeeded on #{host}"
25
- else
26
- case
27
- when host['platform'] =~ /solaris-10/
28
- ntp_command = "sleep 10 && ntpdate -w #{NTPSERVER}"
29
- when host['platform'] =~ /sles-/
30
- ntp_command = "sntp #{NTPSERVER}"
31
- else
32
- ntp_command = "ntpdate -t 20 #{NTPSERVER}"
33
- end
34
- success=false
35
- try = 0
36
- until try >= TRIES do
37
- try += 1
38
- if host.exec(Command.new(ntp_command), :acceptable_exit_codes => (0..255)).exit_code == 0
39
- success=true
40
- break
41
- end
42
- sleep SLEEPWAIT
43
- end
44
- if success
45
- @logger.notify "NTP date succeeded on #{host} after #{try} tries"
46
- else
47
- raise "NTP date was not successful after #{try} tries"
48
- end
49
- end
50
- end
51
- rescue => e
52
- report_and_raise(@logger, e, "timesync (--ntp)")
53
- end
54
-
55
- end
56
- end
57
- end
@@ -1,90 +0,0 @@
1
- module Beaker
2
- module Utils
3
- class RepoControl
4
-
5
- APT_CFG = %q{ Acquire::http::Proxy "http://proxy.puppetlabs.net:3128/"; }
6
- IPS_PKG_REPO="http://solaris-11-internal-repo.delivery.puppetlabs.net"
7
-
8
- def initialize(options, hosts)
9
- @options = options.dup
10
- @hosts = hosts
11
- @logger = options[:logger]
12
- @debug_opt = options[:debug] ? 'vh' : ''
13
- end
14
-
15
- def epel_info_for! host
16
- version = host['platform'].match(/el-(\d+)/)[1]
17
- if version == '6'
18
- pkg = 'epel-release-6-8.noarch.rpm'
19
- url = "http://mirror.itc.virginia.edu/fedora-epel/6/i386/#{pkg}"
20
- elsif version == '5'
21
- pkg = 'epel-release-5-4.noarch.rpm'
22
- url = "http://archive.linux.duke.edu/pub/epel/5/i386/#{pkg}"
23
- else
24
- raise "I don't understand your platform description!"
25
- end
26
- return url
27
- end
28
-
29
- def apt_get_update host
30
- if host[:platform] =~ /(ubuntu)|(debian)/
31
- host.exec(Command.new("apt-get -y -f -m update"))
32
- end
33
- end
34
-
35
- def copy_file_to_remote(host, file_path, file_content)
36
- Tempfile.open 'beaker' do |tempfile|
37
- File.open(tempfile.path, 'w') {|file| file.puts file_content }
38
-
39
- host.do_scp_to(tempfile.path, file_path, @options)
40
- end
41
-
42
- end
43
-
44
- def proxy_config
45
- # repo_proxy
46
- # supports ubuntu, debian and solaris platforms
47
- @hosts.each do |host|
48
- case
49
- when host['platform'] =~ /ubuntu/
50
- host.exec(Command.new("if test -f /etc/apt/apt.conf; then mv /etc/apt/apt.conf /etc/apt/apt.conf.bk; fi"))
51
- copy_file_to_remote(host, '/etc/apt/apt.conf', APT_CFG)
52
- apt_get_update(host)
53
- when host['platform'] =~ /debian/
54
- host.exec(Command.new("if test -f /etc/apt/apt.conf; then mv /etc/apt/apt.conf /etc/apt/apt.conf.bk; fi"))
55
- copy_file_to_remote(host, '/etc/apt/apt.conf', APT_CFG)
56
- apt_get_update(host)
57
- when host['platform'] =~ /solaris-11/
58
- host.exec(Command.new("/usr/bin/pkg unset-publisher solaris || :"))
59
- host.exec(Command.new("/usr/bin/pkg set-publisher -g %s solaris" % IPS_PKG_REPO))
60
- else
61
- @logger.debug "#{host}: repo proxy configuration not modified"
62
- end
63
- end
64
- rescue => e
65
- report_and_raise(@logger, e, "proxy_config")
66
- end
67
-
68
- def add_el_extras
69
- #add_el_extras
70
- #only supports el-* platforms
71
- @hosts.each do |host|
72
- case
73
- when host['platform'] =~ /el-(5|6)/
74
- result = host.exec(Command.new('rpm -qa | grep epel-release'), :acceptable_exit_codes => [0,1])
75
- if result.exit_code == 1
76
- url = epel_info_for! host
77
- host.exec(Command.new("rpm -i#{@debug_opt} #{url}"))
78
- host.exec(Command.new('yum clean all && yum makecache'))
79
- end
80
- else
81
- @logger.debug "#{host}: package repo configuration not modified"
82
- end
83
- end
84
- rescue => e
85
- report_and_raise(@logger, e, "add_repos")
86
- end
87
-
88
- end
89
- end
90
- end