Skip to content

Commit 492331f

Browse files
committed
fix: suppress label warning flag
Signed-off-by: Ganzidaeyong <[email protected]>
1 parent 35de1fa commit 492331f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/oci_cli/cli_root.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,19 @@ def check_key_for_security(auth, config_file, profile):
565565
key_file = get_key_file(config_file, profile)
566566
if cli_constants.OCI_CLI_KEY_FILE_ENV_VAR in os.environ:
567567
key_file = os.environ[cli_constants.OCI_CLI_KEY_FILE_ENV_VAR]
568-
if os.getenv('SUPPRESS_LABEL_WARNING') is None:
569-
if key_file and not validate_label_private_key(key_file):
570-
private_label_message = (
571-
f"To increase security of your API key located at {key_file}, "
572-
"append an extra line with 'OCI_API_KEY' at the end. For more information, "
573-
"refer to https://docs.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm"
574-
". To supress the warning, set the env variable SUPPRESS_LABEL_WARNING=True"
575-
)
576-
click.echo(click.style(f"Warning: {private_label_message}", fg='yellow'), err=True)
568+
569+
suppress_warning = os.getenv('SUPPRESS_LABEL_WARNING')
570+
if suppress_warning == 'True':
571+
return
572+
573+
if key_file and not validate_label_private_key(key_file):
574+
private_label_message = (
575+
f"To increase security of your API key located at {key_file}, "
576+
"append an extra line with 'OCI_API_KEY' at the end. For more information, "
577+
"refer to https://docs.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm"
578+
". To suppress the warning, set the env variable SUPPRESS_LABEL_WARNING=True"
579+
)
580+
click.echo(click.style(f"Warning: {private_label_message}", fg='yellow'), err=True)
577581

578582

579583
def validate_label_private_key(file_path):

0 commit comments

Comments
 (0)