Skip to content

Commit 67df7b1

Browse files
More readable permission warning message (#1856)
Improved config permissions warning message
1 parent 4861887 commit 67df7b1

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

DESCRIPTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1818
- Added support for connecting using an existing connection via the session and master token.
1919
- Added support for connecting to Snowflake by authenticating with multiple SAML IDP using external browser.
2020
- Fixed compilation issue due to missing cstdint header on gcc13.
21+
- Improved config permissions warning message.
2122

2223
- v3.6.0(December 09,2023)
2324

src/snowflake/connector/config_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def read_config(
336336
):
337337
# for non-Windows, suggest change to 0600 permissions.
338338
chmod_message = (
339-
f". To change owner, run `chown $USER {str(filep)}`. To restrict permissions, run `chmod 0600 {str(filep)}`."
339+
f'.\n * To change owner, run `chown $USER "{str(filep)}"`.\n * To restrict permissions, run `chmod 0600 "{str(filep)}"`.\n'
340340
if not IS_WINDOWS
341341
else ""
342342
)

test/unit/test_configmanager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def test_warn_config_file_owner(tmp_path, monkeypatch):
561561
assert (
562562
str(c[0].message)
563563
== f"Bad owner or permissions on {str(c_file)}"
564-
+ f". To change owner, run `chown $USER {str(c_file)}`. To restrict permissions, run `chmod 0600 {str(c_file)}`."
564+
+ f'.\n * To change owner, run `chown $USER "{str(c_file)}"`.\n * To restrict permissions, run `chmod 0600 "{str(c_file)}"`.\n'
565565
)
566566

567567

@@ -581,7 +581,7 @@ def test_warn_config_file_permissions(tmp_path):
581581
assert c1["b"] is True
582582
assert len(c) == 1
583583
chmod_message = (
584-
f". To change owner, run `chown $USER {str(c_file)}`. To restrict permissions, run `chmod 0600 {str(c_file)}`."
584+
f'.\n * To change owner, run `chown $USER "{str(c_file)}"`.\n * To restrict permissions, run `chmod 0600 "{str(c_file)}"`.\n'
585585
if not IS_WINDOWS
586586
else ""
587587
)

0 commit comments

Comments
 (0)