beaker 2.5.1 → 2.6.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 (53) hide show
  1. checksums.yaml +8 -8
  2. data/HISTORY.md +184 -2
  3. data/acceptance/fixtures/README.md +3 -0
  4. data/acceptance/fixtures/module/Gemfile +12 -0
  5. data/acceptance/fixtures/module/README.md +79 -0
  6. data/acceptance/fixtures/module/Rakefile +18 -0
  7. data/acceptance/fixtures/module/lib/empty.txt +1 -0
  8. data/acceptance/fixtures/module/manifests/init.pp +41 -0
  9. data/acceptance/fixtures/module/metadata.json +14 -0
  10. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +72 -0
  11. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
  12. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
  13. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
  14. data/acceptance/fixtures/module/spec/acceptance/nodesets/centos-65-x64.yml +10 -0
  15. data/acceptance/fixtures/module/spec/acceptance/nodesets/default.yml +10 -0
  16. data/acceptance/fixtures/module/spec/acceptance/nodesets/fedora-18-x64.yml +10 -0
  17. data/acceptance/fixtures/module/spec/acceptance/nodesets/internal-vpool.yml +17 -0
  18. data/acceptance/fixtures/module/spec/acceptance/nodesets/sles-11-x64.yml +10 -0
  19. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
  20. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
  21. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +11 -0
  22. data/acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-14042-x64.yml +16 -0
  23. data/acceptance/fixtures/module/spec/classes/init_spec.rb +7 -0
  24. data/acceptance/fixtures/module/spec/spec_helper.rb +1 -0
  25. data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +38 -0
  26. data/acceptance/fixtures/module/tests/init.pp +12 -0
  27. data/acceptance/fixtures/module/vendor/bundle/ruby/gems.txt +1 -0
  28. data/acceptance/pre_suite/README.md +7 -0
  29. data/acceptance/tests/base/README.md +4 -0
  30. data/acceptance/tests/base/host.rb +154 -0
  31. data/acceptance/tests/puppet/README.md +3 -0
  32. data/lib/beaker/answers/version20.rb +1 -1
  33. data/lib/beaker/answers/version28.rb +1 -1
  34. data/lib/beaker/answers/version30.rb +1 -1
  35. data/lib/beaker/dsl/helpers.rb +12 -2
  36. data/lib/beaker/dsl/install_utils.rb +16 -6
  37. data/lib/beaker/host.rb +79 -13
  38. data/lib/beaker/host/pswindows/exec.rb +4 -0
  39. data/lib/beaker/host/unix.rb +3 -12
  40. data/lib/beaker/host/windows.rb +2 -11
  41. data/lib/beaker/host/windows/file.rb +1 -1
  42. data/lib/beaker/host/windows/pkg.rb +1 -1
  43. data/lib/beaker/host_prebuilt_steps.rb +1 -1
  44. data/lib/beaker/hypervisor.rb +4 -2
  45. data/lib/beaker/hypervisor/{vcloud_pooled.rb → vmpooler.rb} +10 -14
  46. data/lib/beaker/options/presets.rb +1 -0
  47. data/lib/beaker/version.rb +1 -1
  48. data/spec/beaker/dsl/helpers_spec.rb +16 -0
  49. data/spec/beaker/dsl/install_utils_spec.rb +7 -6
  50. data/spec/beaker/host_spec.rb +13 -11
  51. data/spec/beaker/hypervisor/hypervisor_spec.rb +2 -2
  52. data/spec/beaker/hypervisor/{vcloud_pooled_spec.rb → vmpooler_spec.rb} +20 -20
  53. metadata +33 -4
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ centos-59-x64:
3
+ roles:
4
+ - master
5
+ platform: el-5-x86_64
6
+ box : centos-59-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: git
@@ -0,0 +1,12 @@
1
+ HOSTS:
2
+ centos-64-x64:
3
+ roles:
4
+ - master
5
+ - database
6
+ - dashboard
7
+ platform: el-6-x86_64
8
+ box : centos-64-x64-vbox4210-nocm
9
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
10
+ hypervisor : vagrant
11
+ CONFIG:
12
+ type: pe
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ centos-64-x64:
3
+ roles:
4
+ - master
5
+ platform: el-6-x86_64
6
+ box : centos-64-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ centos-65-x64:
3
+ roles:
4
+ - master
5
+ platform: el-6-x86_64
6
+ box : centos-65-x64-vbox436-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ centos-64-x64:
3
+ roles:
4
+ - master
5
+ platform: el-6-x86_64
6
+ box : centos-64-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ fedora-18-x64:
3
+ roles:
4
+ - master
5
+ platform: fedora-18-x86_64
6
+ box : fedora-18-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,17 @@
1
+ HOSTS:
2
+ centos-7-x86_64-master:
3
+ roles:
4
+ - agent
5
+ - dashboard
6
+ - database
7
+ - master
8
+ hypervisor: vcloud
9
+ platform: centos-7-x86_64
10
+ template: Delivery/Quality Assurance/Templates/vCloud/centos-7-x86_64
11
+ CONFIG:
12
+ pooling_api: http://vcloud.delivery.puppetlabs.net
13
+ datastore: instance0
14
+ folder: Delivery/Quality Assurance/Staging/Dynamic
15
+ resourcepool: delivery/Quality Assurance/Staging/Dynamic
16
+ nfs_server: none
17
+ consoleport: 443
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ sles-11-x64.local:
3
+ roles:
4
+ - master
5
+ platform: sles-11-x64
6
+ box : sles-11sp1-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ ubuntu-server-10044-x64:
3
+ roles:
4
+ - master
5
+ platform: ubuntu-10.04-amd64
6
+ box : ubuntu-server-10044-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,10 @@
1
+ HOSTS:
2
+ ubuntu-server-12042-x64:
3
+ roles:
4
+ - master
5
+ platform: ubuntu-12.04-amd64
6
+ box : ubuntu-server-12042-x64-vbox4210-nocm
7
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ type: foss
@@ -0,0 +1,11 @@
1
+ HOSTS:
2
+ ubuntu-server-1404-x64:
3
+ roles:
4
+ - master
5
+ platform: ubuntu-14.04-amd64
6
+ box : puppetlabs/ubuntu-14.04-64-nocm
7
+ box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
8
+ hypervisor : vagrant
9
+ CONFIG:
10
+ log_level : debug
11
+ type: git
@@ -0,0 +1,16 @@
1
+ HOSTS:
2
+ ubuntu1404:
3
+ roles:
4
+ - agent
5
+ platform: ubuntu-14.04-amd64
6
+ template: ubuntu-1404-x86_64
7
+ hypervisor: vcloud
8
+ CONFIG:
9
+ type: foss
10
+ keyfile: ~/.ssh/id_rsa-acceptance
11
+ nfs_server: none
12
+ consoleport: 443
13
+ datastore: instance0
14
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
15
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
16
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+ describe 'demo' do
3
+
4
+ context 'with defaults for all parameters' do
5
+ it { should contain_class('demo') }
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ require 'puppetlabs_spec_helper/module_spec_helper'
@@ -0,0 +1,38 @@
1
+ require 'beaker-rspec'
2
+
3
+ unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
4
+ # This will install the latest available package on el and deb based
5
+ # systems fail on windows and osx, and install via gem on other *nixes
6
+ foss_opts = {:default_action => 'gem_install'}
7
+
8
+ if default.is_pe?; then
9
+ install_pe;
10
+ else
11
+ install_puppet(foss_opts);
12
+ end
13
+
14
+ hosts.each do |host|
15
+ unless host.is_pe?
16
+ on host, "/bin/echo '' > #{host.puppet('hiera_config')}"
17
+ end
18
+ on host, "mkdir -p #{host['distmoduledir']}"
19
+ end
20
+ end
21
+
22
+ RSpec.configure do |c|
23
+ # Project root
24
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
25
+
26
+ # Readable test descriptions
27
+ c.formatter = :documentation
28
+
29
+ # Configure all nodes in nodeset
30
+ c.before :suite do
31
+ hosts.each do |host|
32
+ on host, "mkdir -p #{host['distmoduledir']}/demo"
33
+ %w(lib manifests metadata.json).each do |file|
34
+ scp_to host, "#{proj_root}/#{file}", "#{host['distmoduledir']}/ntp"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,12 @@
1
+ # The baseline for module testing used by Puppet Labs is that each manifest
2
+ # should have a corresponding test manifest that declares that class or defined
3
+ # type.
4
+ #
5
+ # Tests are then run by using puppet apply --noop (to check for compilation
6
+ # errors and view a log of events) or by fully applying the test in a virtual
7
+ # environment (to compare the resulting system state to the desired state).
8
+ #
9
+ # Learn more about module testing here:
10
+ # http://docs.puppetlabs.com/guides/tests_smoke.html
11
+ #
12
+ include demo
@@ -0,0 +1 @@
1
+ test gems would live in this directory
@@ -0,0 +1,7 @@
1
+ # Beaker Acceptance Tests: pre-suite
2
+
3
+ Collection of pre-suites for SUT configuration before test execution.
4
+
5
+ Options:
6
+ * install PE
7
+ * install FOSS Puppet
@@ -0,0 +1,4 @@
1
+ # Beaker Acceptance Tests: base
2
+
3
+ Tests that do not depend upon Puppet being installed on the SUTs.
4
+
@@ -0,0 +1,154 @@
1
+ test_name "confirm host object behave correctly"
2
+
3
+ step "#port_open? : can determine if a port is open on hosts"
4
+ hosts.each do |host|
5
+ logger.debug "port 22 (ssh) should be open on #{host}"
6
+ assert_equal(true, host.port_open?(22), "port 22 on #{host} should be open")
7
+ logger.debug "port 65535 should be closed on #{host}"
8
+ assert_equal(false, host.port_open?(65535), "port 65535 on #{host} should be closed")
9
+ end
10
+
11
+ step "#ip : can determine the ip address on hosts"
12
+ hosts.each do |host|
13
+ ip = host.ip
14
+ # confirm ip format
15
+ logger.debug("format of #{ip} for #{host} should be correct")
16
+ assert_match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/, ip, "#{ip} on #{host} isn't correct format")
17
+ end
18
+
19
+ step "#is_x86_64? : can determine arch on hosts"
20
+ hosts.each do |host|
21
+ if host['platform'] =~ /x86_64|_64|amd64|-64/
22
+ assert_equal(true, host.is_x86_64?, "is_x86_64? should be true on #{host}: #{host['platform']}")
23
+ else
24
+ assert_equal(false, host.is_x86_64?, "is_x86_64? should be false on #{host}: #{host['platform']}")
25
+ end
26
+ end
27
+
28
+ step "#add_env_var : can add an environment variable"
29
+ hosts.each do |host|
30
+ logger.debug("add TEST=1")
31
+ host.add_env_var("TEST", "1")
32
+ logger.debug("add TEST=1 again (shouldn't create duplicate entry)")
33
+ host.add_env_var("test", "1")
34
+ logger.debug("add test=2")
35
+ host.add_env_var("test", "2")
36
+ logger.debug("ensure that TEST env var has correct setting")
37
+ logger.debug("add test=3")
38
+ host.add_env_var("test", "3")
39
+ logger.debug("ensure that TEST env var has correct setting")
40
+ val = host.get_env_var("test")
41
+ assert_match(/TEST=3(;|:)2(;|:)1$/, val, "add_env_var can correctly add env vars")
42
+ end
43
+
44
+ step "#delete_env_var : can delete an environment"
45
+ hosts.each do |host|
46
+ logger.debug("remove TEST=3")
47
+ host.delete_env_var("TEST", "3")
48
+ val = host.get_env_var("test")
49
+ assert_match(/TEST=2(;|:)1$/, val, "delete_env_var can correctly delete part of a chained env var")
50
+ logger.debug("remove TEST=1")
51
+ host.delete_env_var("TEST", "1")
52
+ val = host.get_env_var("test")
53
+ assert_match(/TEST=2$/, val, "delete_env_var can correctly delete part of a chained env var")
54
+ logger.debug("remove TEST=2")
55
+ host.delete_env_var("TEST", "2")
56
+ val = host.get_env_var("test")
57
+ assert_equal("", val, "delete_env_var fully removes empty env var")
58
+ end
59
+
60
+ step "#mkdir_p : can recursively create a directory structure on a host"
61
+ hosts.each do |host|
62
+ #clean up first!
63
+ host.rm_rf("test1")
64
+ #test dir construction
65
+ logger.debug("create test1/test2/test3/test4")
66
+ assert_equal(true, host.mkdir_p("test1/test2/test3/test4"), "can create directory structure")
67
+ logger.debug("should be able to create a file in the new dir")
68
+ on host, host.touch("test1/test2/test3/test4/test.txt", false)
69
+ end
70
+
71
+ step "#do_scp_to : can copy a directory to the host with no ignores"
72
+ current_dir = File.dirname(__FILE__)
73
+ module_fixture = File.join(current_dir, "../../fixtures/module")
74
+ hosts.each do |host|
75
+ logger.debug("can recursively copy a module over")
76
+ #make sure that we are clean on the test host
77
+ host.rm_rf("module")
78
+ host.do_scp_to(module_fixture, ".", {})
79
+ Dir.mktmpdir do |tmp_dir|
80
+ #grab copy from host
81
+ host.do_scp_from("module", tmp_dir, {})
82
+ #compare to local copy
83
+ local_paths = Dir.glob(File.join(module_fixture, "**/*")).select { |f| File.file?(f) }
84
+ host_paths = Dir.glob(File.join(File.join(tmp_dir, "module"), "**/*")).select { |f| File.file?(f) }
85
+ #each local file should have a single match on the host
86
+ local_paths.each do |path|
87
+ search_name = path.gsub(/^.*fixtures\//, '') #reduce down to the path that should match
88
+ matched = host_paths.select{ |check| check =~ /#{Regexp.escape(search_name)}$/ }
89
+ assert_equal(1, matched.length, "should have found a single instance of path #{search_name}, found #{matched.length}: \n #{matched}")
90
+ host_paths = host_paths - matched
91
+ end
92
+ assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
93
+ end
94
+ end
95
+
96
+ step "#do_scp_to with :ignore : can copy a dir to the host, excluding ignored patterns that DO NOT appear in the source absolute path"
97
+ current_dir = File.dirname(__FILE__)
98
+ module_fixture = File.expand_path(File.join(current_dir, "../../fixtures/module"))
99
+ hosts.each do |host|
100
+ logger.debug("can recursively copy a module over, ignoring some files/dirs")
101
+ #make sure that we are clean on the test host
102
+ host.rm_rf("module")
103
+ host.do_scp_to(module_fixture, ".", {:ignore => ['vendor', 'Gemfile']})
104
+ Dir.mktmpdir do |tmp_dir|
105
+ #grab copy from host
106
+ host.do_scp_from("module", tmp_dir, {})
107
+ #compare to local copy
108
+ local_paths = Dir.glob(File.join(module_fixture, "**/*")).select { |f| File.file?(f) }
109
+ host_paths = Dir.glob(File.join(File.join(tmp_dir, "module"), "**/*")).select { |f| File.file?(f) }
110
+ #each local file should have a single match on the host
111
+ local_paths.each do |path|
112
+ search_name = path.gsub(/^.*fixtures\//, '') #reduce down to the path that should match
113
+ matched = host_paths.select{ |check| check =~ /#{Regexp.escape(search_name)}$/ }
114
+ re = /((\/|\A)vendor(\/|\z))|((\/|\A)Gemfile(\/|\z))/
115
+ if path !~ re
116
+ assert_equal(1, matched.length, "should have found a single instance of path #{search_name}, found #{matched.length}: \n #{matched}")
117
+ else
118
+ assert_equal(0, matched.length, "should have found no instances of path #{search_name}, found #{matched.length}: \n #{matched}")
119
+ end
120
+ host_paths = host_paths - matched
121
+ end
122
+ assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
123
+ end
124
+ end
125
+
126
+ step "#do_scp_to with :ignore : can copy a dir to the host, excluding ignored patterns that DO appear in the source absolute path"
127
+ current_dir = File.dirname(__FILE__)
128
+ module_fixture = File.expand_path(File.join(current_dir, "../../fixtures/module"))
129
+ hosts.each do |host|
130
+ logger.debug("can recursively copy a module over, ignoring some sub-files/sub-dirs that also appear in the absolute path")
131
+ #make sure that we are clean on the test host
132
+ host.rm_rf("module")
133
+ host.do_scp_to(module_fixture, ".", {:ignore => ['module', 'Gemfile']})
134
+ Dir.mktmpdir do |tmp_dir|
135
+ #grab copy from host
136
+ host.do_scp_from("module", tmp_dir, {})
137
+ #compare to local copy
138
+ local_paths = Dir.glob(File.join(module_fixture, "**/*")).select { |f| File.file?(f) }
139
+ host_paths = Dir.glob(File.join(File.join(tmp_dir, "module"), "**/*")).select { |f| File.file?(f) }
140
+ #each local file should have a single match on the host
141
+ local_paths.each do |path|
142
+ search_name = path.gsub(/^.*fixtures\/module\//, '') #reduce down to the path that should match
143
+ matched = host_paths.select{ |check| check =~ /#{Regexp.escape(search_name)}$/ }
144
+ re = /((\/|\A)module(\/|\z))|((\/|\A)Gemfile(\/|\z))/
145
+ if path.gsub(/^.*module\//, '') !~ re
146
+ assert_equal(1, matched.length, "should have found a single instance of path #{search_name}, found #{matched.length}: \n #{matched}")
147
+ else
148
+ assert_equal(0, matched.length, "should have found no instances of path #{search_name}, found #{matched.length}: \n #{matched}")
149
+ end
150
+ host_paths = host_paths - matched
151
+ end
152
+ assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
153
+ end
154
+ end
@@ -0,0 +1,3 @@
1
+ # Beaker Acceptance Tests: puppet
2
+
3
+ Tests that depend upon Puppet being installed on the SUTs.
@@ -109,7 +109,7 @@ module Beaker
109
109
  master = only_host_with_role(@hosts, 'master')
110
110
  @hosts.each do |h|
111
111
  the_answers[h.name] = host_answers(h, master, dashboard, @options)
112
- if h[:custom_answers]
112
+ if the_answers[h.name] && h[:custom_answers]
113
113
  the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers])
114
114
  end
115
115
  h[:answers] = the_answers[h.name]
@@ -109,7 +109,7 @@ module Beaker
109
109
  master = only_host_with_role(@hosts, 'master')
110
110
  @hosts.each do |h|
111
111
  the_answers[h.name] = host_answers(h, master, dashboard, @options)
112
- if h[:custom_answers]
112
+ if the_answers[h.name] && h[:custom_answers]
113
113
  the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers])
114
114
  end
115
115
  h[:answers] = the_answers[h.name]
@@ -211,7 +211,7 @@ module Beaker
211
211
  else
212
212
  the_answers[h.name] = host_answers(h, master, database, dashboard, @options)
213
213
  end
214
- if h[:custom_answers]
214
+ if the_answers[h.name] && h[:custom_answers]
215
215
  the_answers[h.name] = the_answers[h.name].merge(h[:custom_answers])
216
216
  end
217
217
  h[:answers] = the_answers[h.name]
@@ -1405,7 +1405,7 @@ module Beaker
1405
1405
  hiera_config=Hash.new
1406
1406
  hiera_config[:backends] = 'yaml'
1407
1407
  hiera_config[:yaml] = {}
1408
- hiera_config[:yaml][:datadir] = host[:hieradatadir]
1408
+ hiera_config[:yaml][:datadir] = hiera_datadir(host)
1409
1409
  hiera_config[:hierarchy] = hierarchy
1410
1410
  hiera_config[:logger] = 'console'
1411
1411
  create_remote_file host, host.puppet['hiera_config'], hiera_config.to_yaml
@@ -1424,7 +1424,7 @@ module Beaker
1424
1424
  # or a role (String or Symbol) that identifies one or more hosts.
1425
1425
  # @param[String] Directory containing the hiera data files.
1426
1426
  def copy_hiera_data_to(host, source)
1427
- scp_to host, File.expand_path(source), host[:hieradatadir]
1427
+ scp_to host, File.expand_path(source), hiera_datadir(host)
1428
1428
  end
1429
1429
 
1430
1430
  # Copy hiera data files to the default host
@@ -1433,6 +1433,16 @@ module Beaker
1433
1433
  copy_hiera_data_to(default, source)
1434
1434
  end
1435
1435
 
1436
+ # Get file path to the hieradatadir for a given host.
1437
+ # Handles whether or not a host is AIO-based & backwards compatibility
1438
+ #
1439
+ # @param[Host] host Host you want to use the hieradatadir from
1440
+ #
1441
+ # @return [String] Path to the hiera data directory
1442
+ def hiera_datadir(host)
1443
+ host[:type] =~ /aio/ ? File.join(host.puppet['codedir'], 'hieradata') : host[:hieradatadir]
1444
+ end
1445
+
1436
1446
  end
1437
1447
  end
1438
1448
  end