Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rabbitmq_agents
Manage
Activity
Members
Labels
Plan
Issues
16
Issue boards
Milestones
Wiki
Code
Merge requests
10
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
!89
Fix uid/gid lookup cmd
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fix uid/gid lookup cmd
github/fork/diedpigs/fix-uid-lookup-cmd
into
feat-cod-rmq
Overview
1
Commits
1
Pipelines
0
Changes
1
Merged
Bo-Chun Chen
requested to merge
github/fork/diedpigs/fix-uid-lookup-cmd
into
feat-cod-rmq
4 years ago
Overview
1
Commits
1
Pipelines
0
Changes
1
Expand
In order to start from 10000, add
BEGIN
with a default value for awk command
👍
0
👎
0
Merge request reports
Compare
feat-cod-rmq
feat-cod-rmq (base)
and
latest version
latest version
e96f33c1
1 commit,
1 year ago
1 file
+
4
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
prod_rmq_agents/get-next-uid-gid.py
+
4
−
4
Options
@@ -20,7 +20,7 @@ args = rc_util.get_args()
# Logger
logger
=
rc_util
.
get_logger
()
#Account creation
#Account creation
def
create_account
(
msg
):
logger
.
info
(
f
'
Account creation request received:
{
msg
}
'
)
@@ -56,17 +56,17 @@ def resolve_uid_gid(ch, method, properties, body):
if
user_exists
:
logger
.
info
(
"
The user, {} already exists
"
.
format
(
username
))
msg
[
'
uid
'
]
=
user_exists
.
split
(
'
:
'
)[
2
]
msg
[
'
uid
'
]
=
user_exists
.
split
(
'
:
'
)[
2
]
msg
[
'
gid
'
]
=
user_exists
.
split
(
'
:
'
)[
3
]
else
:
cmd_uid
=
"
/usr/bin/getent passwd |
\
awk -F:
'
($3>10000) && ($3<20000) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }
'"
awk -F:
'
BEGIN { maxuid=10000 }
($3>10000) && ($3<20000) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }
'"
msg
[
'
uid
'
]
=
popen
(
cmd_uid
).
read
().
rstrip
()
logger
.
info
(
f
"
UID query:
{
cmd_uid
}
"
)
cmd_gid
=
"
/usr/bin/getent group |
\
awk -F:
'
($3>10000) && ($3<20000) && ($3>maxgid) { maxgid=$3; } END { print maxgid+1; }
'"
awk -F:
'
BEGIN { maxgid=10000 }
($3>10000) && ($3<20000) && ($3>maxgid) { maxgid=$3; } END { print maxgid+1; }
'"
msg
[
'
gid
'
]
=
popen
(
cmd_gid
).
read
().
rstrip
()
logger
.
info
(
f
"
GID query:
{
cmd_gid
}
"
)
Loading