Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def send_email(self, date="today"):
"""Send the email"""
if date:
date = lmdutils.get_date(date)
d = lmdutils.get_date_ymd(date)
if isinstance(self, Nag):
self.nag_date = d
if not self.must_run(d):
return
if not self.has_enough_data():
logger.info("The tool {} hasn't enough data to run".format(self.name()))
return
login_info = utils.get_login_info()
title, body = self.get_email(date)
if title:
receivers = self.get_receivers()
status = "Success"
def send():
path = utils.get_config("common", "log")
try:
n = os.path.getsize(path)
if n != 0:
login_info = utils.get_login_info()
date = lmdutils.get_date("today")
msg, files = get_msg(path)
mail.send(
login_info["ldap_username"],
utils.get_config("common", "on-errors"),
"[autonag] Something bad happened when running auto-nag the {}".format(
date
),
msg,
html=False,
login=login_info,
dryrun=False,
files=files,
)
except Exception:
pass
def get_bz_params(self, date):
tomorrow = lmdutils.get_date("tomorrow")
start_date, _ = self.get_dates(date)
fields = ["creator"]
params = {
"include_fields": fields,
"resolution": "---",
"f1": "longdesc",
"o1": "regexp",
"v1": "([[:<:]]{}[[:>:]])|([[:<:]]{}?[[:>:]])|({}?[ \t]+{}[ \t]+{})[ \t]*:".format(
*map(utils.bz_ignore_case, ("str", "steps", "steps", "to", "reproduce"))
),
"f2": "cf_has_str",
"o2": "equals",
"v2": "---",
"n3": 1,
"f3": "cf_has_str",
"o3": "changedbefore",