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
Merge requests
!132
Feat pre certification
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Feat pre certification
github/fork/rtripath89/feat_pre_cetification
into
feat-cod-rmq
Overview
2
Commits
4
Pipelines
0
Changes
2
Closed
Ravi Tripathi
requested to merge
github/fork/rtripath89/feat_pre_cetification
into
feat-cod-rmq
3 years ago
Overview
2
Commits
4
Pipelines
0
Changes
1
Expand
Created by: rtripath89
👍
0
👎
0
Merge request reports
Viewing commit
1d45bc91
Prev
Next
Show latest version
1 file
+
55
−
50
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
1d45bc91
Correcting merge conflict
· 1d45bc91
root
authored
3 years ago
prod_rmq_agents/acct_mgmt_workflow.py
+
55
−
50
Options
@@ -25,64 +25,69 @@ def manage_acct(ch, method, properties, body):
service
=
msg
[
"
service
"
]
queuename
=
msg
[
"
queuename
"
]
if
username
in
tracking
:
current
=
tracking
[
username
]
else
:
current
=
tracking
[
username
]
=
{}
if
op
==
'
request
'
:
if
state
==
'
hold
'
or
state
==
'
certification
'
:
msg
[
"
action
"
]
=
"
lock
"
elif
state
==
'
ok
'
or
state
==
'
pre_certification
'
:
msg
[
"
action
"
]
=
"
unlock
"
try
:
if
username
in
tracking
:
current
=
tracking
[
username
]
else
:
print
(
"
Invalid state provided. Check the help menu.
"
)
if
service
==
'
all
'
:
current
[
"
new_jobs
"
]
=
None
current
[
"
expire_account
"
]
=
None
# send a broadcast message to all agents
rc_rmq
.
publish_msg
(
{
"
routing_key
"
:
f
"
{
msg
[
'
action
'
]
}
.
{
queuename
}
"
,
"
msg
"
:
msg
,
}
)
else
:
for
each_service
in
service
:
current
[
each_service
]
=
None
current
=
tracking
[
username
]
=
{}
if
op
==
'
request
'
:
if
state
==
'
hold
'
or
state
==
'
certification
'
:
msg
[
"
action
"
]
=
"
lock
"
elif
state
==
'
ok
'
or
state
==
'
pre_certification
'
:
msg
[
"
action
"
]
=
"
unlock
"
else
:
print
(
"
Invalid state provided. Check the help menu.
"
)
if
service
==
'
all
'
:
current
[
"
new_jobs
"
]
=
None
current
[
"
expire_account
"
]
=
None
# send a broadcast message to all agents
rc_rmq
.
publish_msg
(
{
"
routing_key
"
:
f
"
{
each_service
}
.
{
queuename
}
"
,
"
msg
"
:
msg
"
routing_key
"
:
f
"
{
msg
[
'
action
'
]
}
.
{
queuename
}
"
,
"
msg
"
:
msg
,
}
)
else
:
for
each_service
in
service
:
current
[
each_service
]
=
None
rc_rmq
.
publish_msg
(
{
"
routing_key
"
:
f
"
{
each_service
}
.
{
queuename
}
"
,
"
msg
"
:
msg
}
)
elif
op
==
'
done
'
:
# Check if each task/agent returned success
current
[
msg
[
"
task
"
]]
=
msg
[
"
success
"
]
done
=
True
for
task
in
current
.
keys
():
if
current
[
task
]
is
None
:
done
=
False
if
done
:
rc_util
.
update_state
(
username
,
state
,
msg
.
get
(
"
updated_by
"
),
msg
.
get
(
"
host
"
)
)
# Send done msg to account_manager.py
rc_rmq
.
publish_msg
(
{
"
routing_key
"
:
f
'
certified.
{
queuename
}
'
,
"
msg
"
:
msg
,
}
)
elif
op
==
'
done
'
:
# Check if each task/agent returned success
current
[
msg
[
"
task
"
]]
=
msg
[
"
success
"
]
done
=
True
for
task
in
current
.
keys
():
if
current
[
task
]
is
None
:
done
=
False
if
done
:
rc_util
.
update_state
(
username
,
state
,
msg
.
get
(
"
updated_by
"
),
msg
.
get
(
"
host
"
)
)
# Send done msg to account_manager.py
rc_rmq
.
publish_msg
(
{
"
routing_key
"
:
f
'
certified.
{
queuename
}
'
,
"
msg
"
:
msg
,
}
)
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
except
Exception
:
msg
[
"
errmsg
"
]
=
"
Exception raised in account manager workflow agent , check the logs for stack trace
"
logger
.
error
(
""
,
exc_info
=
True
)
rc_rmq
.
bind_queue
(
queue
=
task
,
routing_key
=
'
acctmgr.request.*
'
,
durable
=
True
)
rc_rmq
.
bind_queue
(
queue
=
task
,
routing_key
=
'
acctmgr.done.*
'
,
durable
=
True
)
Loading