puppet-openldap icon indicating copy to clipboard operation
puppet-openldap copied to clipboard

Unable to set database to readonly

Open tdb opened this issue 8 years ago • 2 comments

I'm having trouble setting a database to readonly using the olc provider. It seems whatever value I set the database property to I'm unable to make this test true:

https://github.com/camptocamp/puppet-openldap/blob/d81f18f0cec4e9b2e6b4981f545b09e6339ea342/lib/puppet/provider/openldap_database/olc.rb#L367

Am I missing something? Locally I've done this little hack to make it work, but it doesn't look like the right solution:

--- a/lib/puppet/provider/openldap_database/olc.rb
+++ b/lib/puppet/provider/openldap_database/olc.rb
@@ -228,7 +228,7 @@ Puppet::Type.
     end
     t << "olcRootDN: #{resource[:rootdn]}\n" if resource[:rootdn]
     t << "olcRootPW: #{resource[:rootpw]}\n" if resource[:rootpw]
-    t << "olcReadOnly: #{resource[:readonly] == :true ? 'TRUE' : 'FALSE'}\n" if resource[:readonly]
+    t << "olcReadOnly: #{resource[:readonly] == 'TRUE' ? 'TRUE' : 'FALSE'}\n" if resource[:readonly]
     t << "olcSizeLimit: #{resource[:sizelimit]}\n" if resource[:sizelimit]
     t << "olcDbMaxSize: #{resource[:dbmaxsize]}\n" if resource[:dbmaxsize]
     t << "olcTimeLimit: #{resource[:timelimit]}\n" if resource[:timelimit]
@@ -364,7 +364,7 @@ Puppet::Type.
       t << "replace: olcRootPW\nolcRootPW: #{resource[:rootpw]}\n-\n" if @property_flush[:rootpw]
       t << "replace: olcSuffix\nolcSuffix: #{resource[:suffix]}\n-\n" if @property_flush[:suffix]
       t << "replace: olcRelay\nolcRelay: #{resource[:relay]}\n-\n" if @property_flush[:relay]
-      t << "replace: olcReadOnly\nolcReadOnly: #{resource[:readonly] == :true ? 'TRUE' : 'FALSE'}\n-\n" if @property_flush[:readonly]
+      t << "replace: olcReadOnly\nolcReadOnly: #{resource[:readonly] == 'TRUE' ? 'TRUE' : 'FALSE'}\n-\n" if @property_flush[:readonly]
       t << "replace: olcSizeLimit\nolcSizeLimit: #{resource[:sizelimit]}\n-\n" if @property_flush[:sizelimit]
       t << "replace: olcTimeLimit\nolcTimeLimit: #{resource[:timelimit]}\n-\n" if @property_flush[:timelimit]
       t << "replace: olcDbMaxSize\nolcDbMaxSize: #{resource[:dbmaxsize]}\n-\n" if @property_flush[:dbmaxsize]

I'm thinking the property probably needs to be defined as a boolean, similar to mirrormode has been done.

tdb avatar Sep 01 '17 16:09 tdb

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 19 '21 17:04 stale[bot]

PLEASE KILL THESE FSCKING ROBOTS!

smortex avatar May 23 '24 00:05 smortex