Skip to content

Commit

Permalink
Add logging and rework the secret file comparison to work on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario committed Sep 14, 2022
1 parent b83f4cf commit 7107f57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion flytekit/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
from flytekit.configuration import internal as _internal
from flytekit.configuration.default_images import DefaultImages
from flytekit.configuration.file import ConfigEntry, ConfigFile, get_config_file, read_file_if_exists, set_if_exists
from flytekit.loggers import logger

PROJECT_PLACEHOLDER = "{{ registration.project }}"
DOMAIN_PLACEHOLDER = "{{ registration.domain }}"
Expand Down Expand Up @@ -340,7 +341,7 @@ def auto(cls, config_file: typing.Optional[typing.Union[str, ConfigFile]] = None
_internal.Credentials.CLIENT_CREDENTIALS_SECRET_LOCATION.read(config_file)
)
if client_credentials_secret and client_credentials_secret.endswith("\n"):
# TODO Add logging
logger.info("Newline stripped from client secret")
client_credentials_secret = client_credentials_secret.strip()
kwargs = set_if_exists(
kwargs,
Expand Down
3 changes: 2 additions & 1 deletion tests/flytekit/unit/configuration/test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ def test_client_secret_location():

# Assert secret contains a newline
with open(cfg._yaml_config["admin"]["clientSecretLocation"], "rb") as f:
assert f.read() == b"hello\n"
assert f.read().decode().endswith("\n") is True

# Assert that secret in platform config does not contain a newline
platform_cfg = PlatformConfig.auto(cfg)
assert platform_cfg.client_credentials_secret == "hello"

Expand Down

0 comments on commit 7107f57

Please sign in to comment.