Skip to content

Commit

Permalink
Merge pull request #167 from red-gate/hiera_data_remote_path-default-…
Browse files Browse the repository at this point in the history
…values

Fix default values for hiera_data_remote_path based on puppet_version
  • Loading branch information
neillturner authored May 8, 2017
2 parents 3eaecf9 + 912c834 commit ff07b62
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/kitchen/provisioner/puppet_apply.rb
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,12 @@ def hiera_data

def hiera_data_remote_path
return config[:hiera_data_remote_path] if config[:hiera_data_remote_path]
powershell? ? 'C:/ProgramData/PuppetLabs/hiera/var' : '/var/lib/hiera'

if config[:require_puppet_collections]
powershell? ? 'C:/ProgramData/PuppetLabs/code/environments/production/hieradata' : '/etc/puppetlabs/code/environments/production/hieradata'
else
powershell? ? 'C:/ProgramData/PuppetLabs/hiera/var' : '/var/lib/hiera'
end
end

def hiera_writer
Expand Down
16 changes: 14 additions & 2 deletions spec/kitchen/provisioner/puppet_apply_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,15 @@
end

describe 'hiera_data_remote_path' do
it 'is C:/ProgramData/PuppetLabs/hiera/var' do
it 'is C:/ProgramData/PuppetLabs/hiera/var when using puppet v3' do
config[:require_puppet_collections] = false
expect(provisioner.send(:hiera_data_remote_path)).to eq('C:/ProgramData/PuppetLabs/hiera/var')
end

it 'is C:/ProgramData/PuppetLabs/code/environments/production/hieradata when using puppet v4' do
config[:require_puppet_collections] = true
expect(provisioner.send(:hiera_data_remote_path)).to eq('C:/ProgramData/PuppetLabs/code/environments/production/hieradata')
end
end

describe 'puppet_dir' do
Expand Down Expand Up @@ -747,9 +753,15 @@

context 'When NOT using powershell' do
describe 'hiera_data_remote_path' do
it 'is /var/lib/hiera' do
it 'is /var/lib/hiera when using puppet v3' do
config[:require_puppet_collections] = false
expect(provisioner.send(:hiera_data_remote_path)).to eq('/var/lib/hiera')
end

it 'is /etc/puppetlabs/code/environments/production/hieradata when using puppet v4' do
config[:require_puppet_collections] = true
expect(provisioner.send(:hiera_data_remote_path)).to eq('/etc/puppetlabs/code/environments/production/hieradata')
end
end

describe 'puppet_dir' do
Expand Down

0 comments on commit ff07b62

Please sign in to comment.