• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #4077

pending completion
#4077

push

coveralls-python

suhaibmujahid
Merge remote-tracking branch 'upstream/master' into wiki-missed

549 of 3109 branches covered (17.66%)

615 of 615 new or added lines in 27 files covered. (100.0%)

1773 of 8016 relevant lines covered (22.12%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/auto_nag/scripts/vacant_team_manager.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5

6
from typing import List
×
7

8
from libmozdata.bugzilla import BugzillaProduct
×
9

10
from auto_nag.bzcleaner import BzCleaner
×
11
from auto_nag.team_managers import TeamManagers
×
12

13

14
class TeamManagerVacant(BzCleaner):
×
15
    def __init__(self) -> None:
×
16
        super(TeamManagerVacant, self).__init__()
×
17
        self.query_url = None
×
18

19
    def description(self) -> str:
×
20
        return "Teams with managers that need to be assigned"
×
21

22
    def fetch_teams(self) -> List[dict]:
×
23
        data = []
×
24
        include_fields = [
×
25
            "is_active",
26
            "components.team_name",
27
            "components.is_active",
28
        ]
29

30
        def product_handler(product: dict):
×
31
            data.append(product)
×
32

33
        BugzillaProduct(
×
34
            product_names=self.get_products(),
35
            include_fields=include_fields,
36
            product_handler=product_handler,
37
        ).wait()
38

39
        return data
×
40

41
    def identify_vacant_teams(self) -> List[dict]:
×
42
        # We need team names for active components only.
43
        teams = {
×
44
            component["team_name"]
45
            for product in self.fetch_teams()
46
            if product["is_active"]
47
            for component in product["components"]
48
            if component["is_active"]
49
        }
50
        # Remove catch-all teams
51
        teams -= {"Mozilla", "Other"}
×
52
        # Add "fallback" so we make sure the "fallback" is active.
53
        teams.add("fallback")
×
54

55
        team_managers = TeamManagers()
×
56
        vacant_teams = []
×
57
        for team in teams:
×
58
            manager = team_managers.get_team_manager(team, fallback=False)
×
59

60
            if manager is not None and manager["mozilla_email"] is not None:
×
61
                continue
×
62

63
            if manager is not None:
×
64
                name = manager["name"]
×
65
            else:
66
                name = "Nobody"
×
67

68
            info = {
×
69
                "manager": name,
70
                "team": team,
71
                "status": "No longer in people" if manager is not None else "Undefined",
72
            }
73

74
            vacant_teams.append(info)
×
75

76
        return vacant_teams
×
77

78
    def get_email_data(self, date: str) -> List[dict]:
×
79
        return self.identify_vacant_teams()
×
80

81

82
if __name__ == "__main__":
×
83
    TeamManagerVacant().run()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc