Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rabbitmq_agents
Manage
Activity
Members
Labels
Plan
Issues
13
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rc
rabbitmq_agents
Commits
d9e6789a
Commit
d9e6789a
authored
4 years ago
by
Eesaan Atluri
Browse files
Options
Downloads
Patches
Plain Diff
Use mail config template for notify user agent
parent
6ecabd9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!147
Merge previous default branch feat-cod-rmq into main
,
!85
kill nginx process running under user from login node
,
!78
Feat cod rmq
,
!73
Feat separate mail config
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notify_user.py
+7
-7
7 additions, 7 deletions
notify_user.py
with
7 additions
and
7 deletions
notify_user.py
+
7
−
7
View file @
d9e6789a
...
...
@@ -7,8 +7,8 @@ import dataset
from
rc_rmq
import
RCRMQ
from
jinja2
import
Template
from
datetime
import
datetime
import
rabbit_config
as
mail_
cfg
import
rabbit_config
as
r
cfg
import
mail_config
as
mail_cfg
task
=
'
notify_user
'
args
=
rc_util
.
get_args
()
...
...
@@ -51,18 +51,18 @@ def notify_user(ch, method, properties, body):
else
:
# Send email to user
receivers
=
[
user_email
,
mail_
cfg
.
Admin_email
]
receivers
=
[
user_email
,
r
cfg
.
Admin_email
]
message
=
Template
(
mail_cfg
.
Whole_mail
).
render
(
username
=
username
,
to
=
user_email
)
if
args
.
dry_run
:
logger
.
info
(
f
'
smtp = smtplib.SMTP(
{
mail_
cfg
.
Server
}
)
'
)
logger
.
info
(
f
'
smtp.sendmail(
{
mail_
cfg
.
Sender
}
,
{
receivers
}
, message)
'
)
logger
.
info
(
f
'
smtp = smtplib.SMTP(
{
r
cfg
.
Server
}
)
'
)
logger
.
info
(
f
'
smtp.sendmail(
{
r
cfg
.
Sender
}
,
{
receivers
}
, message)
'
)
logger
.
info
(
f
"
table.update({{
'
username
'
:
{
username
}
,
'
count
'
: 1,
'
sent_at
'
: datetime.now()}}, [
'
username
'
])
"
)
else
:
errmsg
=
'
Sending email to user
'
smtp
=
smtplib
.
SMTP
(
mail_
cfg
.
Server
)
smtp
.
sendmail
(
mail_
cfg
.
Sender
,
receivers
,
message
)
smtp
=
smtplib
.
SMTP
(
r
cfg
.
Server
)
smtp
.
sendmail
(
r
cfg
.
Sender
,
receivers
,
message
)
logger
.
debug
(
f
'
Email sent to:
{
user_email
}
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment