Skip to content
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

Change priority for cli flags for remotely operating Podman #19997

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

cgiradkar
Copy link
Contributor

--connection flag couldn't override the active-destination when CONTAINER_HOST env variable was set. As a remedy, the precedence of --connection flag has been changed.

Does this PR introduce a user-facing change?

For operating Podman remotely, the order of priority is:

1.  cli flags (--connection ,--url ,--context ,--host)
2.  Env variables (CONTAINER_HOST and CONTAINER_CONNECTION)
3.  ActiveService from containers.conf
4.  RemoteURI

Closes #15588

Signed-off-by: Chetan Giradkar cgiradka@redhat.com

@openshift-ci openshift-ci bot added release-note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 15, 2023
@cgiradkar cgiradkar changed the title Change priority for connection flag Change priority for cli flags for remotely operating Podman Sep 15, 2023
@cgiradkar cgiradkar force-pushed the Issue_15588 branch 2 times, most recently from 7951ab0 to 696d908 Compare September 18, 2023 09:20
cmd/podman/root.go Outdated Show resolved Hide resolved
cmd/podman/root.go Outdated Show resolved Hide resolved
cmd/podman/root.go Outdated Show resolved Hide resolved
cmd/podman/root.go Outdated Show resolved Hide resolved
pkg/domain/infra/runtime_abi.go Outdated Show resolved Hide resolved
@@ -180,4 +180,73 @@ $c2[ ]\+tcp://localhost:54321[ ]\+true" \
run_podman system connection rm mysshconn
}

# Check the priority of --connection flag vs CONTAINER_HOST env variable
@test "podman-remote: non-default connection" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edsantiago PTAL at the test, I am not sure if you have a better idea to structure this: the full matrix is quite complex.

@cgiradkar cgiradkar force-pushed the Issue_15588 branch 2 times, most recently from faa3052 to ddb13ad Compare September 18, 2023 10:10
test/system/272-system-connection.bats Outdated Show resolved Hide resolved
test/system/272-system-connection.bats Outdated Show resolved Hide resolved
cmd/podman/root.go Outdated Show resolved Hide resolved
@mheon
Copy link
Member

mheon commented Sep 18, 2023

Your test seems to be failing.

@cgiradkar
Copy link
Contributor Author

Have refactored the method setupRemoteConnection and split into 2 parts for populating the rootflags method.
The original method had a switch block which when split, created some complications, hence used a boolean flag to prevent the fallthrough. Any suggestion to make the code more readable is welcome!

cmd/podman/root.go Outdated Show resolved Hide resolved
cmd/podman/root.go Outdated Show resolved Hide resolved
cmd/podman/root.go Outdated Show resolved Hide resolved
test/system/272-system-connection.bats Outdated Show resolved Hide resolved
@cgiradkar cgiradkar force-pushed the Issue_15588 branch 4 times, most recently from d26a0de to e196109 Compare September 19, 2023 15:49
cli flags couldn't override the active-destination when env variables were set. As a remedy, the precedence of cli flags has been changed.

Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 20, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgiradkar, Luap99

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 20, 2023
@cgiradkar cgiradkar marked this pull request as ready for review September 20, 2023 12:22
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 20, 2023
@rhatdan
Copy link
Member

rhatdan commented Sep 20, 2023

/lgtm
Nice work @cgiradkar

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 20, 2023
@openshift-merge-robot openshift-merge-robot merged commit 8f17ac5 into containers:main Sep 20, 2023
@cgiradkar cgiradkar deleted the Issue_15588 branch September 20, 2023 13:05
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Dec 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CONTAINER_HOST takes precedence over --connection argument
6 participants