{"action":"created","issue":{"url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/93","labels_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/93/comments","events_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/93/events","html_url":"https://github.com/camptocamp/puppet-openldap/pull/93","id":112388853,"number":93,"title":"Refactor openldap::server::access","user":{"login":"kronos-pbrideau","id":1564589,"avatar_url":"https://avatars.githubusercontent.com/u/1564589?v=3","gravatar_id":"","url":"https://api.github.com/users/kronos-pbrideau","html_url":"https://github.com/kronos-pbrideau","followers_url":"https://api.github.com/users/kronos-pbrideau/followers","following_url":"https://api.github.com/users/kronos-pbrideau/following{/other_user}","gists_url":"https://api.github.com/users/kronos-pbrideau/gists{/gist_id}","starred_url":"https://api.github.com/users/kronos-pbrideau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronos-pbrideau/subscriptions","organizations_url":"https://api.github.com/users/kronos-pbrideau/orgs","repos_url":"https://api.github.com/users/kronos-pbrideau/repos","events_url":"https://api.github.com/users/kronos-pbrideau/events{/privacy}","received_events_url":"https://api.github.com/users/kronos-pbrideau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-20T15:03:37Z","updated_at":"2015-10-22T17:01:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/camptocamp/puppet-openldap/pulls/93","html_url":"https://github.com/camptocamp/puppet-openldap/pull/93","diff_url":"https://github.com/camptocamp/puppet-openldap/pull/93.diff","patch_url":"https://github.com/camptocamp/puppet-openldap/pull/93.patch"},"body":"For #54 , here is what I have done with it.\r\n\r\nYou still can use the old syntax, but you now can do:\r\n\r\n```\r\nopenldap::server::access {\r\n  'acl 1' :\r\n    suffix   => 'dc=example,dc=com',\r\n    position => '1',\r\n    what     => 'attrs=userPassword,shadowLastChange',\r\n    by       => 'dn=\"cn=admin,dc=example,dc=com\"',\r\n    access   => 'write',\r\n}\r\n```\r\n\r\nAnd i've create a wrapper to use like so:\r\n```\r\n$acl_hash = {\r\n  'acl 1' => {\r\n    suffix   => 'dc=example,dc=com',\r\n    position => '1',\r\n    what     => 'attrs=userPassword,shadowLastChange',\r\n    by       => 'dn=\"cn=admin,dc=example,dc=com\"',\r\n    access   => 'write',\r\n  },\r\n}\r\n\r\n$acl_hash_keys = keys($acl_hash)\r\nopenldap::server::access_wrapper { $acl_hash_keys :\r\n  hash => $acl_hash,\r\n}\r\n```\r\n\r\nI've describe it into the README"},"comment":{"url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/comments/150291590","html_url":"https://github.com/camptocamp/puppet-openldap/pull/93#issuecomment-150291590","issue_url":"https://api.github.com/repos/camptocamp/puppet-openldap/issues/93","id":150291590,"user":{"login":"kronos-pbrideau","id":1564589,"avatar_url":"https://avatars.githubusercontent.com/u/1564589?v=3","gravatar_id":"","url":"https://api.github.com/users/kronos-pbrideau","html_url":"https://github.com/kronos-pbrideau","followers_url":"https://api.github.com/users/kronos-pbrideau/followers","following_url":"https://api.github.com/users/kronos-pbrideau/following{/other_user}","gists_url":"https://api.github.com/users/kronos-pbrideau/gists{/gist_id}","starred_url":"https://api.github.com/users/kronos-pbrideau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronos-pbrideau/subscriptions","organizations_url":"https://api.github.com/users/kronos-pbrideau/orgs","repos_url":"https://api.github.com/users/kronos-pbrideau/repos","events_url":"https://api.github.com/users/kronos-pbrideau/events{/privacy}","received_events_url":"https://api.github.com/users/kronos-pbrideau/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T17:01:43Z","updated_at":"2015-10-22T17:01:43Z","body":"@mcnavet: I tested it again the following syntax:\r\n```\r\nopenldap::server::access { 'acl 1' :\r\n  suffix   => 'dc=example,dc=com',\r\n  position => '1',\r\n  what     => 'attrs=userPassword,shadowLastChange',\r\n  by       => 'dn=\"cn=admin,dc=example,dc=com\"',\r\n  access   => 'write',\r\n}\r\n```\r\nOn both my and upstream module, it will work on the first run, but not on subsequent one.\r\n\r\nthe error is\r\n```\r\nldap_modify: Type or value exists (20)\r\n\tadditional info: modify/add: olcAccess: value #0 already exists\r\n```\r\n\r\nThe resource definition is using the name to identify if the resource exists.  As nothing with the name \"acl 1\" is returned by the `puppet resource openldap_access\", the module try to create it again.\r\n\r\nI will change the README accordingly.  Thanks for making me test it further!\r\n\r\nAlso about the generals ACL, i've tested it, and the module does not work if you don't provide a `suffix`.  Therefore, why forcing `suffix => 'cn=config'` when none is set a bad thing?\r\n"}}