-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rootless: not require userns for help/version #1268
Conversation
aa902b5
to
97cf485
Compare
|
@giuseppe Can we add integration tests for those three cases? Just to avoid any potential regressions. |
a7d9342
to
f4e4ab1
Compare
cmd/podman/main.go
Outdated
"version", | ||
} | ||
|
||
func sliceContains(slice []string, s string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function probably should live in utils.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
f4e4ab1
to
0ec54b6
Compare
@giuseppe |
cmd/podman/main.go
Outdated
args := c.Args() | ||
if args.Present() { | ||
name := args.First() | ||
if name != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it impossible that if the args.Present() was true then args.First() == ""?
cmd/podman/main.go
Outdated
if args.Present() { | ||
name := args.First() | ||
if name != "" { | ||
requiresRootless := !sliceContains(cmdsNotRequiringRootless, name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why create a variable for this?
cmd/podman/main.go
Outdated
@@ -25,19 +25,15 @@ var ( | |||
exitCode = 125 | |||
) | |||
|
|||
var cmdsNotRequiringRootless = []string{ | |||
"help", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make this a map, then you don't need to the string compare stuff below,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that is better. I've pushed a new version
0ec54b6
to
66ef382
Compare
these commands do not require to be root in an userns Closes: containers#1263 Signed-off-by: Giuseppe Scrivano <[email protected]>
66ef382
to
a8b04a2
Compare
This LGTM, but you should update the title to remove info |
done, I've updated the PR title |
📌 Commit a8b04a2 has been approved by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
☀️ Test successful - status-papr |
these commands do not require to be root in an userns
Closes: #1263
Signed-off-by: Giuseppe Scrivano [email protected]