def __init__(self, fromaddr, mode="all", categories=None, builders=None, addLogs=False, relayhost="localhost", subject="buildbot %(result)s in %(builder)s", lookup=None, extraRecipients=[], sendToInterestedUsers=True, body="", replytoaddr=""): """ @type body: string @param body: a string to be used as the body of the message. @type replytoaddr: string @param replytoaddr: the email address to be used in the 'Reply-To' header. """ self.body = body self.replytoaddr = replytoaddr # pass the rest of the parameters to our parent. MailNotifier.__init__(self, fromaddr, mode, categories, builders, addLogs, relayhost, subject, lookup, extraRecipients, sendToInterestedUsers)
def __init__(self, watch_mode, interesting_steps, boring_steps=None, **kwargs): """ @type watch_mode: either BUILDERS or CATEGORIES @param watch_mode: A singleton object denoting whether this class is watching steps keyed by builder name or by category. @type interesting_steps: mapping of strings to lists of strings. @param interesting_steps: Keys are either builder names or categories; values are lists of steps which we care about. The key '*' (wildcard) means 'all builders'. The value ['*'] (wildcard) means 'all steps'. All keys (other than wildcard) must be present in either |builders| or |categories| (in kwargs). Required since otherwise this class has no point. @type boring_steps: mapping of strings to lists of strings. @param boring_steps: Keys are either builder names or categories; values are lists of steps which we do not care about. The key '*' (wildcard) means 'all builders'. The value ['*'] (wildcard) means 'all steps'. All keys (other than wildcard) must be present in either |builders| or |categories| (in kwargs). Boring steps override interesting steps. """ self.watch_mode = watch_mode self.interesting_steps = interesting_steps self.boring_steps = boring_steps or {} # Pass through the keys in interesting/boring steps to the appropriate list # in the parent class. if any((arg in ('builders', 'categores') for arg in kwargs)): raise interfaces.ParameterError( 'Please do not specify |builders| or |categories| in StepNotifier.' ) keys = set(self.interesting_steps) | set(self.boring_steps) keys.discard('*') if self.watch_mode is BUILDERS: kwargs['builders'] = list(keys) elif self.watch_mode is CATEGORIES: kwargs['categories'] = list(keys) else: raise interfaces.ParameterError( 'Please specify either BUILDERS or CATEGORIES for |watch_mode|.' ) self.log('Interesting steps: %s' % self.interesting_steps) self.log('Boring steps: %s' % self.boring_steps) self.log('Instantiating MailNotifier with: %s' % kwargs) # Don't use super because MailNotifier is an old-style class. MailNotifier.__init__(self, **kwargs)
def __init__(self, projectURL="http://localhost/", reply_to=None, mode="failing", html_body=False, **kwargs): extraHeaders = {} if reply_to: extraHeaders['Reply-To'] = reply_to MailNotifier.__init__(self, mode=mode, extraHeaders=extraHeaders, **kwargs) # messageFormatter=defaultMessage self.projectName = 'OpenERP' self.projectURL=projectURL self.html_body = html_body
def __init__(self, watch_mode, interesting_steps, boring_steps=None, **kwargs): """ @type watch_mode: either BUILDERS or CATEGORIES @param watch_mode: A singleton object denoting whether this class is watching steps keyed by builder name or by category. @type interesting_steps: mapping of strings to lists of strings. @param interesting_steps: Keys are either builder names or categories; values are lists of steps which we care about. The key '*' (wildcard) means 'all builders'. The value ['*'] (wildcard) means 'all steps'. All keys (other than wildcard) must be present in either |builders| or |categories| (in kwargs). Required since otherwise this class has no point. @type boring_steps: mapping of strings to lists of strings. @param boring_steps: Keys are either builder names or categories; values are lists of steps which we do not care about. The key '*' (wildcard) means 'all builders'. The value ['*'] (wildcard) means 'all steps'. All keys (other than wildcard) must be present in either |builders| or |categories| (in kwargs). Boring steps override interesting steps. """ self.watch_mode = watch_mode self.interesting_steps = interesting_steps self.boring_steps = boring_steps or {} # Pass through the keys in interesting/boring steps to the appropriate list # in the parent class. if any((arg in ('builders', 'categores') for arg in kwargs)): raise interfaces.ParameterError( 'Please do not specify |builders| or |categories| in StepNotifier.') keys = set(self.interesting_steps) | set(self.boring_steps) keys.discard('*') if self.watch_mode is BUILDERS: kwargs['builders'] = list(keys) elif self.watch_mode is CATEGORIES: kwargs['categories'] = list(keys) else: raise interfaces.ParameterError( 'Please specify either BUILDERS or CATEGORIES for |watch_mode|.') self.log('Interesting steps: %s' % self.interesting_steps) self.log('Boring steps: %s' % self.boring_steps) self.log('Instantiating MailNotifier with: %s' % kwargs) # Don't use super because MailNotifier is an old-style class. MailNotifier.__init__(self, **kwargs)
def __init__( self, fromaddr, mode="all", categories=None, builders=None, addLogs=False, relayhost="localhost", subject="", lookup=None, extraRecipients=[], sendToInterestedUsers=True, schedulerGroups=[], schedulerGroupsSendFirst=1, ): """ @type schedulerGroupsSendFirst: int @param schedulerGroupsSendFirst: How many mails to send to interested users before we group the rest of the emails. @type schedulerGroups: list (can be list of lists) @param schedulerGroups: list of schedulers to group emails by. Multiple schedulers can be grouped together by passing them in as a list. This may be a list of lists, but can not be nested beyond that. """ self.schedulerGroupsSendFirst = schedulerGroupsSendFirst # builderGroups is a list BuilderGroups self.builderGroups = [] for schedulerGroup in schedulerGroups: group = BuilderGroup() if isinstance(schedulerGroup, list): for scheduler in schedulerGroup: group.addBuilderNames(scheduler.listBuilderNames()) else: group.addBuilderNames(schedulerGroup.listBuilderNames()) self.builderGroups.append(group) MailNotifier.__init__( self, fromaddr, mode, categories, builders, addLogs, relayhost, subject, lookup, extraRecipients, sendToInterestedUsers, )
def __init__(self, projectURL="http://localhost/", reply_to=None, mode="failing", html_body=False, **kwargs): extraHeaders = {} if reply_to: extraHeaders['Reply-To'] = reply_to MailNotifier.__init__(self, mode=mode, extraHeaders=extraHeaders, **kwargs) # messageFormatter=defaultMessage self.projectName = 'OpenERP' self.projectURL = projectURL self.html_body = html_body
def __init__(self, username=None, password=None, port=2525, fromaddr=None, mode="failing", categories=None, builders=None, addLogs=False, relayhost="localhost", subject="%(projectName)s %(builder)s %(result)s", lookup=None, extraRecipients=[], sendToInterestedUsers=True, reply_to=None, html_body=False, TLS=True, mail_watcher=[]): MailNotifier.__init__(self, fromaddr, mode, categories, builders, addLogs, relayhost, subject, lookup, extraRecipients, sendToInterestedUsers) self.reply_to = reply_to self._username = username self._password = password self._port = port self._body = '' self.html_body = html_body self.TLS = TLS self.mail_watcher = mail_watcher self.projectName = ''
def __init__(self, fromaddr, mode=("failing"), categories=None, branches=[], yoctorepos=[], builders=None, addLogs=False, relayhost="localhost", buildSetSummary=False, subject="buildbot %(result)s in %(title)s on %(builder)s", lookup=None, extraRecipients=[], sendToInterestedUsers=True, customMesg=None, messageFormatter=defaultMessage, extraHeaders=None, addPatch=True, useTls=False, smtpUser=None, smtpPassword=None, smtpPort=25): self.fromaddr = fromaddr self.mode=mode self.categories = categories self.branches = branches self.yoctorepos = yoctorepos self.builders = builders self.addLogs = addLogs self.relayhost = relayhost self.buildSetSummary = buildSetSummary self.subject = subject self.lookup = lookup self.extraRecipients = extraRecipients self.sendToInterestedUsers = sendToInterestedUsers self.customMesg = customMesg self.messageFormatter = messageFormatter self.extraHeaders = extraHeaders self.addPatch = addPatch self.useTls = useTls self.smtpUser = smtpUser self.smtpPassword = smtpPassword self.smtpPort = smtpPort MailNotifier.__init__(self, fromaddr, mode=self.mode, categories = self.categories, builders = self.builders, addLogs = self.addLogs, relayhost = self.relayhost, buildSetSummary = self.buildSetSummary, subject = self.subject, lookup = self.lookup, extraRecipients = self.extraRecipients, sendToInterestedUsers = self.sendToInterestedUsers, customMesg = self.customMesg, messageFormatter = self.messageFormatter, extraHeaders = self.extraHeaders, addPatch = self.addPatch, useTls = self.useTls, smtpUser = self.smtpUser, smtpPassword = self.smtpPassword, smtpPort = self.smtpPort)
def __init__(self, fromaddr, mode="all", categories=None, builders=None, addLogs=False, relayhost="localhost", subject="", lookup=None, extraRecipients=[], sendToInterestedUsers=True, schedulerGroups=[], schedulerGroupsSendFirst=1): ''' @type schedulerGroupsSendFirst: int @param schedulerGroupsSendFirst: How many mails to send to interested users before we group the rest of the emails. @type schedulerGroups: list (can be list of lists) @param schedulerGroups: list of schedulers to group emails by. Multiple schedulers can be grouped together by passing them in as a list. This may be a list of lists, but can not be nested beyond that. ''' self.schedulerGroupsSendFirst = schedulerGroupsSendFirst # builderGroups is a list BuilderGroups self.builderGroups = [] for schedulerGroup in schedulerGroups: group = BuilderGroup() if isinstance(schedulerGroup, list): for scheduler in schedulerGroup: group.addBuilderNames(scheduler.listBuilderNames()) else: group.addBuilderNames(schedulerGroup.listBuilderNames()) self.builderGroups.append(group) MailNotifier.__init__(self, fromaddr, mode, categories, builders, addLogs, relayhost, subject, lookup, extraRecipients, sendToInterestedUsers)
def __init__(self, reply_to=None, categories_steps=None, exclusions=None, forgiving_steps=None, status_header=None, use_getname=False, send_to_sheriffs=None, sheriffs=None, public_html='public_html', minimum_delay_between_alert=600, **kwargs): """Constructor with following specific arguments (on top of base class'). @type categories_steps: Dictionary of category string mapped to a list of step strings. @param categories_steps: For each category name we can specify the steps we want to check for success to keep the tree opened. An empty list of steps means that we simply check for results == FAILURE to close the tree. Defaults to None for the dictionary, which means all categories, and the empty string category can be used to say all builders. @type exclusions: Dictionary of strings to arrays of strings. @param exclusions: The key is a builder name for which we want to ignore a series of step names set as the value in the form of an array of strings. Defaults to None. @type forgiving_steps: List of strings. @param forgiving_steps: The list of steps for which a failure email should NOT be sent to the blame list. @type status_header: String. @param status_header: Formatted header used in mail message. @type minimum_delay_between_alert: Integer. @param minimum_delay_between_alert: Don't send failure e-mails more often than the given value (in seconds). @type send_to_sheriffs: Boolean or None. @param send_to_sheriffs: Force the list of sheriffes to either ['sheriff'] or []. Deprecated, backwards compatability only. @type sheriffs: List of strings. @param sheriffs: The list of sheriff type names to be used for the set of sheriffs. The final destination changes over time. @type public_html: String. @param public_html: Directory from which any additional configuration is read. E.g. sheriff classes. @type use_getname: Boolean. @param use_getname: If true, step name is taken from getName(), otherwise the step name is taken from getText(). """ # Change the default. kwargs.setdefault('sendToInterestedUsers', False) kwargs.setdefault('subject', 'buildbot %(result)s in %(projectName)s on %(builder)s') MailNotifier.__init__(self, **kwargs) self.reply_to = reply_to self.categories_steps = categories_steps self.exclusions = exclusions or {} self.forgiving_steps = forgiving_steps or [] self.status_header = status_header assert self.status_header self.minimum_delay_between_alert = minimum_delay_between_alert #TODO(petermayo) Remove send_to_sheriffs one day soon. if send_to_sheriffs is None: self.sheriffs = sheriffs or [] elif send_to_sheriffs: log.msg( 'Do not use send_to_sheriffs=True, please use sheriffs=["sheriff"]', logLevel=logging.ERROR) self.sheriffs = ['sheriff'] else: log.msg( 'Do not use send_to_sheriffs=False, if you must: use sheriffs=[]', logLevel=logging.ERROR) self.sheriffs = [] self.public_html = public_html self.use_getname = use_getname self._last_time_mail_sent = None
def __init__(self, **kwargs): MailNotifier.__init__(self, **kwargs)
def __init__(self, reply_to=None, categories_steps=None, exclusions=None, forgiving_steps=None, status_header=None, use_getname=False, sheriffs=None, public_html='public_html', minimum_delay_between_alert=600, enable_mail=True, **kwargs): """Constructor with following specific arguments (on top of base class'). @type categories_steps: Dictionary of category string mapped to a list of step strings. @param categories_steps: For each category name we can specify the steps we want to check for success to keep the tree opened. An empty list of steps means that we simply check for results == FAILURE to close the tree. Defaults to None for the dictionary, which means all categories, and the empty string category can be used to say all builders. @type exclusions: Dictionary of strings to arrays of strings. @param exclusions: The key is a builder name for which we want to ignore a series of step names set as the value in the form of an array of strings. Defaults to None. @type forgiving_steps: List of strings. @param forgiving_steps: The list of steps for which a failure email should NOT be sent to the blame list. @type status_header: String. @param status_header: Formatted header used in mail message. @type minimum_delay_between_alert: Integer. @param minimum_delay_between_alert: Don't send failure e-mails more often than the given value (in seconds). @type sheriffs: List of strings. @param sheriffs: The list of sheriff type names to be used for the set of sheriffs. The final destination changes over time. @type public_html: String. @param public_html: Directory from which any additional configuration is read. E.g. sheriff classes. @type use_getname: Boolean. @param use_getname: If true, step name is taken from getName(), otherwise the step name is taken from getText(). @type enable_mail: Boolean. @param enable_mail: If true, mail is sent, otherwise mail is formatted and logged, but not sent. """ # Change the default. kwargs.setdefault('sendToInterestedUsers', False) kwargs.setdefault( 'subject', 'buildbot %(result)s in %(projectName)s on %(builder)s') MailNotifier.__init__(self, **kwargs) self.reply_to = reply_to self.categories_steps = categories_steps self.exclusions = exclusions or {} self.forgiving_steps = forgiving_steps or [] self.status_header = status_header assert self.status_header self.minimum_delay_between_alert = minimum_delay_between_alert self.sheriffs = sheriffs or [] self.public_html = public_html self.use_getname = use_getname self.enable_mail = enable_mail self._last_time_mail_sent = None