3737from tools .args import event_handler_parse
3838from tools .commands import EESSIBotCommand , EESSIBotCommandError , \
3939 contains_any_bot_command , get_bot_command
40+ from tools .event_info import create_event_info_instance
41+ from tools .git import connect_to_git_hosting_platform , get_git_hosting_platform
4042from tools .permissions import check_command_permission
4143from tools .pr_comments import ChatLevels , create_comment
4244
9597 config .DOWNLOAD_PR_COMMENTS_SETTING_PR_DIFF_TIP ], # required
9698 config .SECTION_EVENT_HANDLER : [
9799 config .EVENT_HANDLER_SETTING_LOG_PATH ], # required
100+ config .SECTION_GIT : [
101+ config .GIT_SETTING_HOSTING_PLATFORM ], # required
98102 config .SECTION_GITHUB : [
99- config .GITHUB_SETTING_API_TIMEOUT , # required
100- config .GITHUB_SETTING_APP_ID , # required
101- config .GITHUB_SETTING_APP_NAME , # required
102- config .GITHUB_SETTING_INSTALLATION_ID , # required
103- config .GITHUB_SETTING_PRIVATE_KEY ], # required
103+ config .GITHUB_SETTING_API_TIMEOUT , # required for github
104+ config .GITHUB_SETTING_APP_ID , # required for github
105+ config .GITHUB_SETTING_APP_NAME , # required for github
106+ config .GITHUB_SETTING_INSTALLATION_ID , # required for github
107+ config .GITHUB_SETTING_PRIVATE_KEY ], # required for github
108+ config .SECTION_GITLAB : [
109+ config .GITLAB_SETTING_API_TIMEOUT , # required for gitlab
110+ config .GITLAB_SETTING_BOT_NAME , # required for gitlab
111+ config .GITLAB_SETTING_INSTANCE_URL ], # required for gitlab
104112 # the poll interval setting is required for the alternative job handover
105113 # protocol (delayed_begin)
106114 config .SECTION_JOB_MANAGER : [
@@ -133,7 +141,8 @@ def __init__(self, *args, **kwargs):
133141 EESSIBotSoftwareLayer constructor. Calls constructor of PyGHee and
134142 initializes some configuration settings.
135143 """
136- super (EESSIBotSoftwareLayer , self ).__init__ (* args , ** kwargs )
144+ event_source = get_git_hosting_platform ()
145+ super (EESSIBotSoftwareLayer , self ).__init__ (event_source , * args , ** kwargs )
137146
138147 self .cfg = config .read_config ()
139148 event_handler_cfg = self .cfg [config .SECTION_EVENT_HANDLER ]
@@ -157,6 +166,22 @@ def log(self, msg, *args):
157166 msg = "[%s]: %s" % (funcname , msg )
158167 log (msg , log_file = self .logfile )
159168
169+ def handle_event (self , event_info , log_file = None ):
170+ """
171+ Override of PyGHee's handle_event method.
172+ Create EventInfo instance using event_info,
173+ then pass that to PyGHee's handle_event method.
174+
175+ Args:
176+ event_info (dict): event received by event_handler
177+ log_file (string): path to log messages to
178+
179+ Returns:
180+ None (implicit)
181+ """
182+ event_info_object = create_event_info_instance (event_info )
183+ super ().handle_event (event_info_object , log_file )
184+
160185 def handle_issue_comment_event (self , event_info , log_file = None ):
161186 """
162187 Handle events of type issue_comment. Main action is to parse new issue
@@ -833,7 +858,9 @@ def main():
833858 else :
834859 print ("Configuration check: FAILED" )
835860 sys .exit (1 )
836- github .connect ()
861+
862+ # Verify that the event handler is able to connect to the Git hosting platform
863+ connect_to_git_hosting_platform ()
837864
838865 if opts .file :
839866 app = create_app (klass = EESSIBotSoftwareLayer )
0 commit comments