oracle / oracle/oci-python-sdk
Allow `signer=None` in client initializations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 474
- Forks
- 321
- Avg merge
- 23m
- Merged PRs (30d)
- 4
Description
The client initialization code assumes that, if signer appears in the keyword arguments, then it's a valid signer.
This prevents the use of a generic setup that either allows a config or a signer to be passed.
For example, this code does not work with the current version:
if USE_INSTANCE_PRINCIPAL:
config = {}
signer = oci.auth.signers.InstancePrincipalsSecurityTokenSigner()
else:
config = oci.config.from_file()
signer = None
identity = oci.identity.IdentityClient(config=config, signer=signer)
Instead, you have to duplicate the initialization for signer based on the code that exists in each of the client class initializers.
else:
config = oci.config.from_file()
signer = oci.Signer(
tenancy=config["tenancy"],
user=config["user"],
fingerprint=config["fingerprint"],
private_key_file_location=config.get("key_file"),
pass_phrase=oci.config.get_config_value_or_default(config, "pass_phrase"),
private_key_content=config.get("key_content"),
)
Which is fine, until Signer changes in a future version of the SDK and this breaks. Plus, code duplication should never be required :(
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the client class initializers and the IdentityClient initialization shown in the issue, then trace how config and signer are validated. Confirm the intended behavior for signer=None across client initializations and add coverage showing that both signer-based and config-based setup continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authentication, backend, cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100