| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| client = self._require_client(client) | ||
| path = '%s:setIamPolicy' % (self.path,) | ||
| resource = policy.to_api_repr() | ||
| # 'set_iam_policy' API requires an extra wrapper. :( |
|
Mostly looks fine though we should resolve the 503s before I gave an LGTM. Assigned to @tmatsuo for now. |
Sorry, something went wrong.
|
Which test and API are repeatedly failing? Any logs? Detailed message? Does it always fail or sometimes succeed? Can you show the retry code? |
Sorry, something went wrong.
|
@tmatsuo the new system tests being added in this PR fail with 503s at the following points.
Wrapping the set_iam_policy calls with retry logic didn't help, so I removed it. |
Sorry, something went wrong.
|
Does it always fail? If so, is it possible to show the actual JSON request? |
Sorry, something went wrong.
|
@tmatsuo Just before the projects.topics.setIamPolicy API call: (Pdb) l
298 """
299 client = self._require_client(client)
300 path = '%s:setIamPolicy' % (self.path,)
301 resource = policy.to_api_repr()
302 wrapped = {'policy': resource}
303 -> resp = client.connection.api_request(
304 method='POST', path=path, data=wrapped)
305 return Policy.from_api_repr(resp)
(pdb) pp path
u'/projects/citric-celerity-697/topics/test-iam-policy-topic1459191212607:setIamPolicy'
(Pdb) pp wrapped
{'policy': {'bindings': [{'members': ['user:jgeewax@google.com'],
'role': 'roles/reader'}],
'etag': u'ACAB'}}At the return: (Pdb) pp response
{'-content-encoding': 'gzip',
'alt-svc': 'quic=":443"; ma=2592000; v="31,30,29,28,27,26,25"',
'alternate-protocol': '443:quic,p=1',
'cache-control': 'private',
'content-length': '162',
'content-type': 'application/json; charset=UTF-8',
'date': 'Mon, 28 Mar 2016 18:55:54 GMT',
'server': 'ESF',
'status': '503',
'transfer-encoding': 'chunked',
'vary': 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '1; mode=block'}
(Pdb) pp content
'{\n "error": {\n "code": 503,\n "message": "The service was unable to fulfill your request. Please try again. [code=8a75]",\n "status": "UNAVAILABLE"\n }\n}\n'
(Pdb) pp url
'https://pubsub.googleapis.com/v1/projects/citric-celerity-697/topics/test-iam-policy-topic1459191212607:setIamPolicy' |
Sorry, something went wrong.
|
@tmatsuo the projects.subscriptions.getIamPolicy call is now repeatable returning a 404 (waiting is not helping): gcloud.exceptions.NotFound: 404 Resource not found (resource=test-iam-policy-sub-1459192208068). (GET https://pubsub.googleapis.com/v1/projects/citric-celerity-697/subscriptions/test-iam-policy-sub-1459192208068:getIamPolicy) |
Sorry, something went wrong.
|
According to https://cloud.google.com/pubsub/access_control I don't think roles/reader is a valid role. Can you try it with roles/viewer or roles/pubsub.viewer ? |
Sorry, something went wrong.
|
@tmatsuo After updating the role strings, I'm still getting the 503 from projects.topics.setIamPolicy. I have checked that the payload for the request now has the correct role: -> resp = client.connection.api_request(
(Pdb) pp wrapped
{'policy': {'bindings': [{'members': ['user:jgeewax@google.com'],
'role': 'roles/viewer'}],
'etag': u'ACAB'}}
FWIW: A 503 is a terrible status code for "you gave me bad data"; that status is supposed to mean "my backend went away unexpectedly, try again later." A better status would be a 40x (probably just 400 "Bad Request"). |
Sorry, something went wrong.
|
Indeed, the HTTP status code is terrible. I think the product team is working on it. Maybe I found out the cause. I suspect the account jgeewax@google.com doesn't exist. Can you try using an existing account like tmatsuo@google.com? |
Sorry, something went wrong.
|
@tmatsuo Indeed, fixing the e-mail address makes the setIamPolicy calls succeed. Now I just need to figure out why the teardown code blows up for the subscription case. |
Sorry, something went wrong.
Sorry, something went wrong.
| policy.owners = members | ||
| elif role == WRITER_ROLE: | ||
| elif role == EDITOR_ROLE: | ||
| policy.writers = members |
| policy = topic.get_iam_policy() | ||
| policy.readers.add(policy.user('jjg@google.com')) | ||
| new_policy = topic.set_iam_policy(policy) | ||
| self.assertEqual(new_policy.readers, policy.readers) |
Improve correspondence w/ role names used by pubsub. Addresses: #1654 (comment) #1654 (comment).
|
LGTM |
Sorry, something went wrong.
* chore(deps): update all dependencies * revert * allow newer versions of libcst --------- Co-authored-by: Anthonios Partheniou <partheniou@google.com>
…upload (#1654) feat: send entire object checksum in the final api call of resumable upload fixes b/461994245 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [3.7.0](googleapis/python-storage@v3.6.0...v3.7.0) (2025-12-09) ### Features * Auto enable mTLS when supported certificates are detected ([#1637](googleapis/python-storage#1637)) ([4e91c54](googleapis/python-storage@4e91c54)) * Send entire object checksum in the final api call of resumable upload ([#1654](googleapis/python-storage#1654)) ([ddce7e5](googleapis/python-storage@ddce7e5)) * Support urllib3 >= 2.6.0 ([#1658](googleapis/python-storage#1658)) ([57405e9](googleapis/python-storage@57405e9)) ### Bug Fixes * **bucket:** Move blob fails when the new blob name contains characters that need to be url encoded ([#1605](googleapis/python-storage#1605)) ([ec470a2](googleapis/python-storage@ec470a2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Chandra Shekhar Sirimala <chandrasiri@google.com>
| Back | FazBrowse Home | New Git URL |
The tests uncover a wart in the API: setIamPermissions takes an extra wrapper element (policy) around the actual Policy resource. I don't know where to report that issue.
The new system tests fail repeatedly for my system account with 503s: adding retries (interspersed with time.sleep(1)) doesn't seem to help. @tmatsuo can you comment? (Note that I have made that account an owner of my project).