-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to
oc whoami
that prints server url
Fixes #11148 Currently there is no "simple" way to obtain the rest api's URL. This patch adds an option `--show-server-url` || `-u` to `oc whoami` that retrieves the server url from the first cluster in `config.Cluster` **Before** ``` $ oc config view --minify -o jsonpath='{.clusters[*].cluster.server}' https://10.13.137.149:8443% # no linebreak at the end ``` **After** ``` $ oc whoami -u # or --show-server-url https://10.13.137.149:8443 ```
- Loading branch information
1 parent
8b46157
commit 341f89a
Showing
8 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh" | ||
trap os::test::junit::reconcile_output EXIT | ||
|
||
# Cleanup cluster resources created by this test | ||
( | ||
set +e | ||
oc delete all,templates --all | ||
exit 0 | ||
) &>/dev/null | ||
|
||
|
||
os::test::junit::declare_suite_start "cmd/whoami" | ||
# This test validates the whoami command's --show-server flag | ||
os::cmd::expect_success_and_text 'oc whoami --show-server' 'http(s)?:\/\/[0-9\.]+\:[0-9]+' | ||
|
||
echo "whoami: ok" | ||
os::test::junit::declare_suite_end |