URL: https://github.com/freeipa/freeipa/pull/701 Author: neffs Title: #701: ipa help doesn't always work Action: synchronized
To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/701/head:pr701 git checkout pr701
From a806f26fca0eb1529dc1a1de0b5e5deac6409588 Mon Sep 17 00:00:00 2001 From: David Kreitschmann <da...@kreitschmann.de> Date: Fri, 7 Apr 2017 18:22:25 +0200 Subject: [PATCH 1/2] Store help in Schema before writing to disk Signed-off-by: David Kreitschmann <da...@kreitschmann.de> --- ipaclient/remote_plugins/schema.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py index 3ecd608f96..9b6668d263 100644 --- a/ipaclient/remote_plugins/schema.py +++ b/ipaclient/remote_plugins/schema.py @@ -383,6 +383,7 @@ def __init__(self, client, fingerprint=None): if fingerprint is None: fingerprint, ttl = self._fetch(client, ignore_cache=read_failed) + self._help = self._generate_help(self._dict) try: self._write_schema(fingerprint) except Exception as e: @@ -498,7 +499,7 @@ def _write_schema_data(self, fileobj): schema.writestr( '_help', - json.dumps(self._generate_help(self._dict)).encode('utf-8') + json.dumps(self._help).encode('utf-8') ) def read_namespace_member(self, namespace, member): From 567f02ad3695ccb3a6399cbf4157f4c076645c53 Mon Sep 17 00:00:00 2001 From: David Kreitschmann <da...@kreitschmann.de> Date: Fri, 9 Jun 2017 17:59:35 +0200 Subject: [PATCH 2/2] Fix pylint error in get_help function --- ipaclient/remote_plugins/schema.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py index 9b6668d263..6445d7b165 100644 --- a/ipaclient/remote_plugins/schema.py +++ b/ipaclient/remote_plugins/schema.py @@ -515,8 +515,9 @@ def iter_namespace(self, namespace): return iter(self._dict[namespace]) def get_help(self, namespace, member): - if isinstance(self._help, bytes): - self._help = json.loads(self._help.decode('utf-8')) + value = self._help + if isinstance(value, bytes): + self._help = json.loads(value.decode('utf-8')) return self._help[namespace][member]
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org