Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ktdreyer
Copy link
Contributor

@ktdreyer ktdreyer commented Mar 6, 2025

Auto-detect the operating system identifier from /etc/os-release, so that users do not need to specify it manually.

The ibmcloud setup command applies to both RH and non-RH distros, so we don't need to check the OS there.

Auto-detect the operating system identifier from /etc/os-release, so
that users do not need to specify it manually.

The ibmcloud setup command applies to both RH and non-RH distros, so we
don't need to check the OS there.

Signed-off-by: Ken Dreyer <[email protected]>
echo "neither system 'ID' nor 'ID_LIKE' is 'fedora' - did you mean to specify a 'rh' system?"
fi
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
}
Copy link
Contributor

Choose a reason for hiding this comment

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

seems better to add a check to make sure install success...

Copy link
Member

Choose a reason for hiding this comment

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

Is that not handled by the exit code of the command still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some testing.

When the sh command fails, local-setup.sh will exit with a non-zero exit code.

When the curl command fails, sh eats the exit code of curl, so local-setup.sh still exits with 0. That is a problem that is not directly related to the changes I'm making in this PR. We could fix that with set -o pipefail at the top of this script.

(This type of thing is why I prefer other languages to Bash. There are so many gotchas like this with error handling. But I understand this particular script makes sense to keep in Bash for now.)

echo "neither system 'ID' nor 'ID_LIKE' is 'fedora' - did you mean to specify a 'rh' system?"
fi
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
}
Copy link
Member

Choose a reason for hiding this comment

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

Is that not handled by the exit code of the command still?

@mergify mergify bot added the one-approval PR has one approval from a maintainer label Mar 7, 2025
@mergify mergify bot removed the one-approval PR has one approval from a maintainer label Mar 7, 2025
@nathan-weinberg nathan-weinberg removed the request for review from courtneypacheco March 14, 2025 19:53
@mergify mergify bot merged commit feca94f into main Mar 14, 2025
8 checks passed
@mergify mergify bot deleted the local-setup-auto-os branch March 14, 2025 19:54
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.

5 participants