mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
schema: Add known_fingerprints option to schema command
When client requests schema it can list fingerprints of cached schemas and server responds with SchemaUpToDate exception specifying fingeprint of schema to use. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
034a111972
commit
4b97cabb52
@@ -695,6 +695,13 @@ class output_find(BaseParamSearch):
|
||||
class schema(Command):
|
||||
NO_CLI = True
|
||||
|
||||
takes_options = (
|
||||
Str(
|
||||
'known_fingerprints*',
|
||||
label=_("Fingerprint of schema cached by client")
|
||||
),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _calculate_fingerprint(data):
|
||||
"""
|
||||
@@ -748,4 +755,10 @@ class schema(Command):
|
||||
schema['fingerprint'] = schema_fp
|
||||
schema['ttl'] = SCHEMA_TTL
|
||||
|
||||
if schema['fingerprint'] in kwargs.get('known_fingerprints', []):
|
||||
raise errors.SchemaUpToDate(
|
||||
fingerprint=schema['fingerprint'],
|
||||
ttl=schema['ttl'],
|
||||
)
|
||||
|
||||
return dict(result=schema)
|
||||
|
||||
Reference in New Issue
Block a user