Add new status "maintenance" (#791)

See https://www.githubstatus.com/incidents/ry5psbndh11j
This commit is contained in:
Erik Johnson 2020-10-01 16:33:36 -05:00 committed by GitHub
parent 51acc6d342
commit 102a87c864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,14 +222,9 @@ class Github(IntervalModule):
) )
# Defaults for module configurables # Defaults for module configurables
_default_status = {
'none': 'GitHub',
'minor': 'GitHub',
'major': 'GitHub',
'critical': 'GitHub',
}
_default_colors = { _default_colors = {
'none': '#28a745', 'none': '#28a745',
'maintenance': '#4f8cc9',
'minor': '#dbab09', 'minor': '#dbab09',
'major': '#e36209', 'major': '#e36209',
'critical': '#dc3545', 'critical': '#dc3545',
@ -237,7 +232,7 @@ class Github(IntervalModule):
# Module configurables # Module configurables
format = '{status}[ {unread}][ {update_error}]' format = '{status}[ {unread}][ {update_error}]'
status = _default_status status = {}
colors = _default_colors colors = _default_colors
refresh_icon = '' refresh_icon = ''
update_error = '!' update_error = '!'
@ -291,17 +286,11 @@ class Github(IntervalModule):
user_open(self.notifications_url) user_open(self.notifications_url)
def init(self): def init(self):
if self.status != self._default_status:
new_status = copy.copy(self._default_status)
new_status.update(self.status)
self.status = new_status
if self.colors != self._default_colors: if self.colors != self._default_colors:
new_colors = copy.copy(self._default_colors) new_colors = copy.copy(self._default_colors)
new_colors.update(self.colors) new_colors.update(self.colors)
self.colors = new_colors self.colors = new_colors
self.logger.debug('status = %s', self.status)
self.logger.debug('colors = %s', self.colors) self.logger.debug('colors = %s', self.colors)
self.condition = threading.Condition() self.condition = threading.Condition()
@ -475,7 +464,8 @@ class Github(IntervalModule):
self.failed_update = True self.failed_update = True
return return
self.data['status'] = self.status.get(self.current_status) self.logger.debug('Current GitHub Status: %s', self.current_status)
self.data['status'] = self.status.get(self.current_status, 'GitHub')
if self.current_incidents != self.previous_incidents: if self.current_incidents != self.previous_incidents:
self.show_status_notification() self.show_status_notification()
self.__previous_json = self.__current_json self.__previous_json = self.__current_json