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
174e65ce
Commit
174e65ce
authored
5 years ago
by
Eesaan Atluri
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into feat-subscribe-mail-lists
parents
1bb3b2b5
9877c0ba
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
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
create_account.py
+12
-4
12 additions, 4 deletions
create_account.py
rc_util.py
+28
-1
28 additions, 1 deletion
rc_util.py
with
40 additions
and
5 deletions
create_account.py
+
12
−
4
View file @
174e65ce
...
@@ -3,14 +3,22 @@ import sys
...
@@ -3,14 +3,22 @@ import sys
import
rc_util
import
rc_util
if
len
(
sys
.
argv
)
<
2
:
if
len
(
sys
.
argv
)
<
2
:
print
(
"
Usage: {} USERNAME [FULL_NAME] [REASON]
"
.
format
(
sys
.
argv
[
0
]),
file
=
sys
.
stderr
)
print
(
"
Usage: {} USERNAME
[EMAIL]
[FULL_NAME] [REASON]
"
.
format
(
sys
.
argv
[
0
]),
file
=
sys
.
stderr
)
exit
(
1
)
exit
(
1
)
domain
=
'
uab.edu
'
user_name
=
sys
.
argv
[
1
]
user_name
=
sys
.
argv
[
1
]
full_name
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
>=
3
else
''
email
=
sys
.
argv
[
2
]
if
len
(
sys
.
argv
)
>=
3
else
''
reason
=
sys
.
argv
[
3
]
if
len
(
sys
.
argv
)
>=
4
else
''
full_name
=
sys
.
argv
[
3
]
if
len
(
sys
.
argv
)
>=
4
else
''
reason
=
sys
.
argv
[
4
]
if
len
(
sys
.
argv
)
>=
5
else
''
rc_util
.
add_account
(
user_name
,
full
=
full_name
,
reason
=
reason
)
if
email
==
''
:
if
'
@
'
in
user_name
:
email
=
user_name
else
:
email
=
user_name
+
'
@
'
+
domain
rc_util
.
add_account
(
user_name
,
email
=
email
,
full
=
full_name
,
reason
=
reason
)
print
(
"
Account requested for user: {}
"
.
format
(
user_name
))
print
(
"
Account requested for user: {}
"
.
format
(
user_name
))
print
(
"
Waiting for confirmation...
"
)
print
(
"
Waiting for confirmation...
"
)
...
...
This diff is collapsed.
Click to expand it.
rc_util.py
+
28
−
1
View file @
174e65ce
import
logging
import
argparse
from
rc_rmq
import
RCRMQ
from
rc_rmq
import
RCRMQ
import
json
import
json
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
rc_rmq
=
RCRMQ
({
'
exchange
'
:
'
RegUsr
'
,
'
exchange_type
'
:
'
topic
'
})
tasks
=
{
'
ohpc_account
'
:
None
,
'
ood_account
'
:
None
,
'
slurm_account
'
:
None
}
tasks
=
{
'
ohpc_account
'
:
None
,
'
ood_account
'
:
None
,
'
slurm_account
'
:
None
}
logger_fmt
=
'
%(asctime)s [%(module)s] - %(message)s
'
def
add_account
(
username
,
full
=
''
,
reason
=
''
):
def
add_account
(
username
,
email
,
full
=
''
,
reason
=
''
):
rc_rmq
.
publish_msg
({
rc_rmq
.
publish_msg
({
'
routing_key
'
:
'
request.
'
+
username
,
'
routing_key
'
:
'
request.
'
+
username
,
'
msg
'
:
{
'
msg
'
:
{
"
username
"
:
username
,
"
username
"
:
username
,
"
email
"
:
email
,
"
fullname
"
:
full
,
"
fullname
"
:
full
,
"
reason
"
:
reason
"
reason
"
:
reason
}
}
...
@@ -43,3 +47,26 @@ def consume(username, callback=worker, debug=False):
...
@@ -43,3 +47,26 @@ def consume(username, callback=worker, debug=False):
rc_rmq
.
disconnect
()
rc_rmq
.
disconnect
()
return
{
'
success
'
:
True
}
return
{
'
success
'
:
True
}
def
get_args
():
# Parse arguments
parser
=
argparse
.
ArgumentParser
()
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
'
)
return
parser
.
parse_args
()
def
get_logger
(
args
=
None
):
if
args
is
None
:
args
=
get_args
()
logger_lvl
=
logging
.
WARNING
if
args
.
verbose
:
logger_lvl
=
logging
.
DEBUG
if
args
.
dry_run
:
logger_lvl
=
logging
.
INFO
logging
.
basicConfig
(
format
=
logger_fmt
,
level
=
logger_lvl
)
return
logging
.
getLogger
(
__name__
)
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