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 remove only salt-client if this is a server #1331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jordimassaguerpla
Copy link
Contributor

What does this PR change?

Only remove only salt-client if this is a server.

Otherwise, remove all salt packages.

This reverts commit 59104d3 and adds a "is server" case.

Otherwise, remove all salt packages.

This reverts commit 59104d3 and adds a
"is server" case.

s

Signed-off-by: Jordi Massaguer Pla <jmassaguerpla@suse.de>
@jordimassaguerpla jordimassaguerpla requested a review from meaksh June 14, 2023 11:39
elif [[ "$INSTALLER" == "apt" ]]; then
apt-get --yes purge salt-common > /dev/null 2>&1 ||:
if [[ "$SERVER" == "true" ]];then
apt-get --yes purge salt-client > /dev/null 2>&1 ||:
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be salt-minion here, right?

Suggested change
apt-get --yes purge salt-client > /dev/null 2>&1 ||:
apt-get --yes purge salt-minion > /dev/null 2>&1 ||:

@@ -14,6 +14,17 @@ fi

# Nothing to do in case "install_salt_bundle" grain is not true
INSTALL_SALT_BUNDLE=$(${SALT_CALL} --local --log-level=quiet --output=txt grains.get install_salt_bundle)
SERVER=false
ROLES=$(${SALT_CALL} --local --log-level=quiet --output=txt grains.get roles)
if [[ "${ROLES}" == "local: ['server']" ]];then
Copy link
Member

Choose a reason for hiding this comment

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

The roles variable is a actually a list, so in principle it could accept multiple values and therefore this comparision would fail.

Maybe something like:

Suggested change
if [[ "${ROLES}" == "local: ['server']" ]];then
if [[ "${ROLES}" == *"'server'"* ]];then

What do you think?

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.

2 participants