Replace get_keyring_service by KEYRING_SERVICE class variable#1209
Conversation
ryneeverett
left a comment
There was a problem hiding this comment.
Regarding the first commit -- oops! Thanks for catching this.
It isn't clear to me that an exception is justified for get_keyring_service though. Perhaps this would be a good time to eliminate the method in favor of a class property string on which Service.get_secret calls .format(config)?
|
I'm ok with removing One solution would be to use a Another solution would be to make |
|
The computed_field solution seems good. Making this a string rather than a method is the main thing I'd like to see. I'd be ok with that string moving to ServiceConfig, but I wouldn't want to see the |
a86a58a to
d459e7a
Compare
ryneeverett
left a comment
There was a problem hiding this comment.
This is a breaking change to the service API so we need to bump the version to 2.0 (LATEST_API_VERSION, API_VERSION of each service, header of api.rst). I'd also like to see backwards compatibility:
@property
def keyring_service(self) -> str:
service = get_service(self.service).API_VERSION
if service.API_VERSION < 2:
return service.get_keyring_service(self)
return self.KEYRING_SERVICE.format(**self.model_dump())|
One more thing I forgot in addition to the rebase -- please add a Changelog section to the bottom of api.rst and mention the removal of get_keyring_service and addition of KEYRING_SERVICE. |
That test was simply testing each abstract method is defined only once. Reverted to check the number of calls for each abstract method while adding an allowlist, for abstract methods we can call from concrete ones
ecaadcb to
28d38ac
Compare
Fix import of get_service after rebase
28d38ac to
464b675
Compare
3844120
into
GothenburgBitFactory:develop
First commit
Fix a test in
test_service.py: since this commit the test check each abstract method is defined only once, which does not really make sense. I changed it back to check the number of calls, while adding an allowlist for some abstract methods we do want to call from concrete methods.An alternative could be to simply remove this test, since we already have an exception
Second commit
Replace
Service.get_keyring_serviceby aServiceConfig.KEYRING_SERVICEstring