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(job_attachments)!: Add OS-specific FileSystemPermissionSettings classes #41

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

gahyusuh
Copy link
Contributor

What was the problem/requirement? (What/Why)

In the PR from the worker-agent side: aws-deadline/deadline-cloud-worker-agent#26, there was a concern raised about the lack of consideration for Windows compatibility when handling file ownership/permissions for job attachment-owned files. To address this, we need to introduce OS-specific FileSystemPermissionSettings classes to accommodate Windows support.

What was the solution? (How)

  • Separates the FileSystemPermissionSettings class into two distinct types - one for Posix, and one for Windows to better accommodate OS-specific permission handling. So, added two new classes:
    • PosixFileSystemPermissionSettings: it is actually identical to the previous FileSystemPermissionSettings class, with the name being the only change to explicitly indicate the OS, Posix.
    • WindowsFileSystemPermissionSettings: A placeholder class for Windows. Will be implemented in a follow-up PR.
  • The FileSystemPermissionSettings is now the Union type of those two classes.
  • When changing the file ownership/permissions, internally checks what kind of permission settings it is using isinstance() checks.

What is the impact of this change?

Better accommodation for OS-specific (file) permission handling

How was this change tested?

  • Ran unit tests: hatch run lint && hatch run test
  • Ran integ tests: hatch run integ:test
  • Ran docker-based tests: hatch run test_docker
  • Run an end-to-end test (submitting a non-rendering job bundle --> running a CMF against my local backend) ensuring that there were no issues/errors in the flow.

Was this change documented?

No.

Is this a breaking change?

Yes!

@gahyusuh gahyusuh requested a review from a team as a code owner September 14, 2023 20:08
@gahyusuh gahyusuh force-pushed the gahyusuh/add_fs_permission_settings_types branch 4 times, most recently from 7ac3f4e to f9ba8b0 Compare September 14, 2023 21:19
@ddneilson ddneilson self-requested a review September 15, 2023 14:27
"""
if os.name == "posix":
if not isinstance(fs_permission_settings, PosixFileSystemPermissionSettings):
raise ValueError(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: TypeError may be more appropriate

@gahyusuh gahyusuh force-pushed the gahyusuh/add_fs_permission_settings_types branch from f9ba8b0 to 91aa63c Compare September 15, 2023 15:10
…classes

BREAKING CHANGE:
- Separates the `FileSystemPermissionSettings` class into two distinct types - one for Posix, and one for Windows to better accommodate OS-specific permission handling. So, added two new classes:
  - `PosixFileSystemPermissionSettings`: it is actually identical to the previous FileSystemPermissionSettings class, with the name being the only change to explicitly indicate the OS, Posix.
  - `WindowsFileSystemPermissionSettings`: A placeholder class for Windows. Will be implemented in a follow-up PR.
- The `FileSystemPermissionSettings` is now the Union type of those two classes.
- When changing the file ownership/permissions, internally checks what kind of permission settings it is using `isinstance()` checks.

Signed-off-by: Gahyun Suh <[email protected]>
@gahyusuh gahyusuh force-pushed the gahyusuh/add_fs_permission_settings_types branch from 91aa63c to 338e525 Compare September 15, 2023 15:23
@gahyusuh gahyusuh merged commit a122840 into mainline Sep 15, 2023
@gahyusuh gahyusuh deleted the gahyusuh/add_fs_permission_settings_types branch September 15, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants