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

libpod: fix /etc/hostname with --uts=host #20545

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

giuseppe
Copy link
Member

when --uts=host is provided, the expectation is to use the hostname from the host not the container name.

Closes: #20448

Does this PR introduce a user-facing change?

Now --uts=host --net=host fills /etc/hostname with the host's name

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 31, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

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 Oct 31, 2023
@rhatdan
Copy link
Member

rhatdan commented Oct 31, 2023

LGTM

Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

LGTM with a few nits, none of them worth a repush on their own

skip_if_remote "cannot check 'uname -n' on remote"
hostname=`uname -n`
run_podman run --rm --uts=host $IMAGE cat /etc/hostname
assert "$output" = $hostname "/etc/hostname must contain 'uname -n'"
Copy link
Member

Choose a reason for hiding this comment

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

Failure comment is a little misleading: it's not "contain", it's "be" or "equal".

Also, it's good practice to make failure comments unique. That way a monkey like me, seeing a failure message, can grep for it in the source and find exactly one hit. If there are two hits, monkeys get confused. Perhaps something like this:

    ... "/etc/hostname with --uts=host"
....
    ... "/etc/hostname with --net=host and --uts=host"

@@ -911,4 +911,15 @@ EOF
run_podman network rm $net1
}

# Issue #20448 - /etc/hostname with --uts=host must show "uname -n"
@test "podman --uts=host must use 'uname -n' for /etc/hostname" {
skip_if_remote "cannot check 'uname -n' on remote"
Copy link
Member

Choose a reason for hiding this comment

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

run_podman info --format '{{.Host.Hostname}}' ?

when --uts=host is provided, the expectation is to use the hostname
from the host not the container name.

Closes: containers#20448

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe giuseppe force-pushed the fix-hostname-with-host-uts branch from 9bed293 to b332ca7 Compare October 31, 2023 12:02
@giuseppe
Copy link
Member Author

@edsantiago thanks for the hints, I think they are worth a re-push

@rhatdan
Copy link
Member

rhatdan commented Oct 31, 2023

/lgtm
/hold

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Oct 31, 2023
@edsantiago
Copy link
Member

LGTM2

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 31, 2023
@openshift-ci openshift-ci bot merged commit 2972f59 into containers:main Oct 31, 2023
99 of 100 checks passed
@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 Jan 30, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2024
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.

Providing both --uts=host and --network=host results in unexpected /etc/hostname
3 participants