damccorm commented on code in PR #41252:
URL: https://github.com/apache/beam/pull/41252#discussion_r4559219386


##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -110,29 +110,17 @@ def _validate_bucket_project(bucket, project_id, 
credentials=None):
   """Verifies that the GCS bucket is owned by the executing project."""
   bucket_project_number = bucket.project_number
 
-  # Skip validation if the bucket project number is a mock object
-  if (type(bucket_project_number).__name__.endswith('Mock') or
-      hasattr(bucket_project_number, '_mock_self')):
-    _LOGGER.warning(
-        'Bucket project number is a mock object. Skipping ownership 
validation.'
-    )
-    return
-
   if bucket_project_number is None:
-    _LOGGER.warning(
-        'Bucket gs://%s does not have a project number. Skipping ownership 
validation.',
-        bucket.name)
-    return
+    raise ValueError(
+        f'Bucket gs://{bucket.name} does not have a project number. '
+        'Unable to verify bucket ownership.')
 
   try:
     project_number = _get_project_number(project_id, credentials=credentials)
   except Exception as e:
-    _LOGGER.warning(
-        'Failed to resolve project number for project %s: %s. '
-        'Skipping bucket ownership validation.',
-        project_id,
-        e)
-    return
+    raise ValueError(
+        f'Failed to resolve project number for project {project_id}: {e}. '
+        'Unable to verify bucket ownership.') from e

Review Comment:
   Do we have something that we can link to that would help a user understand 
why this is now newly broken?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to