-
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
Add --host and -H as equivalent options to --url #14947
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@Luap99 PTAL |
Addresses: #14917 |
--connection accepts a name not a url, I think docker --host needs a full url so this should map to --url |
@Luap99 Your right, thanks. |
72dab61
to
53a2b8f
Compare
test/system/250-systemd.bats
Outdated
systemd-run --unit=$SERVICE_NAME $PODMAN system service $URL --time=0 | ||
wait_for_port 127.0.0.1 $port | ||
|
||
# Start a long-running container. |
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.
The comment is confusing as the containers are short lived.
APIv2 failure is the deadlock bug (#14929). I'd restart it, except, I think there's something still broken because tests fail on my laptop when I run them manually:
I'll assume that should be a trivial one for you to fix (remove one of the dashes). What would you think of adding: diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 3afd760c3..8e6c7dadc 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -414,6 +414,10 @@ EOF
run_podman --H $URL run --rm $IMAGE true
systemctl stop $SERVICE_NAME
+
+ # Make sure the option is actually connecting
+ run_podman 125 --host $URL run --rm $IMAGE true
+ assert "$output" =~ "Cannot connect to Podman.*connection refused"
}
# vim: filetype=sh |
LGTM |
Docker supports -H and --host for specify the listening socket. Podman should support them also in order to match the CLI. These will not be documented since Podman defaults to using the --url option. Signed-off-by: Daniel J Walsh <[email protected]>
run_podman --host $URL run --rm $IMAGE true | ||
run_podman -H $URL run --rm $IMAGE true | ||
|
||
systemctl stop $SERVICE_NAME | ||
|
||
# Make sure the option is actually connecting | ||
run_podman 125 --host $URL run --rm $IMAGE true | ||
assert "$output" =~ "Cannot connect to Podman.*connection refused" |
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 do we run containers? Could we just call info? That way we can also check for remote.
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.
The goal here is to make sure the --host $URL is actually doing something including failing if the socket does not exist.
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 and info fails without socket.
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.
And you think info would be faster? I just used what was suggested by Ed.
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.
I would say yes but it is not really important enough to argue over it. I am ok to merge this.
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.
I just made my suggestion because I didn't think podman info
would show the socket. (There's a bug open for that, or maybe it's been fixed, I don't know). Anyway, if podman info
shows the socket name, that is a much better solution than running containers.
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.
Hey, the info
bug is fixed. Suggestion:
@test "podman-system-service containers --host" {
skip_if_remote "N/A under podman-remote"
SERVICE_NAME=podman-service-$(random_string)
# (Used only in teardown if the test fails)
touch $UNIT_FILE
port=$(random_free_port)
URL=tcp://127.0.0.1:$port
systemd-run --unit=$SERVICE_NAME $PODMAN system service $URL --time=0
wait_for_port 127.0.0.1 $port
for opt in --host -H; do
run_podman $opt $URL info --format '{{.Host.RemoteSocket.Path}}'
is "$output" "$URL" "RemoteSocket.Path using $opt"
done
systemctl stop $SERVICE_NAME
rm -f $UNIT_FILE
}
This also adds an important cleanup step to prevent leaving the podman server behind on failure.
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.
And yes, I realize that the previous test (from which this was copied) also has a missing cleanup. That's now on my TODO list to fix. Unless you'd like to fix it.
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.
Lets get this merged and then fix the test, unless something else fails.
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.
OK, I'll fix it in a cleanup PR later
LGTM but after thinking about it a little, I'm pretty sure this test should not be skipped under podman-remote: that's exactly where this flag is intended. Unfortunately, making this run under podman-remote is much more complicated than I expected. I will add that to my TODO list. |
fs.StringVarP(&ignoredConnection, connectionFlagName, "c", "", "") | ||
fs.StringP(connectionFlagName, "c", "", "") | ||
hostFlagName := "host" | ||
fs.StringP(hostFlagName, "H", "", "") |
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.
I'm not a fan of having an upper cased single character option when most (all?) of our others are lower case. But Docker compatibility, ugh.
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.
I assume that -h had already been taken by --help.
Docker supports -H and --host for specify the listening socket. Podman
should support them also in order to match the CLI.
These will not be documented since Podman defaults to using the
--connection option.
Signed-off-by: Daniel J Walsh [email protected]
Does this PR introduce a user-facing change?
Yes