alibaba / alibaba/acm-sdk-python

Bug in AcmClient with ram_role_name as auth

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
59
Forks
26
PR merge metrics
No merged PRs in 30d

Description

When I'm trying to do following:

```
import acm

ENDPOINT = ''
NAMESPACE = ''
RAM_ROLE = ''
DATA_ID = ''
GROUP = ''

c = acm.ACMClient(ENDPOINT, NAMESPACE, AK, SK)
c.set_options(kms_enabled=True, region_id="cn-beijing")
print(c.get(DATA_ID, GROUP))
```

I get following error:
```
print(c.get(DATA_ID, GROUP))
File "/usr/local/lib/python3.8/dist-packages/acm/client.py", line 397, in get
return self.decrypt(content)
File "/usr/local/lib/python3.8/dist-packages/acm/client.py", line 897, in decrypt
resp = json.loads(self.kms_client.do_action_with_exception(req).decode("utf8"))
File "/usr/local/lib/python3.8/dist-packages/aliyunsdkcore/client.py", line 473, in do_action_with_exception
status, headers, body, exception = self._implementation_of_do_action(acs_request)
File "/usr/local/lib/python3.8/dist-packages/aliyunsdkcore/client.py", line 308, in _implementation_of_do_action
return self._handle_retry_and_timeout(endpoint, request, signer)
File "/usr/local/lib/python3.8/dist-packages/aliyunsdkcore/client.py", line 376, in _handle_retry_and_timeout
status, headers, body, exception = self._handle_single_request(endpoint,
File "/usr/local/lib/python3.8/dist-packages/aliyunsdkcore/client.py", line 398, in _handle_single_request
http_response = self._make_http_response(endpoint, request, read_timeout, connect_timeout,
File "/usr/local/lib/python3.8/dist-packages/aliyunsdkcore/client.py", line 264, in _make_http_response
header, url = signer.sign(self._region_id, request)
File "/usr/local/lib/python3.8/dist-packages/aliyunsdkcore/auth/signers/ecs_ram_role_signer.py", line 42, in sign
self._check_session_credential()
File "/usr/local/lib/python3.8/dist-packages/acm/client.py", line 74, in _check_session_credential_patch
expiration = self._expiration if isinstance(self._expiration, (float, int)) \
AttributeError: 'EcsRamRoleSigner' object has no attribute '_expiration'
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in acm/client.py at get(), decrypt(), and _check_session_credential_patch(), then compare the expected credential state with the EcsRamRoleSigner traceback. Reproduce the shown ACMClient configuration with kms_enabled and region_id set; done means RAM-role authentication no longer raises the missing _expiration AttributeError during get().

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.