beaker 2.13.0 → 2.14.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.
Files changed (62) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile +19 -0
  3. data/HISTORY.md +335 -2
  4. data/acceptance/pre_suite/puppet_git/install.rb +2 -2
  5. data/lib/beaker/answers.rb +45 -2
  6. data/lib/beaker/answers/version20.rb +9 -9
  7. data/lib/beaker/answers/version28.rb +9 -9
  8. data/lib/beaker/answers/version30.rb +19 -19
  9. data/lib/beaker/answers/version32.rb +1 -1
  10. data/lib/beaker/answers/version34.rb +4 -4
  11. data/lib/beaker/answers/version40.rb +1 -1
  12. data/lib/beaker/cli.rb +11 -4
  13. data/lib/beaker/command.rb +4 -2
  14. data/lib/beaker/command_factory.rb +5 -1
  15. data/lib/beaker/dsl/helpers/host_helpers.rb +17 -5
  16. data/lib/beaker/dsl/install_utils.rb +3 -2
  17. data/lib/beaker/dsl/install_utils/aio_defaults.rb +86 -0
  18. data/lib/beaker/dsl/install_utils/foss_defaults.rb +163 -0
  19. data/lib/beaker/dsl/install_utils/foss_utils.rb +988 -0
  20. data/lib/beaker/dsl/install_utils/pe_defaults.rb +139 -0
  21. data/lib/beaker/dsl/install_utils/pe_utils.rb +140 -38
  22. data/lib/beaker/dsl/install_utils/puppet_utils.rb +26 -751
  23. data/lib/beaker/dsl/structure.rb +7 -1
  24. data/lib/beaker/host.rb +35 -58
  25. data/lib/beaker/host/freebsd.rb +4 -16
  26. data/lib/beaker/host/mac.rb +3 -39
  27. data/lib/beaker/host/mac/pkg.rb +2 -1
  28. data/lib/beaker/host/pswindows.rb +2 -28
  29. data/lib/beaker/host/unix.rb +3 -51
  30. data/lib/beaker/host/unix/pkg.rb +34 -33
  31. data/lib/beaker/host/windows.rb +1 -45
  32. data/lib/beaker/host_prebuilt_steps.rb +11 -24
  33. data/lib/beaker/hypervisor/aixer.rb +1 -1
  34. data/lib/beaker/hypervisor/docker.rb +43 -4
  35. data/lib/beaker/hypervisor/openstack.rb +1 -0
  36. data/lib/beaker/hypervisor/solaris.rb +1 -1
  37. data/lib/beaker/hypervisor/vmpooler.rb +19 -8
  38. data/lib/beaker/network_manager.rb +5 -4
  39. data/lib/beaker/options/command_line_parser.rb +9 -9
  40. data/lib/beaker/options/parser.rb +21 -17
  41. data/lib/beaker/options/presets.rb +0 -33
  42. data/lib/beaker/platform.rb +7 -3
  43. data/lib/beaker/ssh_connection.rb +1 -1
  44. data/lib/beaker/version.rb +1 -1
  45. data/spec/beaker/answers_spec.rb +13 -8
  46. data/spec/beaker/cli_spec.rb +6 -6
  47. data/spec/beaker/command_spec.rb +18 -0
  48. data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +2 -0
  49. data/spec/beaker/dsl/install_utils/{puppet_utils_spec.rb → foss_utils_spec.rb} +34 -21
  50. data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +2 -0
  51. data/spec/beaker/dsl/structure_spec.rb +8 -0
  52. data/spec/beaker/host/unix/pkg_spec.rb +15 -10
  53. data/spec/beaker/host_prebuilt_steps_spec.rb +1 -1
  54. data/spec/beaker/host_spec.rb +3 -54
  55. data/spec/beaker/hypervisor/docker_spec.rb +2 -0
  56. data/spec/beaker/hypervisor/vmpooler_spec.rb +67 -10
  57. data/spec/beaker/options/command_line_parser_spec.rb +2 -2
  58. data/spec/beaker/options/parser_spec.rb +35 -24
  59. data/spec/beaker/options/presets_spec.rb +0 -26
  60. data/spec/helpers.rb +5 -5
  61. data/spec/mocks.rb +1 -2
  62. metadata +7 -3
@@ -21,8 +21,8 @@ module Beaker
21
21
  :q_puppet_cloud_install => 'y',
22
22
  :q_puppet_symlinks_install => 'y',
23
23
  :q_vendor_packages_install => 'y',
24
- :q_puppetagent_certname => host,
25
- :q_puppetagent_server => master,
24
+ :q_puppetagent_certname => host.to_s,
25
+ :q_puppetagent_server => master.to_s,
26
26
 
27
27
  # Disable console and master by default
28
28
  # This will be overridden by other blocks being merged in
@@ -33,15 +33,15 @@ module Beaker
33
33
  master_dns_altnames = [master.to_s, master['ip'], 'puppet'].compact.uniq.join(',')
34
34
  master_a = {
35
35
  :q_puppetmaster_install => 'y',
36
- :q_puppetmaster_certname => master,
36
+ :q_puppetmaster_certname => master.to_s,
37
37
  :q_puppetmaster_dnsaltnames => master_dns_altnames,
38
- :q_puppetmaster_enterpriseconsole_hostname => dashboard,
38
+ :q_puppetmaster_enterpriseconsole_hostname => dashboard.to_s,
39
39
  :q_puppetmaster_enterpriseconsole_port => answer_for(options, :q_puppetmaster_enterpriseconsole_port, 443),
40
40
  :q_puppetmaster_forward_facts => 'y',
41
41
  }
42
42
 
43
43
  dashboard_user = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_user_email)}'"
44
- smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard)}'"
44
+ smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard.to_s)}'"
45
45
  dashboard_password = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_password)}'"
46
46
  smtp_port = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_port)}'"
47
47
  smtp_username = answer_for(options, :q_puppet_enterpriseconsole_smtp_username)
@@ -64,11 +64,11 @@ module Beaker
64
64
  :q_puppet_enterpriseconsole_database_user => console_database_user,
65
65
  :q_puppet_enterpriseconsole_database_root_password => dashboard_password,
66
66
  :q_puppet_enterpriseconsole_database_password => dashboard_password,
67
- :q_puppet_enterpriseconsole_inventory_hostname => host,
68
- :q_puppet_enterpriseconsole_inventory_certname => host,
69
- :q_puppet_enterpriseconsole_inventory_dnsaltnames => master,
67
+ :q_puppet_enterpriseconsole_inventory_hostname => host.to_s,
68
+ :q_puppet_enterpriseconsole_inventory_certname => host.to_s,
69
+ :q_puppet_enterpriseconsole_inventory_dnsaltnames => master.to_s,
70
70
  :q_puppet_enterpriseconsole_inventory_port => console_inventory_port,
71
- :q_puppet_enterpriseconsole_master_hostname => master,
71
+ :q_puppet_enterpriseconsole_master_hostname => master.to_s,
72
72
  :q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
73
73
  :q_puppet_enterpriseconsole_auth_password => dashboard_password,
74
74
  :q_puppet_enterpriseconsole_httpd_port => console_httpd_port,
@@ -22,8 +22,8 @@ module Beaker
22
22
  :q_puppet_cloud_install => 'y',
23
23
  :q_puppet_symlinks_install => 'y',
24
24
  :q_vendor_packages_install => 'y',
25
- :q_puppetagent_certname => host,
26
- :q_puppetagent_server => master,
25
+ :q_puppetagent_certname => host.to_s,
26
+ :q_puppetagent_server => master.to_s,
27
27
 
28
28
  # Disable console and master by default
29
29
  # This will be overridden by other blocks being merged in
@@ -34,15 +34,15 @@ module Beaker
34
34
  master_dns_altnames = [master.to_s, master['ip'], 'puppet'].compact.uniq.join(',')
35
35
  master_a = {
36
36
  :q_puppetmaster_install => 'y',
37
- :q_puppetmaster_certname => master,
37
+ :q_puppetmaster_certname => master.to_s,
38
38
  :q_puppetmaster_dnsaltnames => master_dns_altnames,
39
- :q_puppetmaster_enterpriseconsole_hostname => dashboard,
39
+ :q_puppetmaster_enterpriseconsole_hostname => dashboard.to_s,
40
40
  :q_puppetmaster_enterpriseconsole_port => answer_for(options, :q_puppetmaster_enterpriseconsole_port, 443),
41
41
  :q_puppetmaster_forward_facts => 'y',
42
42
  }
43
43
 
44
44
  dashboard_user = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_user_email)}'"
45
- smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard)}'"
45
+ smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard.to_s)}'"
46
46
  dashboard_password = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_password)}'"
47
47
  smtp_port = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_port)}'"
48
48
  smtp_username = answer_for(options, :q_puppet_enterpriseconsole_smtp_username)
@@ -64,11 +64,11 @@ module Beaker
64
64
  :q_puppet_enterpriseconsole_database_name => console_database_name,
65
65
  :q_puppet_enterpriseconsole_database_user => console_database_user,
66
66
  :q_puppet_enterpriseconsole_database_password => dashboard_password,
67
- :q_puppet_enterpriseconsole_inventory_hostname => host,
68
- :q_puppet_enterpriseconsole_inventory_certname => host,
69
- :q_puppet_enterpriseconsole_inventory_dnsaltnames => master,
67
+ :q_puppet_enterpriseconsole_inventory_hostname => host.to_s,
68
+ :q_puppet_enterpriseconsole_inventory_certname => host.to_s,
69
+ :q_puppet_enterpriseconsole_inventory_dnsaltnames => master.to_s,
70
70
  :q_puppet_enterpriseconsole_inventory_port => console_inventory_port,
71
- :q_puppet_enterpriseconsole_master_hostname => master,
71
+ :q_puppet_enterpriseconsole_master_hostname => master.to_s,
72
72
  :q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
73
73
  :q_puppet_enterpriseconsole_auth_password => dashboard_password,
74
74
  :q_puppet_enterpriseconsole_httpd_port => console_httpd_port,
@@ -21,9 +21,9 @@ module Beaker
21
21
  agent_a = {
22
22
  :q_puppetagent_install => 'y',
23
23
  :q_puppet_cloud_install => 'y',
24
- :q_verify_packages => options[:answers][:q_verify_packages],
24
+ :q_verify_packages => answer_for(options, :q_verify_packages, 'y'),
25
25
  :q_puppet_symlinks_install => 'y',
26
- :q_puppetagent_certname => host,
26
+ :q_puppetagent_certname => host.to_s,
27
27
 
28
28
  # Disable database, console, and master by default
29
29
  # This will be overridden by other blocks being merged in.
@@ -33,7 +33,7 @@ module Beaker
33
33
  :q_puppetdb_install => 'n',
34
34
  :q_database_install => 'n',
35
35
  }
36
- agent_a[:q_puppetagent_server] = masterless ? host : master
36
+ agent_a[:q_puppetagent_server] = masterless ? host.to_s : master.to_s
37
37
  agent_a[:q_continue_or_reenter_master_hostname] = 'c' if masterless
38
38
 
39
39
  # These base answers are needed by all
@@ -45,12 +45,12 @@ module Beaker
45
45
  unless masterless
46
46
  # master/database answers
47
47
  master_database_a = {
48
- :q_puppetmaster_certname => master
48
+ :q_puppetmaster_certname => master.to_s
49
49
  }
50
50
 
51
51
  # Master/dashboard answers
52
52
  master_console_a = {
53
- :q_puppetdb_hostname => answer_for(options, :q_puppetdb_hostname, database),
53
+ :q_puppetdb_hostname => answer_for(options, :q_puppetdb_hostname, database.to_s),
54
54
  :q_puppetdb_port => answer_for(options, :q_puppetdb_port, 8081)
55
55
  }
56
56
 
@@ -59,15 +59,15 @@ module Beaker
59
59
  master_a = {
60
60
  :q_puppetmaster_install => 'y',
61
61
  :q_puppetmaster_dnsaltnames => master_dns_altnames,
62
- :q_puppetmaster_enterpriseconsole_hostname => dashboard,
62
+ :q_puppetmaster_enterpriseconsole_hostname => dashboard.to_s,
63
63
  :q_puppetmaster_enterpriseconsole_port => answer_for(options, :q_puppetmaster_enterpriseconsole_port, 443),
64
64
  }
65
65
 
66
66
  # Common answers for console and database
67
67
  database_name = answer_for(options, :q_puppetdb_database_name, 'pe-puppetdb')
68
68
  database_user = answer_for(options, :q_puppetdb_database_user, 'mYpdBu3r')
69
- dashboard_password = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_password]}'"
70
- puppetdb_password = "'#{options[:answers][:q_puppetdb_password]}'"
69
+ dashboard_password = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_password)}'"
70
+ puppetdb_password = "'#{answer_for(options, :q_puppetdb_password)}'"
71
71
  auth_database_name = answer_for(options, :q_puppet_enterpriseconsole_auth_database_name, 'console_auth')
72
72
  auth_database_user = answer_for(options, :q_puppet_enterpriseconsole_auth_database_user, 'mYu7hu3r')
73
73
  console_database_name = answer_for(options, :q_puppet_enterpriseconsole_database_name, 'console')
@@ -85,29 +85,29 @@ module Beaker
85
85
  :q_puppet_enterpriseconsole_database_user => answer_for(options, :q_puppet_enterpriseconsole_database_user, console_database_user),
86
86
  :q_puppet_enterpriseconsole_database_password => answer_for(options, :q_puppet_enterpriseconsole_database_password, dashboard_password),
87
87
 
88
- :q_database_host => answer_for(options, :q_database_host, database),
88
+ :q_database_host => answer_for(options, :q_database_host, database.to_s),
89
89
  :q_database_port => database_port,
90
90
  }
91
91
 
92
92
  # Console only answers
93
- dashboard_user = "'#{options[:answers][:q_puppet_enterpriseconsole_auth_user_email]}'"
93
+ dashboard_user = "'#{answer_for(options, :q_puppet_enterpriseconsole_auth_user_email)}'"
94
94
 
95
95
 
96
- smtp_host = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_host] || dashboard}'"
97
- smtp_port = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_port]}'"
98
- smtp_username = options[:answers][:q_puppet_enterpriseconsole_smtp_username]
99
- smtp_password = options[:answers][:q_puppet_enterpriseconsole_smtp_password]
100
- smtp_use_tls = "'#{options[:answers][:q_puppet_enterpriseconsole_smtp_use_tls]}'"
96
+ smtp_host = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_host, dashboard.to_s)}'"
97
+ smtp_port = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_port)}'"
98
+ smtp_username = answer_for(options, :q_puppet_enterpriseconsole_smtp_username)
99
+ smtp_password = answer_for(options, :q_puppet_enterpriseconsole_smtp_password)
100
+ smtp_use_tls = "'#{answer_for(options, :q_puppet_enterpriseconsole_smtp_use_tls)}'"
101
101
  console_inventory_port = answer_for(options, :q_puppet_enterpriseconsole_inventory_port, 8140)
102
102
  console_httpd_port = answer_for(options, :q_puppet_enterpriseconsole_httpd_port, 443)
103
103
 
104
104
  console_a = {
105
105
  :q_puppet_enterpriseconsole_install => 'y',
106
- :q_puppet_enterpriseconsole_inventory_hostname => host,
107
- :q_puppet_enterpriseconsole_inventory_certname => host,
108
- :q_puppet_enterpriseconsole_inventory_dnsaltnames => dashboard,
106
+ :q_puppet_enterpriseconsole_inventory_hostname => host.to_s,
107
+ :q_puppet_enterpriseconsole_inventory_certname => host.to_s,
108
+ :q_puppet_enterpriseconsole_inventory_dnsaltnames => dashboard.to_s,
109
109
  :q_puppet_enterpriseconsole_inventory_port => console_inventory_port,
110
- :q_puppet_enterpriseconsole_master_hostname => master,
110
+ :q_puppet_enterpriseconsole_master_hostname => master.to_s,
111
111
 
112
112
  :q_puppet_enterpriseconsole_auth_user_email => dashboard_user,
113
113
  :q_puppet_enterpriseconsole_auth_password => dashboard_password,
@@ -20,7 +20,7 @@ module Beaker
20
20
  the_answers = super
21
21
  if dashboard != master
22
22
  # in 3.2, dashboard needs the master certname
23
- the_answers[dashboard.name][:q_puppetmaster_certname] = master
23
+ the_answers[dashboard.name][:q_puppetmaster_certname] = master.to_s
24
24
  end
25
25
 
26
26
  # do we want to check for updates?
@@ -16,13 +16,13 @@ module Beaker
16
16
 
17
17
  classifier_database_user = answer_for(@options, :q_classifier_database_user, 'DFGhjlkj')
18
18
  classifier_database_name = answer_for(@options, :q_database_name, 'pe-classifier')
19
- classifier_database_password = "'#{@options[:answers][:q_classifier_database_password]}'"
19
+ classifier_database_password = "'#{answer_for(@options, :q_classifier_database_password)}'"
20
20
  activity_database_user = answer_for(@options, :q_activity_database_user, 'adsfglkj')
21
21
  activity_database_name = answer_for(@options, :q_activity_database_name, 'pe-activity')
22
- activity_database_password = "'#{@options[:answers][:q_activity_database_password]}'"
22
+ activity_database_password = "'#{answer_for(@options, :q_activity_database_password)}'"
23
23
  rbac_database_user = answer_for(@options, :q_rbac_database_user, 'RbhNBklm')
24
24
  rbac_database_name = answer_for(@options, :q_rbac_database_name, 'pe-rbac')
25
- rbac_database_password = "'#{@options[:answers][:q_rbac_database_password]}'"
25
+ rbac_database_password = "'#{answer_for(@options, :q_rbac_database_password)}'"
26
26
 
27
27
  console_services_hash = {
28
28
  :q_classifier_database_user => classifier_database_user,
@@ -38,7 +38,7 @@ module Beaker
38
38
 
39
39
  # If we're installing or upgrading from a non-RBAC version, set the 'admin' password
40
40
  if @options[:type] == :upgrade && @options[:set_console_password]
41
- dashboard_password = "'#{@options[:answers][:q_puppet_enterpriseconsole_auth_password]}'"
41
+ dashboard_password = "'#{answer_for(@options, :q_puppet_enterpriseconsole_auth_password)}'"
42
42
  the_answers[dashboard.name][:q_puppet_enterpriseconsole_auth_password] = dashboard_password
43
43
  end
44
44
 
@@ -28,7 +28,7 @@ module Beaker
28
28
  end
29
29
 
30
30
  # add some new answers
31
- update_server_host = answer_for(@options, :q_update_server_host, master)
31
+ update_server_host = answer_for(@options, :q_update_server_host, master.to_s)
32
32
  install_update_server = answer_for(@options, :q_install_update_server, 'y')
33
33
 
34
34
  the_answers.map do |key, value|
@@ -161,20 +161,27 @@ module Beaker
161
161
  #
162
162
  # @return nil
163
163
  def preserve_hosts_file
164
+ # things that don't belong in the preserved host file
165
+ dontpreserve = /HOSTS|logger|timestamp|log_prefix|_dated_dir|logger_sut|pre_suite|post_suite|tests/
164
166
  preserved_hosts_filename = File.join(@options[:log_dated_dir], 'hosts_preserved.yml')
165
167
  FileUtils.cp(@options[:hosts_file], preserved_hosts_filename)
166
168
  hosts_yaml = YAML.load_file(preserved_hosts_filename)
167
169
  newly_keyed_hosts_entries = {}
168
- hosts_yaml['HOSTS'].each do |host_name, host_hash|
170
+ hosts_yaml['HOSTS'].each do |host_name, file_host_hash|
171
+ h = Beaker::Options::OptionsHash.new
172
+ file_host_hash = h.merge(file_host_hash)
169
173
  @hosts.each do |host|
170
- if host_name == host.instance_variable_get(:@name)
171
- newly_keyed_hosts_entries[host.to_s] = host_hash
174
+ if host_name == host.name
175
+ newly_keyed_hosts_entries[host.reachable_name] = file_host_hash.merge(host.host_hash)
172
176
  break
173
177
  end
174
178
  end
175
179
  end
176
180
  hosts_yaml['HOSTS'] = newly_keyed_hosts_entries
177
- hosts_yaml['CONFIG'] ||= {}
181
+ hosts_yaml['CONFIG'] = Beaker::Options::OptionsHash.new.merge(hosts_yaml['CONFIG'] || {})
182
+ # save the rest of the options, excepting the HOSTS that we have already processed
183
+ hosts_yaml['CONFIG'] = hosts_yaml['CONFIG'].merge(@options.reject{ |k,v| k =~ dontpreserve })
184
+ # remove copy of HOSTS information
178
185
  hosts_yaml['CONFIG']['provision'] = false
179
186
  File.open(preserved_hosts_filename, 'w') do |file|
180
187
  YAML.dump(hosts_yaml, file)
@@ -50,6 +50,7 @@ module Beaker
50
50
  @args = args
51
51
  @environment = {}
52
52
  @cmdexe = @options.delete(:cmdexe) || false
53
+ @prepend_cmds = @options.delete(:prepend_cmds) || nil
53
54
 
54
55
  # this is deprecated and will not allow you to use a command line
55
56
  # option of `--environment`, please use ENV instead.
@@ -65,15 +66,16 @@ module Beaker
65
66
  # interface.
66
67
  # @param [String] cmd An command to call.
67
68
  # @param [Hash] env An optional hash of environment variables to be used
69
+ # @param [String] pc An optional list of commands to prepend
68
70
  #
69
71
  # @return [String] This returns the fully formed command line invocation.
70
- def cmd_line host, cmd = @command, env = @environment
72
+ def cmd_line host, cmd = @command, env = @environment, pc = @prepend_cmds
71
73
  env_string = env.nil? ? '' : environment_string_for( host, env )
72
74
 
73
75
  cygwin = ((host['platform'] =~ /windows/) and host.is_cygwin? and @cmdexe) ? 'cmd.exe /c' : nil
74
76
 
75
77
  # This will cause things like `puppet -t -v agent` which is maybe bad.
76
- [env_string, cygwin, cmd, options_string, args_string].compact.reject(&:empty?).join(' ')
78
+ [env_string, cygwin, pc, cmd, options_string, args_string].compact.reject(&:empty?).join(' ')
77
79
  end
78
80
 
79
81
  # @param [Hash] opts These are the options that the command takes
@@ -16,7 +16,11 @@ module Beaker
16
16
  end
17
17
 
18
18
  def execute(command, options={}, &block)
19
- result = self.exec(Command.new(command), options)
19
+ cmd_create_options = {}
20
+ exec_opts = options.dup
21
+ cmd_create_options[:prepend_cmds] = exec_opts.delete(:prepend_cmds) || nil
22
+ cmd_create_options[:cmdexe] = exec_opts.delete(:cmdexe) || false
23
+ result = self.exec(Command.new(command, [], cmd_create_options), exec_opts)
20
24
 
21
25
  if block_given?
22
26
  yield result
@@ -374,11 +374,7 @@ module Beaker
374
374
  # @!macro common_opts
375
375
  #
376
376
  def curl_on(host, cmd, opts = {}, &block)
377
- if options.is_pe? #check global options hash
378
- on host, "curl --tlsv1 %s" % cmd, opts, &block
379
- else
380
- on host, "curl %s" % cmd, opts, &block
381
- end
377
+ on host, "curl --tlsv1 %s" % cmd, opts, &block
382
378
  end
383
379
 
384
380
 
@@ -508,6 +504,22 @@ module Beaker
508
504
  end
509
505
  end
510
506
 
507
+ # 'echo' the provided value on the given host(s)
508
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
509
+ # or a role (String or Symbol) that identifies one or more hosts.
510
+ # @param [String] val The string to 'echo' on the host(s)
511
+ # @return [String, Array<String> The echo'ed value(s) returned by the host(s)
512
+ def echo_on hosts, val
513
+ #val = val.gsub(/"/, "\"").gsub(/\(/, "\(")
514
+ block_on hosts do |host|
515
+ if host.is_powershell?
516
+ host.exec(Command.new("echo #{val}")).stdout.chomp
517
+ else
518
+ host.exec(Command.new("echo \"#{val}\"")).stdout.chomp
519
+ end
520
+ end
521
+ end
522
+
511
523
 
512
524
  end
513
525
  end
@@ -1,4 +1,4 @@
1
- [ 'pe', 'puppet', 'ezbake', 'module' ].each do |lib|
1
+ [ 'foss', 'pe', 'puppet', 'ezbake', 'module' ].each do |lib|
2
2
  require "beaker/dsl/install_utils/#{lib}_utils"
3
3
  end
4
4
 
@@ -6,8 +6,9 @@ module Beaker
6
6
  module DSL
7
7
  # Collection of installation methods and support
8
8
  module InstallUtils
9
- include DSL::InstallUtils::PEUtils
10
9
  include DSL::InstallUtils::PuppetUtils
10
+ include DSL::InstallUtils::PEUtils
11
+ include DSL::InstallUtils::FOSSUtils
11
12
  include DSL::InstallUtils::ModuleUtils
12
13
  include DSL::InstallUtils::EZBakeUtils
13
14
  end
@@ -0,0 +1,86 @@
1
+ module Beaker
2
+ module DSL
3
+ module InstallUtils
4
+ #
5
+ # This module contains default values for aio paths and directorys per-platform
6
+ #
7
+ module AIODefaults
8
+
9
+ #Here be the pathing and default values for AIO installs
10
+ #
11
+ AIO_DEFAULTS = {
12
+ 'unix' => {
13
+ 'puppetbindir' => '/opt/puppetlabs/bin',
14
+ 'privatebindir' => '/opt/puppetlabs/puppet/bin',
15
+ 'distmoduledir' => '/etc/puppetlabs/code/modules',
16
+ 'sitemoduledir' => '/opt/puppetlabs/puppet/modules',
17
+ },
18
+ 'windows' => { #windows
19
+ 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
20
+ 'privatebindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/sys/ruby/bin',
21
+ 'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/code/modules',
22
+ # sitemoduledir not included (check PUP-4049 for more info)
23
+ },
24
+ }
25
+
26
+ # Add the appropriate aio defaults to the host object so that they can be accessed using host[option], set host[:type] = aio
27
+ # @param [Host] host A single host to act upon
28
+ # @param [String] platform The platform type of this host, one of windows or unix
29
+ def add_platform_aio_defaults(host, platform)
30
+ AIO_DEFAULTS[platform].each_pair do |key, val|
31
+ host[key] = val
32
+ end
33
+ # add group and type here for backwards compatability
34
+ if host['platform'] =~ /windows/
35
+ host['group'] = 'Administrators'
36
+ else
37
+ host['group'] = 'puppet'
38
+ end
39
+ host['type'] = 'aio'
40
+ end
41
+
42
+ # Add the appropriate aio defaults to an array of hosts
43
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
44
+ # or a role (String or Symbol) that identifies one or more hosts.
45
+ def add_aio_defaults_on(hosts)
46
+ block_on hosts do | host |
47
+ if host['platform'] =~ /windows/
48
+ platform = 'windows'
49
+ else
50
+ platform = 'unix'
51
+ end
52
+ add_platform_aio_defaults(host, platform)
53
+ end
54
+ end
55
+
56
+ # Remove the appropriate aio defaults from the host object so that they can no longer be accessed using host[option], set host[:type] = nil
57
+ # @param [Host] host A single host to act upon
58
+ # @param [String] platform The platform type of this host, one of windows, pswindows, freebsd, mac & unix
59
+ def remove_platform_aio_defaults(host, platform)
60
+ AIO_DEFAULTS[platform].each_pair do |key, val|
61
+ host.delete(key)
62
+ end
63
+ host['type'] = nil
64
+ host['group'] = nil
65
+ end
66
+
67
+ # Remove the appropriate aio defaults from an array of hosts
68
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
69
+ # or a role (String or Symbol) that identifies one or more hosts.
70
+ def remove_aio_defaults_on(hosts)
71
+ block_on hosts do | host |
72
+ if host['platform'] =~ /windows/
73
+ platform = 'windows'
74
+ else
75
+ platform = 'unix'
76
+ end
77
+ remove_platform_aio_defaults(host, platform)
78
+ end
79
+ end
80
+
81
+
82
+ end
83
+ end
84
+ end
85
+ end
86
+
@@ -0,0 +1,163 @@
1
+ module Beaker
2
+ module DSL
3
+ module InstallUtils
4
+ #
5
+ # This module contains default values for FOSS puppet paths and directorys per-platform
6
+ #
7
+ module FOSSDefaults
8
+
9
+ #Here be the pathing and default values for FOSS installs
10
+ #
11
+ FOSS_DEFAULTS = {
12
+ 'freebsd' => {
13
+ 'puppetserver-confdir' => '/etc/puppetserver/conf.d',
14
+ 'puppetservice' => 'puppetmaster',
15
+ 'puppetpath' => '/usr/local/etc/puppet/modules',
16
+ 'puppetvardir' => '/var/lib/puppet',
17
+ 'puppetbin' => '/usr/bin/puppet',
18
+ 'puppetbindir' => '/usr/bin',
19
+ 'hieralibdir' => '/opt/puppet-git-repos/hiera/lib',
20
+ 'hierapuppetlibdir' => '/opt/puppet-git-repos/hiera-puppet/lib',
21
+ 'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
22
+ 'hieradatadir' => '/usr/local/etc/puppet/modules/hieradata',
23
+ 'hieraconf' => '/usr/local/etc/puppet/modules/hiera.yaml',
24
+ 'distmoduledir' => '/usr/local/etc/puppet/modules',
25
+ 'sitemoduledir' => '/usr/share/puppet/modules',
26
+ },
27
+ 'mac' => {
28
+ 'puppetserver-confdir' => '/etc/puppetserver/conf.d',
29
+ 'puppetservice' => 'puppetmaster',
30
+ 'puppetpath' => '/etc/puppet',
31
+ 'puppetconfdir' => '/etc/puppet',
32
+ 'puppetcodedir' => '/etc/puppet',
33
+ 'puppetvardir' => '/var/lib/puppet',
34
+ 'puppetbin' => '/usr/bin/puppet',
35
+ 'puppetbindir' => '/usr/bin',
36
+ 'hieralibdir' => '/opt/puppet-git-repos/hiera/lib',
37
+ 'hierapuppetlibdir' => '/opt/puppet-git-repos/hiera-puppet/lib',
38
+ 'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
39
+ 'hieradatadir' => '/etc/puppet/hieradata',
40
+ 'hieraconf' => '/etc/puppet/hiera.yaml',
41
+ 'distmoduledir' => '/etc/puppet/modules',
42
+ 'sitemoduledir' => '/usr/share/puppet/modules',
43
+ },
44
+ 'unix' => {
45
+ 'puppetserver-confdir' => '/etc/puppetserver/conf.d',
46
+ 'puppetservice' => 'puppetmaster',
47
+ 'puppetpath' => '/etc/puppet',
48
+ 'puppetconfdir' => '/etc/puppet',
49
+ 'puppetvardir' => '/var/lib/puppet',
50
+ 'puppetbin' => '/usr/bin/puppet',
51
+ 'puppetbindir' => '/usr/bin',
52
+ 'privatebindir' => '/usr/bin',
53
+ 'hieralibdir' => '/opt/puppet-git-repos/hiera/lib',
54
+ 'hierapuppetlibdir' => '/opt/puppet-git-repos/hiera-puppet/lib',
55
+ 'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
56
+ 'hieradatadir' => '/etc/puppet/hieradata',
57
+ 'hieraconf' => '/etc/puppet/hiera.yaml',
58
+ 'distmoduledir' => '/etc/puppet/modules',
59
+ 'sitemoduledir' => '/usr/share/puppet/modules',
60
+ },
61
+ 'windows' => { #cygwin windows
62
+ 'puppetpath' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
63
+ 'puppetconfdir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
64
+ 'puppetcodedir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
65
+ 'hieraconf' => '`cygpath -smF 35`/Puppetlabs/puppet/etc/hiera.yaml',
66
+ 'puppetvardir' => '`cygpath -smF 35`/PuppetLabs/puppet/var',
67
+ 'distmoduledir' => '`cygpath -smF 35`/PuppetLabs/puppet/etc/modules',
68
+ 'sitemoduledir' => 'C:/usr/share/puppet/modules',
69
+ 'hieralibdir' => '`cygpath -w /opt/puppet-git-repos/hiera/lib`',
70
+ 'hierapuppetlibdir' => '`cygpath -w /opt/puppet-git-repos/hiera-puppet/lib`',
71
+ #let's just add both potential bin dirs to the path
72
+ 'puppetbindir' => '/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/bin:/cygdrive/c/Program Files/Puppet Labs/Puppet/bin',
73
+ 'privatebindir' => '/usr/bin',
74
+ 'hierabindir' => '/opt/puppet-git-repos/hiera/bin',
75
+ },
76
+ 'pswindows' => { #windows windows
77
+ 'distmoduledir' => 'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules',
78
+ 'sitemoduledir' => 'C:\\usr\\share\\puppet\\modules',
79
+ 'hieralibdir' => 'C:\\opt\\puppet-git-repos\\hiera\\lib',
80
+ 'hierapuppetlibdir' => 'C:\\opt\\puppet-git-repos\\hiera-puppet\\lib',
81
+ 'hierabindir' => 'C:\\opt\\puppet-git-repos\\hiera\\bin',
82
+ 'puppetpath' => '"C:\\Program Files (x86)\\Puppet Labs\\Puppet\\etc";"C:\\Program Files\\Puppet Labs\\Puppet\\etc"',
83
+ 'hieraconf' => '"C:\\Program Files (x86)\\Puppet Labs\\Puppet\\etc\\hiera.yaml";"C:\\Program Files\\Puppet Labs\\Puppet\\etc\\hiera.yaml"',
84
+ 'puppetvardir' => '"C:\\Program Files (x86)\\Puppet Labs\\Puppet\\var";"C:\\Program Files\\Puppet Labs\\Puppet\\var"',
85
+ 'puppetbindir' => '"C:\\Program Files (x86)\\Puppet Labs\\Puppet\\bin";"C:\\Program Files\\Puppet Labs\\Puppet\\bin"',
86
+ },
87
+ }
88
+
89
+
90
+ # Add the appropriate foss defaults to the host object so that they can be accessed using host[option], set host[:type] = foss
91
+ # @param [Host] host A single host to act upon
92
+ # @param [String] platform The platform type of this host, one of windows, pswindows, freebsd, mac & unix
93
+ def add_platform_foss_defaults(host, platform)
94
+ FOSS_DEFAULTS[platform].each_pair do |key, val|
95
+ host[key] = val
96
+ end
97
+ # add the group and type for backwards compatability
98
+ if host['platform'] =~ /windows/
99
+ host['group'] = 'Administrators'
100
+ else
101
+ host['group'] = 'puppet'
102
+ end
103
+ host['type'] = 'foss'
104
+ end
105
+
106
+ # Add the appropriate foss defaults to an array of hosts
107
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
108
+ # or a role (String or Symbol) that identifies one or more hosts.
109
+ def add_foss_defaults_on(hosts)
110
+ block_on hosts do | host |
111
+ case host.class.to_s.downcase
112
+ when /aix|unix/
113
+ platform = 'unix'
114
+ when /freebsd/
115
+ platform = 'freebsd'
116
+ when /mac/
117
+ platform = 'mac'
118
+ when /pswindows/
119
+ platform = 'pswindows'
120
+ else
121
+ platform = 'windows'
122
+ end
123
+ add_platform_foss_defaults(host, platform)
124
+ end
125
+ end
126
+
127
+ # Remove the appropriate foss defaults from the host object so that they can no longer be accessed using host[option], set host[:type] = nil
128
+ # @param [Host] host A single host to act upon
129
+ # @param [String] platform The platform type of this host, one of windows, pswindows, freebsd, mac & unix
130
+ def remove_platform_foss_defaults(host, platform)
131
+ PE_DEFAULTS[platform].each_pair do |key, val|
132
+ host.delete(key)
133
+ end
134
+ host['group'] = nil
135
+ host['type'] = nil
136
+ end
137
+
138
+ # Remove the appropriate foss defaults from an array of hosts
139
+ # @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
140
+ # or a role (String or Symbol) that identifies one or more hosts.
141
+ def remove_foss_defaults_on(hosts)
142
+ block_on hosts do | host |
143
+ case host.class.to_s.downcase
144
+ when /aix|unix/
145
+ platform = 'unix'
146
+ when /freebsd/
147
+ platform = 'freebsd'
148
+ when /mac/
149
+ platform = 'mac'
150
+ when /pswindows/
151
+ platform = 'pswindows'
152
+ else
153
+ platform = 'windows'
154
+ end
155
+ remove_platform_foss_defaults(host, platform)
156
+ end
157
+ end
158
+
159
+ end
160
+ end
161
+ end
162
+ end
163
+