Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rabbitmq_agents
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Bo-Chun Chen
rabbitmq_agents
Commits
d5fda706
Commit
d5fda706
authored
4 years ago
by
Eesaan Atluri
Browse files
Options
Downloads
Patches
Plain Diff
Add fullname and blazerID to the subj line of admin report email.
parent
3634447a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mail_config.py
+1
-1
1 addition, 1 deletion
mail_config.py
task_manager.py
+14
-12
14 additions, 12 deletions
task_manager.py
with
15 additions
and
13 deletions
mail_config.py
+
1
−
1
View file @
d5fda706
...
...
@@ -31,6 +31,6 @@ Whole_mail = Head + Body
UserReportHead
=
f
"""
From:
{
Sender_alias
}
<
{
Sender
}
>
To: <
{
Admin_email
}
>
Subject:
User
Creation Report:
Subject:
RC Account
Creation Report:
{{{{ fullname }}}}, {{{{ username }}}}
"""
This diff is collapsed.
Click to expand it.
task_manager.py
+
14
−
12
View file @
d5fda706
...
...
@@ -7,6 +7,7 @@ import dataset
import
rc_util
import
smtplib
from
rc_rmq
import
RCRMQ
from
jinja2
import
Template
from
datetime
import
datetime
import
mail_config
as
mail_cfg
...
...
@@ -47,18 +48,18 @@ tracking = {}
# Instantiate rabbitmq object
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
def
notify_admin
(
username
,
user_record
):
def
notify_admin
(
username
,
fullname
,
user_record
):
receivers
=
[
user_record
[
'
email
'
],
mail_cfg
.
Admin_email
]
message
=
mail_cfg
.
UserReportHead
message
+=
f
"""
User Creation Report for user
{
username
}
uid:
{
user_record
[
"
uid
"
]
}
, gid:
{
user_record
[
"
gid
"
]
}
Tasks:
'
create_account
'
:
{
user_record
[
"
request
"
][
"
create_account
"
]
}
'
git_commit
'
:
{
user_record
[
"
verify
"
][
"
git_commit
"
]
}
'
dir_verify
'
:
{
user_record
[
"
verify
"
][
"
dir_verify
"
]
}
'
subscribe_mail_list
'
:
{
user_record
[
"
verify
"
][
"
subscribe_mail_list
"
]
}
'
notify_user
'
:
{
user_record
[
"
notify
"
][
"
notify_user
"
]
}
message
=
Template
(
mail_cfg
.
UserReportHead
).
render
(
username
=
username
,
fullname
=
fullname
)
message
+=
f
"""
\n
User Creation Report for user
{
username
}
uid:
{
user_record
[
"
uid
"
]
}
, gid:
{
user_record
[
"
gid
"
]
}
Tasks:
'
create_account
'
:
{
user_record
[
"
request
"
][
"
create_account
"
]
}
'
git_commit
'
:
{
user_record
[
"
verify
"
][
"
git_commit
"
]
}
'
dir_verify
'
:
{
user_record
[
"
verify
"
][
"
dir_verify
"
]
}
'
subscribe_mail_list
'
:
{
user_record
[
"
verify
"
][
"
subscribe_mail_list
"
]
}
'
notify_user
'
:
{
user_record
[
"
notify
"
][
"
notify_user
"
]
}
"""
if
user_record
[
'
errmsg
'
]:
message
+=
"""
...
...
@@ -112,6 +113,7 @@ def update_db(username, data):
def
task_manager
(
ch
,
method
,
properties
,
body
):
msg
=
json
.
loads
(
body
)
username
=
method
.
routing_key
.
split
(
'
.
'
)[
1
]
fullname
=
msg
[
'
fullname
'
]
task_name
=
msg
[
'
task
'
]
success
=
msg
[
'
success
'
]
send
=
completed
=
terminated
=
False
...
...
@@ -242,7 +244,7 @@ def task_manager(ch, method, properties, body):
# Send report to admin
if
completed
or
terminated
:
notify_admin
(
username
,
current
)
notify_admin
(
username
,
fullname
,
current
)
update_db
(
username
,
{
'
reported
'
:
True
})
...
...
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