summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins
diff options
context:
space:
mode:
authorDavid Kupka <dkupka@redhat.com>2016-06-21 14:21:22 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-21 15:11:19 +0200
commit4b97cabb52585e9f58a2f2034ba71fd7e8d678d7 (patch)
treea3f0fd2996046e11c1b304561608288eca653121 /ipaserver/plugins
parent034a111972df7e1b2db71ea30440b36dc93e2c7b (diff)
downloadfreeipa-4b97cabb52585e9f58a2f2034ba71fd7e8d678d7.tar.gz
freeipa-4b97cabb52585e9f58a2f2034ba71fd7e8d678d7.tar.xz
freeipa-4b97cabb52585e9f58a2f2034ba71fd7e8d678d7.zip
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>
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r--ipaserver/plugins/schema.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py
index 847d8c442..d6cf31f9a 100644
--- a/ipaserver/plugins/schema.py
+++ b/ipaserver/plugins/schema.py
@@ -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)