Skip to content

Commit

Permalink
add support for populating ldap mapping file
Browse files Browse the repository at this point in the history
  • Loading branch information
jtriley committed Jul 20, 2015
1 parent 4289628 commit d5b34c4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@
$oned_ldap_mapping_generate = $one::params::oned_ldap_mapping_generate,
$oned_ldap_mapping_timeout = $one::params::oned_ldap_mapping_timeout,
$oned_ldap_mapping_filename = $one::params::oned_ldap_mapping_filename,
$oned_ldap_mappings = $one::params::oned_ldap_mappings,
$oned_ldap_mapping_key = $one::params::oned_ldap_mapping_key,
$oned_ldap_mapping_default = $one::params::oned_ldap_mapping_default,
$one_repo_enable = $one::params::one_repo_enable,
Expand Down
14 changes: 13 additions & 1 deletion manifests/oned/sunstone/ldap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
# http://www.apache.org/licenses/LICENSE-2.0.html
#
class one::oned::sunstone::ldap (
$oned_sunstone_ldap_pkg = $one::oned_sunstone_ldap_pkg
$oned_sunstone_ldap_pkg = $one::oned_sunstone_ldap_pkg,
$oned_ldap_mappings = $one::oned_ldap_mappings,
$oned_ldap_mapping_filename = $one::oned_ldap_mapping_filename,
) {
package { $oned_sunstone_ldap_pkg:
ensure => 'latest',
Expand All @@ -36,4 +38,14 @@
content => template('one/ldap_auth.conf.erb'),
notify => Service['opennebula'],
}
if $oned_ldap_mappings != undef {
validate_hash($oned_ldap_mappings)
file { "/var/lib/one/${oned_ldap_mapping_filename}":
ensure => file,
owner => 'oneadmin',
group => 'oneadmin',
mode => '0644',
content => template('one/ldap_mappings.yaml.erb'),
}
}
}
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
$oned_ldap_mapping_filename = hiera('one::oned::ldap_mapping_filename','undef')
$oned_ldap_mapping_key = hiera('one::oned::ldap_mapping_key','undef')
$oned_ldap_mapping_default = hiera('one::oned::ldap_mapping_default','undef')
$oned_ldap_mappings = hiera('one::oned::ldap_mappings',undef)
# should we enable opennebula repos?
$one_repo_enable = hiera('one::enable_opennebula_repo', 'true' )
# Which version
Expand Down
6 changes: 6 additions & 0 deletions templates/ldap_mappings.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<%
# The gsub below is required because of a bug in puppet:
# https://tickets.puppetlabs.com/browse/PUP-3120
# Basically it indents the yaml which breaks the whole doc.
%>
<%= @oned_ldap_mappings.to_yaml.gsub(/^\s{2}/, '') %>

0 comments on commit d5b34c4

Please sign in to comment.