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

CSV ingest allow user override through AYON_USERNAME. #35

Merged
Merged
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
11 changes: 11 additions & 0 deletions client/ayon_traypublisher/addon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os

from pathlib import Path

import ayon_api

from ayon_core.lib import get_ayon_launcher_args
from ayon_core.lib.execute import run_detached_process
from ayon_core.addon import (
Expand Down Expand Up @@ -109,6 +112,14 @@ def ingestcsv(
"""
from .csv_publish import csvpublish

# Allow user override through AYON_USERNAME when
# current connection is made through a service user.
username = os.environ.get("AYON_USERNAME")
if username:
con = ayon_api.get_server_api_connection()
if con.is_service_user():
con.set_default_service_username(username)

# use Path to check if csv_filepath exists
if not Path(filepath).exists():
raise FileNotFoundError(f"File {filepath} does not exist.")
Expand Down