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
c37743d0
Commit
c37743d0
authored
4 years ago
by
Ravi Tripathi
Browse files
Options
Downloads
Patches
Plain Diff
Modifying task_manager to differnetiate variables between mail_server and rabbit_config file
parent
beaa5627
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
,
!74
Feat correct taskmgr var
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
task_manager.py
+7
-6
7 additions, 6 deletions
task_manager.py
with
7 additions
and
6 deletions
task_manager.py
+
7
−
6
View file @
c37743d0
...
...
@@ -10,6 +10,7 @@ from rc_rmq import RCRMQ
from
jinja2
import
Template
from
datetime
import
datetime
import
mail_config
as
mail_cfg
import
rabbitmq_config
as
rcfg
task
=
'
task_manager
'
timeout
=
30
...
...
@@ -50,7 +51,7 @@ tracking = {}
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
def
notify_admin
(
username
,
user_record
):
receivers
=
[
user_record
[
'
email
'
],
mail_
cfg
.
Admin_email
]
receivers
=
[
user_record
[
'
email
'
],
r
cfg
.
Admin_email
]
message
=
Template
(
mail_cfg
.
UserReportHead
).
render
(
username
=
username
,
fullname
=
user_record
[
'
fullname
'
])
if
user_record
[
'
reported
'
]:
message
+=
'
(Duplicate)
'
...
...
@@ -73,15 +74,15 @@ def notify_admin(username, user_record):
message
+=
msg
+
"
\n
"
if
args
.
dry_run
:
logger
.
info
(
f
'
smtp = smtplib.SMTP(
{
mail_
cfg
.
Server
}
)
'
)
logger
.
info
(
f
'
smtp.sendmail(
{
mail_
cfg
.
Sender
}
,
{
mail_
cfg
.
Admin_email
}
, message)
'
)
logger
.
info
(
f
'
smtp = smtplib.SMTP(
{
r
cfg
.
Server
}
)
'
)
logger
.
info
(
f
'
smtp.sendmail(
{
r
cfg
.
Sender
}
,
{
r
cfg
.
Admin_email
}
, message)
'
)
logger
.
info
(
message
)
else
:
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
'
User report sent to:
{
mail_
cfg
.
Admin_email
}
'
)
logger
.
debug
(
f
'
User report sent to:
{
r
cfg
.
Admin_email
}
'
)
def
insert_db
(
username
,
msg
):
...
...
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