Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Default value: `'/export'`

##### <a name="-nfs--nfs_v4_export_root_clients"></a>`nfs_v4_export_root_clients`

Data type: `String`
Data type: `Variant[String, Array[String]]`

It defines the clients that are allowed to mount NFS version 4 exports and includes the option string.

Expand Down Expand Up @@ -708,7 +708,7 @@ Default value: `$nfs::nfs_v4_export_root`

##### <a name="-nfs--server--nfs_v4_export_root_clients"></a>`nfs_v4_export_root_clients`

Data type: `String`
Data type: `Variant[String, Array[String]]`



Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
String $client_gssdopt_name = $nfs::params::client_gssdopt_name,
Boolean $client_d9_gssdopt_workaround = false,
String $nfs_v4_export_root = '/export',
String $nfs_v4_export_root_clients = "*.${facts['networking']['domain']}(ro,fsid=root,insecure,no_subtree_check,async,root_squash)",
Variant[String[1], Array[String[1]]] $nfs_v4_export_root_clients = "*.${facts['networking']['domain']}(ro,fsid=root,insecure,no_subtree_check,async,root_squash)",
String $nfs_v4_mount_root = '/srv',
String $nfs_v4_idmap_domain = $nfs::params::nfs_v4_idmap_domain,
Variant[String, Array] $nfs_v4_idmap_localrealms = '', # lint:ignore:params_empty_string_assignment
Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Enum['present', 'absent', 'running', 'stopped', 'disabled'] $ensure = $nfs::ensure,
Boolean $nfs_v4 = $nfs::nfs_v4,
String $nfs_v4_export_root = $nfs::nfs_v4_export_root,
String $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients,
Variant[String[1], Array[String[1]]] $nfs_v4_export_root_clients = $nfs::nfs_v4_export_root_clients,
String $nfs_v4_idmap_domain = $nfs::nfs_v4_idmap_domain,
String $nfs_v4_root_export_ensure = $nfs::nfs_v4_root_export_ensure,
Optional[String] $nfs_v4_root_export_mount = $nfs::nfs_v4_root_export_mount,
Expand Down
3 changes: 2 additions & 1 deletion manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

if $nfs::nfs_v4 {
if $nfs::nfsv4_bindmount_enable {
$nfs_v4_clients = Array($nfs::server::nfs_v4_export_root_clients, true).join(' ')
concat::fragment { 'nfs_exports_root':
target => $nfs::exports_file,
content => "${nfs::server::nfs_v4_export_root} ${nfs::server::nfs_v4_export_root_clients}\n",
content => "${nfs::server::nfs_v4_export_root} ${nfs_v4_clients}\n",
order => 2,
}
}
Expand Down
18 changes: 17 additions & 1 deletion spec/classes/nfs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,26 @@
end
end

context 'when nfs_v4_export_root_clients is an array' do
let(:params) { { nfs_v4: true, server_enabled: true, nfs_v4_export_root_clients: ['192.0.2.1', '192.0.2.2'] } }

it do
is_expected.to contain_concat__fragment('nfs_exports_root').
with_target('/etc/exports').
with_content(%r{/export 192\.0\.2\.1 192\.0\.2\.2})
end
end

context 'when nfs_v4 => true' do
let(:params) { { nfs_v4: true, server_enabled: true, client_enabled: false, nfs_v4_idmap_domain: 'teststring' } }
let(:node) { 'test.local' }

it do
is_expected.to contain_concat__fragment('nfs_exports_root').
with_target('/etc/exports').
with_content(%r{/export \*\.local\(ro,fsid=root,insecure,no_subtree_check,async,root_squash\)})
end

it { is_expected.to contain_concat__fragment('nfs_exports_root').with('target' => '/etc/exports') }
it { is_expected.to contain_file('/export').with('ensure' => 'directory') }
it { is_expected.to contain_augeas('/etc/idmapd.conf').with_changes(%r{set General/Domain teststring}) }

Expand Down
Loading