-
Notifications
You must be signed in to change notification settings - Fork 70
fix: honor --s3-root-uri and --conflict-resolution in attachment CLI #1292
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
base: mainline
Are you sure you want to change the base?
Changes from all commits
715b871
ce70fcd
fa3bbe8
1eea755
0a2af63
1dfb445
e937dd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,10 +128,16 @@ def attachment_download( | |
| queue_id=queue_id, | ||
| session=boto3_session, | ||
| ).jobAttachmentSettings | ||
| if not s3_settings: | ||
| raise MissingJobAttachmentSettingsError(f"Queue {queue_id} has no attachment settings") | ||
|
|
||
| s3_root_uri = s3_settings.to_s3_root_uri() | ||
| # Only fall back to the queue's S3 settings when the caller did not provide an | ||
| # explicit --s3-root-uri. An explicitly-supplied value must always be honored, | ||
| # even when the queue has no attachment settings of its own. | ||
| if not s3_root_uri: | ||
| if not s3_settings: | ||
| raise MissingJobAttachmentSettingsError( | ||
| f"Queue {queue_id} has no attachment settings" | ||
| ) | ||
| s3_root_uri = s3_settings.to_s3_root_uri() | ||
|
crowecawcaw marked this conversation as resolved.
|
||
|
|
||
| deadline_client = get_session_client(boto3_session, "deadline", region=region) | ||
| boto3_session = api.get_queue_user_boto3_session(deadline=deadline_client, config=config) | ||
|
|
@@ -240,10 +246,16 @@ def attachment_upload( | |
| queue_id=queue_id, | ||
| session=boto3_session, | ||
| ).jobAttachmentSettings | ||
| if not s3_settings: | ||
| raise MissingJobAttachmentSettingsError(f"Queue {queue_id} has no attachment settings") | ||
|
|
||
| s3_root_uri = s3_settings.to_s3_root_uri() | ||
| # Only fall back to the queue's S3 settings when the caller did not provide an | ||
| # explicit --s3-root-uri. An explicitly-supplied value must always be honored, | ||
| # even when the queue has no attachment settings of its own. | ||
| if not s3_root_uri: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as in |
||
| if not s3_settings: | ||
| raise MissingJobAttachmentSettingsError( | ||
| f"Queue {queue_id} has no attachment settings" | ||
| ) | ||
| s3_root_uri = s3_settings.to_s3_root_uri() | ||
|
crowecawcaw marked this conversation as resolved.
|
||
|
|
||
| deadline_client = get_session_client(boto3_session, "deadline", region=region) | ||
| boto3_session = api.get_queue_user_boto3_session(deadline=deadline_client, config=config) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new comment says an explicit
--s3-root-urimust be honored "even when the queue has no attachment settings of its own", butget_queue(...)(lines 126-130) is still called unconditionally before this check. So when a caller supplies--s3-root-uriprecisely to operate without relying on queue settings, they still incur aGetQueuecall — and if that call fails (e.g.AccessDenied, or the queue does not exist), the command errors out before ever reaching this branch, defeating the intent. Consider moving theget_queue(...)lookup inside theif not s3_root_uri:block so it is only performed when the fallback is actually needed.