try: commits = hookserver_message.payload[ 'commits' ] commit_author = commits[0]['author']['name'] commit_message = commits[0]['message'] except Exception, e: logging.info( e ) message_out = housekeeping.update_message_for_name( commit_author, commit_message ) bot_thread.stop( message_out ) bot_thread = None # drop to outer loop; restart bot_thread run_inner = False # update from git repo subprocess.call( [ "git", "pull" ] ) # reload skypebot module skypebot = reload( skypebot ) else: logging.info( "...doing nothing (GIT_BRANCH is %s)" % GIT_BRANCH ) time.sleep( 1 ) except KeyboardInterrupt: logging.info( "KeyboardInterrupt!" ) # shut down threads cleanly if bot_thread.is_running: logging.info( "Shutdown bot thread..." ) bot_thread.stop() logging.info( "Shutdown hook server..." ) hook_server.stop() logging.shutdown()
if hookserver_message is not None: # recieved a push notification from github if hookserver_message.code == HookServerMessage.RECIEVED_PUSH: logging.info("Recieved push notification...") # construct quit messge for bot commits = hookserver_message.payload['commits'] commit_author = commits[0]['author']['name'] message_out = housekeeping.update_message_for_name( commit_author) bot_thread.stop(message_out) bot_thread = None # drop to outer loop; restart bot_thread run_inner = False # update from git repo subprocess.call(["git", "pull"]) # reload skypebot module skypebot = reload(skypebot) time.sleep(1) except KeyboardInterrupt: logging.info("KeyboardInterrupt!") # shut down threads cleanly if bot_thread.is_running: logging.info("Shutdown bot thread...") bot_thread.stop() logging.info("Shutdown hook server...") hook_server.stop() logging.shutdown()