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

fix(BA-802): Set default domain name value of vfolders #3767

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions changes/3767.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Insert default `domain_name` value to vfolders
2 changes: 2 additions & 0 deletions src/ai/backend/common/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@

DEFAULT_VFOLDER_PERMISSION_MODE: Final[int] = 0o755
VFOLDER_GROUP_PERMISSION_MODE: Final[int] = 0o775

DEFAULT_DOMAIN_NAME: Final[str] = "default"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be great if the default domain name was set to a less commonly used name that's not as user-friendly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already use this as a default value. Change the default name to another should be a separate epic

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from alembic import op
from sqlalchemy.sql import text

from ai.backend.common.defs import DEFAULT_DOMAIN_NAME

# revision identifiers, used by Alembic.
revision = "d7df3baf3779"
down_revision = "5d92c9cc930c"
Expand All @@ -23,11 +25,12 @@ def upgrade():

conn.execute(
text(
"""\
f"""\
UPDATE vfolders
SET domain_name = COALESCE(
(SELECT domain_name FROM users WHERE vfolders.user = users.uuid),
(SELECT domain_name FROM groups WHERE vfolders.group = groups.id)
(SELECT domain_name FROM groups WHERE vfolders.group = groups.id),
'{DEFAULT_DOMAIN_NAME}'
)
WHERE domain_name IS NULL;
"""
Expand Down
Loading