Skip to content

Commit

Permalink
Specify default for order parameter on auto::mount
Browse files Browse the repository at this point in the history
The `order` parameter to `auto::mount`

```puppet
auto::mount{'home':
  mount   => '/home',
  mapfile => '/etc/auto.home',
  order   => 3,
  ...
}
```
currently must be specified.

Especially since in the vast majority of cases the order of the lines
in `/etc/auto.master` is irrelevent a default this value can be specified.

Motification, less mandatory options always good.
  • Loading branch information
traylenator committed Jun 15, 2017
1 parent ff8d91d commit 647a30f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
3 changes: 2 additions & 1 deletion manifests/mount.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# path using filenames ending in the ".autofs" extension.
# @param options Options for the autofs mount point within in the auto.master.
# @param order Order in which entries will appear in the autofs master file.
# Defaults to 1.
# @param direct Boolean to allow for indirect map. Defaults to true to be
# backwards compatible.
# @param execute If true, it will make the $mapfile an executable script,
Expand All @@ -41,7 +42,7 @@
#
define autofs::mount (
Stdlib::Absolutepath $mount,
Integer $order,
Integer $order = 1,
Optional[Stdlib::Absolutepath] $mapfile = undef,
Optional[String] $options = '',
Stdlib::Absolutepath $master = '/etc/auto.master',
Expand Down
64 changes: 64 additions & 0 deletions spec/acceptance/autofs_two_indirect_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
require 'spec_helper_acceptance'

describe 'autofs::mount indirect tests' do
context 'two indirect test, order not specified' do
it 'applies' do
pp = <<-EOS
class { 'autofs': }
autofs::mount { 'foo':
mount => '/foo',
mapfile => '/etc/auto.foo',
mapcontents => ['FOO -o rw /mnt/test_FOO'],
options => '--timeout=120',
}
autofs::mount { 'bar':
mount => '/bar',
mapfile => '/etc/auto.bar',
mapcontents => ['BAR -o rw /mnt/test_BAR'],
options => '--timeout=240',
}
EOS

apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe file('/etc/auto.master') do
it 'exists and have content' do
is_expected.to exist
is_expected.to be_owned_by 'root'
is_expected.to be_grouped_into 'root'
is_expected.to contain '/foo /etc/auto.foo --timeout=120'
is_expected.to contain '/bar /etc/auto.bar --timeout=240'
end
end

describe file('/etc/auto.foo') do
it 'exists and have content' do
is_expected.to exist
is_expected.to be_owned_by 'root'
is_expected.to be_grouped_into 'root'
is_expected.to contain 'FOO -o rw /mnt/test_FOO'
end
end

describe file('/etc/auto.bar') do
it 'exists and have content' do
is_expected.to exist
is_expected.to be_owned_by 'root'
is_expected.to be_grouped_into 'root'
is_expected.to contain 'BAR -o rw /mnt/test_BAR'
end
end

describe package('autofs') do
it { is_expected.to be_installed }
end

describe service('autofs') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end
end
end

0 comments on commit 647a30f

Please sign in to comment.