{"action":"closed","issue":{"url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/102","labels_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/102/comments","events_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/102/events","html_url":"https://github.com/camptocamp/puppet-openldap/issues/102","id":116056605,"number":102,"title":"openldap::server::dbindex doesn't work properly","user":{"login":"cjeanneret","id":82490,"avatar_url":"https://avatars.githubusercontent.com/u/82490?v=3","gravatar_id":"","url":"https://api.github.com/users/cjeanneret","html_url":"https://github.com/cjeanneret","followers_url":"https://api.github.com/users/cjeanneret/followers","following_url":"https://api.github.com/users/cjeanneret/following{/other_user}","gists_url":"https://api.github.com/users/cjeanneret/gists{/gist_id}","starred_url":"https://api.github.com/users/cjeanneret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjeanneret/subscriptions","organizations_url":"https://api.github.com/users/cjeanneret/orgs","repos_url":"https://api.github.com/users/cjeanneret/repos","events_url":"https://api.github.com/users/cjeanneret/events{/privacy}","received_events_url":"https://api.github.com/users/cjeanneret/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/camptocamp/puppet-openldap/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-10T07:59:03Z","updated_at":"2015-11-18T10:32:47Z","closed_at":"2015-11-18T10:32:45Z","body":"It seems the type doesn't work properly: while trying to add multiple indices on a running openldap, puppet crashes:\r\n```Puppet\r\nError message: Execution of '/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/openldap_dbindex20151110-28704-5ufp39' returned 20: SASL/EXTERNAL authentication started\r\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\r\nSASL SSF: 0\r\nldap_modify: Type or value exists (20)\r\n        additional info: modify/add: olcDbIndex: value #0 already exists\r\nmodifying entry \"olcDatabase={1}mdb,cn=config\"\r\nError: /Stage[main]/Foo::Ldap/Openldap::Server::Dbindex[uidNumber]/Openldap_dbindex[uidNumber]/ensure: change from absent to present failed: LDIF content:\r\ndn: olcDatabase={1}mdb,cn=config\r\nadd: olcDbIndex\r\nolcDbIndex: uidNumber eq\r\n\r\nError message: Execution of '/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/openldap_dbindex20151110-28704-5ufp39' returned 20: SASL/EXTERNAL authentication started\r\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\r\nSASL SSF: 0\r\nldap_modify: Type or value exists (20)\r\n        additional info: modify/add: olcDbIndex: value #0 already exists\r\nmodifying entry \"olcDatabase={1}mdb,cn=config\"\r\nError: LDIF content:\r\ndn: olcDatabase={1}mdb,cn=config\r\nadd: olcDbIndex\r\nolcDbIndex: cn pres,sub,eq\r\n\r\nError message: Execution of '/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/openldap_dbindex20151110-28704-157phwt' returned 20: SASL/EXTERNAL authentication started\r\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\r\nSASL SSF: 0\r\nldap_modify: Type or value exists (20)\r\n        additional info: modify/add: olcDbIndex: value #0 already exists\r\nmodifying entry \"olcDatabase={1}mdb,cn=config\"\r\nError: /Stage[main]/Foo::Ldap/Openldap::Server::Dbindex[cn]/Openldap_dbindex[cn]/ensure: change from absent to present failed: LDIF content:\r\ndn: olcDatabase={1}mdb,cn=config\r\nadd: olcDbIndex\r\nolcDbIndex: cn pres,sub,eq\r\n\r\nError message: Execution of '/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/openldap_dbindex20151110-28704-157phwt' returned 20: SASL/EXTERNAL authentication started\r\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\r\nSASL SSF: 0\r\nldap_modify: Type or value exists (20)\r\n        additional info: modify/add: olcDbIndex: value #0 already exists\r\nmodifying entry \"olcDatabase={1}mdb,cn=config\"\r\nError: LDIF content:\r\ndn: olcDatabase={1}mdb,cn=config\r\nadd: olcDbIndex\r\nolcDbIndex: uid pres,sub,eq\r\n\r\nError message: Execution of '/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/openldap_dbindex20151110-28704-1yo0yvs' returned 20: SASL/EXTERNAL authentication started\r\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\r\nSASL SSF: 0\r\nldap_modify: Type or value exists (20)\r\n        additional info: modify/add: olcDbIndex: value #0 already exists\r\nmodifying entry \"olcDatabase={1}mdb,cn=config\"\r\nError: /Stage[main]/Foo::Ldap/Openldap::Server::Dbindex[uid]/Openldap_dbindex[uid]/ensure: change from absent to present failed: LDIF content:\r\ndn: olcDatabase={1}mdb,cn=config\r\nadd: olcDbIndex\r\nolcDbIndex: uid pres,sub,eq\r\n\r\nError message: Execution of '/usr/bin/ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/openldap_dbindex20151110-28704-1yo0yvs' returned 20: SASL/EXTERNAL authentication started\r\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\r\nSASL SSF: 0\r\nldap_modify: Type or value exists (20)\r\n        additional info: modify/add: olcDbIndex: value #0 already exists\r\nmodifying entry \"olcDatabase={1}mdb,cn=config\"\r\n```\r\n\r\nIt seems the first index was added (this is a fourth run after many tests), but the following weren't.\r\n\r\nAfter poking around in the doc and examples we can find, it seems the next indices creation ldif should embed the following directive:\r\n```ldif\r\nchangetype: modify\r\n```\r\n\r\nThis will prevent openldap to believe it has to create another index thing, and just update the existing one in order to add the new index itself.\r\n\r\nThe generated ldif should hence be something like:\r\n```ldif\r\ndn: olcDatabase={1}hdb,cn=config\r\nchangetype: modify\r\nadd: olcDbIndex\r\nolcDbIndex: cn pres,sub,eq\r\n```\r\n\r\nWould be marvelous to get this working :smile_cat: "}}