Skip to content

Commit

Permalink
add password strip
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor committed Sep 14, 2022
1 parent 2ccaed7 commit e443a50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flytekit/configuration/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ def read_file_if_exists(filename: typing.Optional[str], encoding=None) -> typing

filename = pathlib.Path(filename)
logger.debug(f"Reading file contents from [{filename}] with current directory [{os.getcwd()}].")
return filename.read_text(encoding=encoding)
return filename.read_text(encoding=encoding).strip()
4 changes: 4 additions & 0 deletions tests/flytekit/unit/configuration/test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def test_read_file_if_exists():
assert read_file_if_exists(None) is None
assert read_file_if_exists("") is None

bad_config_fn = os.path.join(os.path.dirname(os.path.realpath(__file__)), "configs/bad.config")
first_line = read_file_if_exists(filename=bad_config_fn)
assert not first_line.endswith("\n")


def test_command():
cfg = get_config_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), "configs/good.config"))
Expand Down

0 comments on commit e443a50

Please sign in to comment.