Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
add schema_file param to port389::instance define
Browse files Browse the repository at this point in the history
This param controls SchemaFile entrie(s) in the setup.inf file.
  • Loading branch information
Joshua Hoblitt committed Jan 18, 2014
1 parent 1361895 commit c58e434
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
3 changes: 2 additions & 1 deletion manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$root_dn_pwd = $::port389::root_dn_pwd,
$server_port = $::port389::server_port,
$suffix = port389_domain2dn($::port389::admin_domain),
$schema_file = undef,
) {
# follow the same server identifier validation rules as setup-ds-admin.pl
validate_re($title, '^[\w#%:@-]*$', "The ServerIdentifier '${title}' contains invalid characters. It must contain only alphanumeric characters and the following: #%:@_-")
Expand Down Expand Up @@ -49,13 +50,13 @@
'InstallLdifFile' => '',
'RootDN' => $root_dn,
'RootDNPwd' => $root_dn_pwd,
'SchemaFile' => $schema_file,
'ServerIdentifier' => $title,
'ServerPort' => $server_port,
'SlapdConfigForMC' => 'yes',
'Suffix' => $suffix,
'UseExistingMC' => '0',
'ds_bename' => 'userRoot',
#'SchemaFile' => [],
#'bak_dir' => '/var/lib/dirsrv/slapd-ldap1/bak',
#'bindir' => '/usr/bin',
#'cert_dir' => '/etc/dirsrv/slapd-ldap1',
Expand Down
38 changes: 38 additions & 0 deletions spec/defines/port389_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,44 @@
:logoutput => true,
})
end

context 'schema_file =>' do
context '/dne/foo.ldif' do
let(:params) {{ :schema_file => '/dne/foo.ldif' }}

it do
should contain_file('setup_ldap1.inf').with({
:ensure => 'file',
:path => '/var/lib/dirsrv/setup/setup_ldap1.inf',
:owner => 'nobody',
:group => 'nobody',
:mode => '0600',
:backup => false,
:content => %r{SchemaFile=/dne/foo.ldif},
})
end
end

context '[ /dne/foo.ldif, /dne/bar.ldif ]' do
files = %w{ /dne/foo.ldif /dne/bar.ldif }
let(:params) {{ :schema_file => files }}

files.each do |f|
it do
should contain_file('setup_ldap1.inf').with({
:ensure => 'file',
:path => '/var/lib/dirsrv/setup/setup_ldap1.inf',
:owner => 'nobody',
:group => 'nobody',
:mode => '0600',
:backup => false,
:content => /SchemaFile=#{files}/
})
end
end
end

end # schema_file =>
end

end
4 changes: 3 additions & 1 deletion templates/inf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
[<%= section %>]
<%- mysection = @data[section] -%>
<%- mysection.keys.sort.each do |key| -%>
<%- next if mysection[key].nil? -%>
<%- # at least puppet 3.4.2 leaks :undef-%>
<%- # https://tickets.puppetlabs.com/browse/PUP-1467 -%>
<%- next if mysection[key].nil? || mysection[key] == :undef -%>
<%- if mysection[key].is_a?(Array) -%>
<%- mysection[key].each do |v| -%>
<%= key %>=<%= v %>
Expand Down

0 comments on commit c58e434

Please sign in to comment.