Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit be02793

Browse files
authored
Merge pull request #37 from sserrata/credentials-permissions
Set permissions on creation of credentials file
2 parents 1002569 + 7c4a737 commit be02793

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pancloud/credentials.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ def __init__(self, auth_base_url=None, client_id=None, client_secret=None,
7979
self.token_lock = Lock()
8080
self.token_url = token_url or TOKEN_URL
8181
self.token_revoke_url = token_revoke_url or REVOKE_URL
82-
if not os.path.exists(os.path.join(
83-
os.path.expanduser('~'), '.config')
84-
):
85-
os.mkdir(os.path.join(os.path.expanduser('~'), '.config'))
8682
if not os.path.exists(os.path.dirname(self.path)):
87-
os.mkdir(os.path.dirname(self.path))
83+
try:
84+
os.makedirs(os.path.dirname(self.path), 0o700)
85+
except OSError as e:
86+
raise PanCloudError("{}".format(e))
8887
self.db = TinyDB(self.path, sort_keys=True, indent=4,
8988
default_table='profiles')
9089
self.query = Query()

0 commit comments

Comments
 (0)