-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Storage: Track deleted labels; make Bucket.patch() send them. #3737
Conversation
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
Grumble grumble grumble @googlebot. |
#3715 merged, so you can rebase to appease googlebot. |
Turns out some properties (i.e., 'labels', see googleapis#3711) behave differently under 'patch semantics'[1], which makes 'update' useful. [1] https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance#patch
be2c87e
to
aec63b5
Compare
Done, just need a review (and to fix CI). |
``client`` stored on the current object. | ||
""" | ||
answer = super(Bucket, self).update(client=client) | ||
self._label_removals.clear() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
storage/tests/unit/test_bucket.py
Outdated
_, _, kwargs = client._connection.api_request.mock_calls[0] | ||
self.assertEqual(len(kwargs['data']['labels']), 2) | ||
self.assertEqual(kwargs['data']['labels']['color'], 'red') | ||
self.assertEqual(kwargs['data']['labels']['flavor'], 'cherry') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thanks for catching that @tseaver. Updates made. |
@@ -126,6 +126,8 @@ def _set_properties(self, value): | |||
self._properties = value | |||
# If the values are reset, the changes must as well. | |||
self._changes = set() | |||
if hasattr(self, '_label_removals'): | |||
self._label_removals.clear() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@tseaver @jonparrott Can someone give this a final signoff so I can merge it? :-) |
Uses #3715 as a base.
This PR adds tracking for deleted labels on the
Bucket
object, and causes the appropriate data to be sent whenBucket.patch
is called.Fixes #3711.