#25 When syncing accounts from FAS to bugzilla, ignore all @redhat.com accounts
Closed 5 years ago by pingou. Opened 5 years ago by pingou.

@@ -1,4 +1,5 @@ 

- from unittest.mock import Mock, patch

+ import logging

+ from unittest.mock import call, Mock, patch

  

  import pytest

  
@@ -61,10 +62,12 @@ 

          get_bz_email,

          get_fas_grp_mbr,

          toddler,

+         caplog,

      ):

+         caplog.set_level(logging.DEBUG)

          toml_load.return_value = {}

-         get_fas_grp_mbr.return_value = ["pingou", "nils"]

-         get_bz_email.side_effect = ["pingou@fp.o", "nils@fp.o"]

+         get_fas_grp_mbr.return_value = ["pingou", "nils", "ralph"]

+         get_bz_email.side_effect = ["pingou@fp.o", "nils@fp.o", "ralph@redhat.com"]

          get_bz_grp_mbr.return_value = ["pingou@fp.o", "nphilipp@fp.o"]

  

          toddler.process(
@@ -76,7 +79,9 @@ 

  

          toml_load.assert_called_with("test")

          get_fas_grp_mbr.assert_called_with("packager")

-         get_bz_email.assert_called_with("pingou", {})

+         get_bz_email.assert_has_calls(

+             calls=[call("nils", {}), call("pingou", {}), call("ralph", {})]

+         )

          get_bz_grp_mbr.assert_called_with("fedora_contrib")

          bz_user_grp.assert_called_with(

              user_email="nils@fp.o",
@@ -85,6 +90,8 @@ 

              dry_run=False,

          )

  

+         assert "  ignoring ralph@redhat.com, as all @redhat.com accounts" in caplog.text

+ 

      @patch("toddlers.utils.fedora_account.set_fas", new=Mock(return_value=True))

      @patch("toddlers.utils.bugzilla_system.set_bz", new=Mock(return_value=True))

      @patch("toddlers.utils.fedora_account.get_bz_email_user")

@@ -113,6 +113,10 @@ 

          # Add the packagers found only in FAS to the bugzilla group

          _log.info(f"Adding to {config['bugzilla_group']} the packagers found in FAS")

          for user_email in sorted(fas_only):

+             if user_email.endswith("@redhat.com"):

+                 _log.debug("  ignoring %s, as all @redhat.com accounts", user_email)

+                 continue

+ 

              no_bz_account = bugzilla_system.add_user_to_group(

                  user_email=user_email,

                  bz_group=config["bugzilla_group"],

Accounts with an @redhat.com email address are special accounts in
Red Hat's bugzilla and handled directly by Red Hat IT.
So in our side, we should not do anything with them.

The issue is that when an associate leaves Red Hat, their bugzilla account
is deactivated. It should not belong to any group, not appear anywhere.
If we automatically add them back to a group, this causes problems on the
bugzilla side.

This commit makes it so, all @redhat.com accounts will be ignored.

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

This is ready to be reviewed but not merged yet. I'm waiting for a confirmation that this is indeed what we should do.

Build succeeded.

  • tox : SUCCESS in 4m 24s

So turns out that this is not what we want.

@redhat.com accounts are to be considered just like anyone else in the community, they have no special treatment with regards to the Fedora groups in bugzilla. Which is cool :)

Pull-Request has been closed by pingou

5 years ago