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

Only add the java.hostname on migration if not already present #479

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cbosdo
Copy link
Contributor

@cbosdo cbosdo commented Oct 25, 2024

What does this PR change?

More recent servers already have java.hostname in rhn.conf... adding it at migration would add two lines and blow when inspecting the container later at upgrade time.

Test coverage

  • No tests: Migration script is not unit tested yet: too hard to get meaningful tests

  • DONE

Links

Issue(s): uyuni-project/uyuni#8816 (comment)

  • DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Before you merge

Check How to branch and merge properly!

More recent servers already have java.hostname in rhn.conf... adding it
at migration would add two lines and blow when inspecting the container
later at upgrade time.
To avoid getting multiple results breaking the inspect data file, limit
the grep results from rhn.conf to one result.
@cbosdo cbosdo requested a review from aaannz October 30, 2024 08:16
Copy link
Contributor

@aaannz aaannz left a comment

Choose a reason for hiding this comment

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

Just one nitpick, LGTM

Comment on lines +122 to +124
if test -z "$(grep '^java.hostname *=' /etc/rhn/rhn.conf)\"; then
sed 's/server\.jabber_server/java\.hostname/' -i /etc/rhn/rhn.conf;
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think test -z is needed. Grep returns 1 if string not found.

Suggested change
if test -z "$(grep '^java.hostname *=' /etc/rhn/rhn.conf)\"; then
sed 's/server\.jabber_server/java\.hostname/' -i /etc/rhn/rhn.conf;
fi
if ! grep -q '^java.hostname *=' /etc/rhn/rhn.conf); then
sed 's/server\.jabber_server/java\.hostname/' -i /etc/rhn/rhn.conf;
fi

should be enough, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants