File tree Expand file tree Collapse file tree 5 files changed +132
-20
lines changed Expand file tree Collapse file tree 5 files changed +132
-20
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ pydantic = "^1.9.0"
12
12
uvicorn = {extras = [" standard" ], version = " ^0.17.4" }
13
13
gunicorn = " ^20.1.0"
14
14
prometheus-client = " ^0.13.1"
15
+ python-bugzilla = " ^3.2.0"
16
+ atlassian-python-api = " ^3.20.1"
15
17
16
18
[tool .poetry .dev-dependencies ]
17
19
pre-commit = " ^2.17.0"
Original file line number Diff line number Diff line change 6
6
7
7
8
8
class Settings (BaseSettings ):
9
- jbi_action_key : str = "jbi"
10
- jbi_folder_path : str = "src/jbi/whiteboard_tags/"
11
9
port : str = "80"
12
10
app_reload : bool = True
13
11
12
+ # JBI env vars
13
+ jbi_action_key : str = "jbi"
14
+ jbi_folder_path : str = "src/jbi/whiteboard_tags/"
15
+ jira_base_url : str = "https://jira.allizom.org/"
16
+ bugzilla_base_url : str = "https://bugzilla-dev.allizom.org/"
17
+
18
+ # Secrets below
19
+ jira_username : str
20
+ jira_password : str
21
+ bugzilla_api_key : str
22
+
14
23
15
24
@lru_cache ()
16
25
def get_settings () -> Settings :
Original file line number Diff line number Diff line change 12
12
def heartbeat (request : Request , settings : environment .Settings ):
13
13
"""Return status of backing services, as required by Dockerflow."""
14
14
data : Dict = {}
15
- data .update (jbi_service_health_map (settings ))
15
+ data .update (jbi_service_health_map ())
16
16
status_code = 200
17
17
for _ , health in data .items ():
18
18
if not health .get ("up" ):
Original file line number Diff line number Diff line change 1
- # import bugzilla
2
- # import jira
1
+ import bugzilla as rh_bugzilla # type: ignore
2
+ from atlassian import Jira # type: ignore
3
3
4
+ from src .app import environment
4
5
5
- def get_service (param = None ):
6
- return param
6
+ settings = environment .get_settings ()
7
7
8
+ jira = Jira (
9
+ url = settings .jira_base_url ,
10
+ username = settings .jira_username ,
11
+ password = settings .jira_password ,
12
+ )
8
13
9
- def bugzilla_check_health (settings ):
10
- health = {"up" : False }
14
+ bugzilla = rh_bugzilla .Bugzilla (
15
+ settings .bugzilla_base_url , api_key = settings .bugzilla_api_key
16
+ )
17
+
18
+
19
+ def bugzilla_check_health ():
20
+ health = {"up" : bugzilla .logged_in }
11
21
return health
12
22
13
23
14
- def jira_check_health (settings ):
24
+ def jira_check_health ():
25
+ server_info = jira .get_server_info (True )
26
+ print (server_info )
15
27
health = {"up" : False }
16
28
return health
17
29
18
30
19
- def jbi_service_health_map (settings ):
31
+ def jbi_service_health_map ():
20
32
return {
21
- "bugzilla" : bugzilla_check_health (settings ),
22
- "jira" : jira_check_health (settings ),
33
+ "bugzilla" : bugzilla_check_health (),
34
+ "jira" : jira_check_health (),
23
35
}
You can’t perform that action at this time.
0 commit comments