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

feat(deployment): adds support for host subpath uid/gid/perm #75

Merged
merged 1 commit into from
Feb 27, 2024
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
27 changes: 24 additions & 3 deletions rapyuta_io/clients/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,29 +875,50 @@ class ExecutableMount(object):
:vartype mount_path: str
:ivar sub_path: Subpath of the executable
:vartype sub_path: str
:ivar uid: Userid to which subpath belongs to
:vartype uid: int
:ivar gid: Groupid to which subpath belongs to
:vartype gid: int
:ivar perm: Permissions for subpath
:vartype perm: int

:param exec_name: Name of the executable.
:type exec_name: str
:param mount_path: Mountpath of the executable
:type mount_path: str
:param sub_path: Subpath of the executable
:type sub_path: str
:param uid: userid of subpath
:type uid: int
:param gid: groupid of subpath
:type gid: int
:param perm: permissions of subpath
:type perm: int
"""

def __init__(self, exec_name, mount_path, sub_path=None):
self.validate(exec_name, mount_path, sub_path)
def __init__(self, exec_name, mount_path, sub_path=None, uid=None, gid=None, perm=None):
ankitrgadiya marked this conversation as resolved.
Show resolved Hide resolved
self.validate(exec_name, mount_path, sub_path, uid, gid, perm)
self.exec_name = exec_name
self.mount_path = mount_path
self.sub_path = sub_path
self.uid = uid
self.gid = gid
self.perm = perm

@staticmethod
def validate(exec_name, mount_path, sub_path=None):
def validate(exec_name, mount_path, sub_path=None, uid=None, gid=None, perm=None):
if not isinstance(exec_name, six.string_types):
raise InvalidParameterException('exec_name must be a non-empty string')
if not isinstance(mount_path, six.string_types):
raise InvalidParameterException('mount_path must be a non-empty string')
if sub_path is not None and not isinstance(sub_path, six.string_types):
raise InvalidParameterException('sub_path must be a non-empty string')
if uid is not None and not isinstance(uid, six.integer_types):
raise InvalidParameterException('uid must be a non-empty integer')
if gid is not None and not isinstance(gid, six.integer_types):
raise InvalidParameterException('gid must be a non-empty integer')
if perm is not None and not isinstance(perm, six.integer_types):
raise InvalidParameterException('perm must be a non-empty integer')


class RestartPolicy(str, enum.Enum):
Expand Down
Loading