Skip to content

Commit

Permalink
feat: Update vfolder CLI cmd to support unmanaged vfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Feb 10, 2025
1 parent 9d78a05 commit 40f8e7d
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions src/ai/backend/client/cli/vfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def list_allowed_types():
@click.option(
"--unmanaged",
"host_path",
is_flag=True,
metavar="HOST_PATH",
type=str,
default=None,
help=(
"Treats HOST as a mount point of unmanaged virtual folder. "
"Map a given host path to a virtual folder. "
"This option can only be used by Admin or Superadmin."
),
)
Expand Down Expand Up @@ -124,24 +126,15 @@ def create(name, host, group, host_path, usage_mode, permission, cloneable):
"""
with Session() as session:
try:
if host_path:
result = session.VFolder.create(
name=name,
unmanaged_path=host,
group=group,
usage_mode=usage_mode,
permission=permission,
cloneable=cloneable,
)
else:
result = session.VFolder.create(
name=name,
host=host,
group=group,
usage_mode=usage_mode,
permission=permission,
cloneable=cloneable,
)
result = session.VFolder.create(
name=name,
host=host,
unmanaged_path=host_path,
group=group,
usage_mode=usage_mode,
permission=permission,
cloneable=cloneable,
)
print('Virtual folder "{0}" is created.'.format(result["name"]))
except Exception as e:
print_error(e)
Expand Down

0 comments on commit 40f8e7d

Please sign in to comment.