Skip to content

Commit

Permalink
openldap_schema: fix replace w/o attribute types
Browse files Browse the repository at this point in the history
Check if the schema contains any attribute types
before adding the relevant `replace:` lines to the replace ldif.

This fixes failing updates on schemas without any attribute types.
  • Loading branch information
dmaes committed Aug 25, 2023
1 parent 61aa9b1 commit f25ce32
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/puppet/provider/openldap_schema/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ def self.schemaToLdifReplace(schema, name)
ldif.push('-')
end

ldif.push('replace: olcAttributeTypes')
ldif.push(*attrType)
ldif.push('-')
unless attrType.empty?
ldif.push('replace: olcAttributeTypes')
ldif.push(*attrType)
ldif.push('-')
end

ldif.push('replace: olcObjectClasses')
ldif.push(*objClass)
Expand Down Expand Up @@ -154,9 +156,11 @@ def self.ldifReplace(ldif, name)
new_ldif.push('-')
end

new_ldif.push('replace: olcAttributeTypes')
new_ldif.push(*attrType)
new_ldif.push('-')
unless attrType.empty?
new_ldif.push('replace: olcAttributeTypes')
new_ldif.push(*attrType)
new_ldif.push('-')
end

new_ldif.push('replace: olcObjectClasses')
new_ldif.push(*objClass)
Expand Down

0 comments on commit f25ce32

Please sign in to comment.