#50915 Ticket 50914 - No error returned when adding an entry matching filters for a non existing automember group
Closed 3 years ago by spichugi. Opened 4 years ago by tbordaz.
tbordaz/389-ds-base ticket-50914  into  master

@@ -140,6 +140,7 @@ 

      assert group.is_member(user.dn)

      user.delete()

  

+ 

  @pytest.mark.skipif(ds_is_older("1.4.1.2"), reason="Not implemented")

  def test_delete_default_group(automember_fixture, topo):

      """If memberof is enable and a user became member of default group
@@ -179,6 +180,51 @@ 

          user_1.delete()

          topo.standalone.setLogLevel(0)

  

+ @pytest.mark.skipif(ds_is_older("1.4.3.3"), reason="Not implemented")

+ def test_no_default_group(automember_fixture, topo):

+     """If memberof is enable and a user became member of default group

+     and default group does not exist then an INFO should be logged

+ 

+     :id: 8882972f-fb3e-4d77-9729-0235897676bc

+     :setup: Standalone instance, enabled Auto Membership Plugin

+     :steps:

+         1. Enable memberof plugin

+         2. Set errorlog level to 0 (default)

+         3. delete the default group

+         4. Create a user

+         5. Retrieve message in log

+     :expectedresults:

+         1. Should be success

+         2. Should be success

+         3. Should be success

+         4. Should be success

+         5. Should be success

+     """

+ 

+     (group, automembers, automember) = automember_fixture

+ 

+     from lib389.plugins import MemberOfPlugin

+     memberof = MemberOfPlugin(topo.standalone)

+     memberof.enable()

+     topo.standalone.restart()

+     topo.standalone.setLogLevel(0)

+ 

+     # delete it if it exists

+     try:

+         group.get_attr_val_utf8('creatorsname')

+         group.delete()

+     except ldap.NO_SUCH_OBJECT:

+         pass

+     users = UserAccounts(topo.standalone, DEFAULT_SUFFIX)

+     user_1 = users.create_test_user(uid=1)

+ 

+     try:

+         error_lines = topo.standalone.ds_error_log.match('.*auto-membership-plugin - automember_update_member_value - group .default or target. does not exist .%s.$' % group.dn)

+         assert (len(error_lines) > 0)

+     finally:

+         user_1.delete()

+         topo.standalone.setLogLevel(0)

+ 

  @pytest.mark.skipif(ds_is_older("1.4.1.2"), reason="Not implemented")

  def test_delete_target_group(automember_fixture, topo):

      """If memberof is enabld and a user became member of target group

@@ -1638,7 +1638,7 @@ 

      if (rc != LDAP_SUCCESS || group_entry == NULL) {

          if (rc == LDAP_NO_SUCH_OBJECT) {

              /* the automember group (default or target) does not exist, just skip this definition */

-             slapi_log_err(SLAPI_LOG_PLUGIN, AUTOMEMBER_PLUGIN_SUBSYSTEM,

+             slapi_log_err(SLAPI_LOG_INFO, AUTOMEMBER_PLUGIN_SUBSYSTEM,

                        "automember_update_member_value - group (default or target) does not exist (%s)\n",

                        group_dn);

              rc = 0;

Bug Description:
automember plugin adds matching members to a target group. If the target group
does not exist a message is logged but with SLAPI_LOG_PLUGIN level.

Fix Description:
Such situation (target group missing/deleted) is rare. It worths logging
the message, that automember did not add a member, at SLAPI_LOG_INFO

https://pagure.io/389-ds-base/issue/50914

Reviewed by: ?

Platforms tested: F30

Flag Day: no

Doc impact: no

rebased onto c809642

4 years ago

Pull-Request has been merged by tbordaz

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3968

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago