Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rabbitmq_agents
Manage
Activity
Members
Labels
Plan
Issues
14
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
1bb3b2b5
Commit
1bb3b2b5
authored
5 years ago
by
Eesaan Atluri
Browse files
Options
Downloads
Patches
Plain Diff
Use rc_util class methods for logging and arg parsing in subscribe mail lists agent
parent
e375efb7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
6 merge requests
!147
Merge previous default branch feat-cod-rmq into main
,
!85
kill nginx process running under user from login node
,
!51
Fix acct create wait
,
!39
WIP:Feat cod rmq
,
!38
WIP: Feat cod rmq
,
!30
Feat subscribe mail lists
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
subscribe_mail_lists.py
+3
-15
3 additions, 15 deletions
subscribe_mail_lists.py
with
3 additions
and
15 deletions
subscribe_mail_lists.py
+
3
−
15
View file @
1bb3b2b5
...
@@ -4,6 +4,7 @@ import json
...
@@ -4,6 +4,7 @@ import json
import
smtplib
import
smtplib
import
logging
import
logging
import
argparse
import
argparse
import
rc_util
from
email.message
import
EmailMessage
from
email.message
import
EmailMessage
from
rc_rmq
import
RCRMQ
from
rc_rmq
import
RCRMQ
...
@@ -13,24 +14,11 @@ task = 'subscribe_mail_list'
...
@@ -13,24 +14,11 @@ task = 'subscribe_mail_list'
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
# Parse arguments
# Parse arguments
parser
=
argparse
.
ArgumentParser
()
args
=
rc_util
.
get_args
()
parser
.
add_argument
(
'
-v
'
,
'
--verbose
'
,
action
=
'
store_true
'
,
help
=
'
verbose output
'
)
parser
.
add_argument
(
'
-n
'
,
'
--dry-run
'
,
action
=
'
store_true
'
,
help
=
'
enable dry run mode
'
)
args
=
parser
.
parse_args
()
#Default Log level
log_lvl
=
logging
.
WARNING
if
args
.
verbose
:
log_lvl
=
logging
.
DEBUG
if
args
.
dry_run
:
log_lvl
=
logging
.
INFO
# Logger
# Logger
logging
.
basicConfig
(
format
=
'
%(asctime)s %(levelname)s [%(module)s] - %(message)s
'
,
level
=
log_lvl
)
logger
=
rc_util
.
get_logger
()
# Define your callback function
logger
=
logging
.
getLogger
(
__name__
)
# Define your callback function
def
mail_list_subscription
(
ch
,
method
,
properties
,
body
):
def
mail_list_subscription
(
ch
,
method
,
properties
,
body
):
# Retrieve message
# Retrieve message
...
...
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