diff options
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r-- | ipaserver/plugins/schema.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py index d6cf31f9a..df3bff1d0 100644 --- a/ipaserver/plugins/schema.py +++ b/ipaserver/plugins/schema.py @@ -729,7 +729,7 @@ class schema(Command): return fingerprint.hexdigest()[:8] - def execute(self, *args, **kwargs): + def _generate_schema(self, **kwargs): commands = list(self.api.Object.command.search(**kwargs)) for command in commands: name = command['name'] @@ -750,9 +750,17 @@ class schema(Command): schema['commands'] = commands schema['classes'] = classes schema['topics'] = topics + schema['fingerprint'] = self._calculate_fingerprint(schema) + + return schema + + def execute(self, *args, **kwargs): + try: + schema = self.api._schema + except AttributeError: + schema = self._generate_schema(**kwargs) + setattr(self.api, '_schema', schema) - schema_fp = self._calculate_fingerprint(schema) - schema['fingerprint'] = schema_fp schema['ttl'] = SCHEMA_TTL if schema['fingerprint'] in kwargs.get('known_fingerprints', []): |