Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] sc-32247 Fallback to use temp folder to store profile.yml #879

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions piperider_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import sys
import tempfile
import webbrowser
from datetime import datetime

Expand All @@ -11,6 +12,9 @@
from ruamel import yaml

PIPERIDER_USER_HOME = os.path.expanduser('~/.piperider')
if os.access(os.path.expanduser('~/'), os.W_OK) is False:
# If we can't create file in user home directory, fallback to use temp folder
PIPERIDER_USER_HOME = os.path.join(tempfile.gettempdir(), '.piperider')

Check warning on line 17 in piperider_cli/__init__.py

View check run for this annotation

Codecov / codecov/patch

piperider_cli/__init__.py#L17

Added line #L17 was not covered by tests
PIPERIDER_USER_PROFILE = os.path.join(PIPERIDER_USER_HOME, 'profile.yml')


Expand Down
3 changes: 1 addition & 2 deletions piperider_cli/event/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from rich.console import Console
from ruamel import yaml

from piperider_cli import PIPERIDER_USER_HOME, PIPERIDER_USER_PROFILE
from piperider_cli.event.collector import Collector

PIPERIDER_USER_HOME = os.path.expanduser('~/.piperider')
PIPERIDER_USER_PROFILE = os.path.join(PIPERIDER_USER_HOME, 'profile.yml')
PIPERIDER_USER_EVENT_PATH = os.path.join(PIPERIDER_USER_HOME, '.unsend_events.json')
PIPERIDER_FLUSH_EVENTS_WHITELIST = ['init', 'run', 'generate-report', 'compare-reports']

Expand Down
Loading