|
|
403b09 |
From bac0d7c286768a67715ca1ac1e835a272e540721 Mon Sep 17 00:00:00 2001
|
|
|
403b09 |
From: David Kupka <dkupka@redhat.com>
|
|
|
403b09 |
Date: Thu, 11 Aug 2016 14:30:00 +0200
|
|
|
403b09 |
Subject: [PATCH] client: Do not create instance just to check isinstance
|
|
|
403b09 |
|
|
|
403b09 |
Checking that classes are idenical gives the same result and
|
|
|
403b09 |
avoids unnecessary instantiation.
|
|
|
403b09 |
|
|
|
403b09 |
https://fedorahosted.org/freeipa/ticket/6048
|
|
|
403b09 |
|
|
|
403b09 |
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
|
|
|
403b09 |
---
|
|
|
403b09 |
ipaclient/plugins/automount.py | 4 ++--
|
|
|
403b09 |
ipaclient/plugins/otptoken_yubikey.py | 3 +--
|
|
|
403b09 |
ipaclient/plugins/vault.py | 16 ++++++++--------
|
|
|
403b09 |
3 files changed, 11 insertions(+), 12 deletions(-)
|
|
|
403b09 |
|
|
|
403b09 |
diff --git a/ipaclient/plugins/automount.py b/ipaclient/plugins/automount.py
|
|
|
403b09 |
index 925b635ff27411fc7e2f8c3dae17c747216d7fb6..3742705face49d02370e845e3d6e6599a34809eb 100644
|
|
|
403b09 |
--- a/ipaclient/plugins/automount.py
|
|
|
403b09 |
+++ b/ipaclient/plugins/automount.py
|
|
|
403b09 |
@@ -55,8 +55,8 @@ class _fake_automountlocation_show(Method):
|
|
|
403b09 |
class automountlocation_tofiles(MethodOverride):
|
|
|
403b09 |
@classmethod
|
|
|
403b09 |
def __NO_CLI_getter(cls):
|
|
|
403b09 |
- return isinstance(api.Command.automountlocation_show,
|
|
|
403b09 |
- _fake_automountlocation_show)
|
|
|
403b09 |
+ return (api.Command.get_plugin('automountlocation_show') is
|
|
|
403b09 |
+ _fake_automountlocation_show)
|
|
|
403b09 |
|
|
|
403b09 |
NO_CLI = classproperty(__NO_CLI_getter)
|
|
|
403b09 |
|
|
|
403b09 |
diff --git a/ipaclient/plugins/otptoken_yubikey.py b/ipaclient/plugins/otptoken_yubikey.py
|
|
|
403b09 |
index 549376a0ff65d44c5698666a84608849152368b2..1075b6d839c785b44f035050ed5c9773c66d57b7 100644
|
|
|
403b09 |
--- a/ipaclient/plugins/otptoken_yubikey.py
|
|
|
403b09 |
+++ b/ipaclient/plugins/otptoken_yubikey.py
|
|
|
403b09 |
@@ -77,8 +77,7 @@ class otptoken_add_yubikey(Command):
|
|
|
403b09 |
|
|
|
403b09 |
@classmethod
|
|
|
403b09 |
def __NO_CLI_getter(cls):
|
|
|
403b09 |
- return isinstance(api.Command.otptoken_add,
|
|
|
403b09 |
- _fake_otptoken_add)
|
|
|
403b09 |
+ return api.Command.get_plugin('otptoken_add') is _fake_otptoken_add
|
|
|
403b09 |
|
|
|
403b09 |
NO_CLI = classproperty(__NO_CLI_getter)
|
|
|
403b09 |
|
|
|
403b09 |
diff --git a/ipaclient/plugins/vault.py b/ipaclient/plugins/vault.py
|
|
|
403b09 |
index c0ded21d515fe41bde5fb0e547087cb7789aa6a3..08bbeb50f3bdc756321df9e45496e5388edd92c5 100644
|
|
|
403b09 |
--- a/ipaclient/plugins/vault.py
|
|
|
403b09 |
+++ b/ipaclient/plugins/vault.py
|
|
|
403b09 |
@@ -205,8 +205,8 @@ class vault_add(Local):
|
|
|
403b09 |
|
|
|
403b09 |
@classmethod
|
|
|
403b09 |
def __NO_CLI_getter(cls):
|
|
|
403b09 |
- return isinstance(api.Command.vault_add_internal,
|
|
|
403b09 |
- _fake_vault_add_internal)
|
|
|
403b09 |
+ return (api.Command.get_plugin('vault_add_internal') is
|
|
|
403b09 |
+ _fake_vault_add_internal)
|
|
|
403b09 |
|
|
|
403b09 |
NO_CLI = classproperty(__NO_CLI_getter)
|
|
|
403b09 |
|
|
|
403b09 |
@@ -411,8 +411,8 @@ class vault_mod(Local):
|
|
|
403b09 |
|
|
|
403b09 |
@classmethod
|
|
|
403b09 |
def __NO_CLI_getter(cls):
|
|
|
403b09 |
- return isinstance(api.Command.vault_mod_internal,
|
|
|
403b09 |
- _fake_vault_mod_internal)
|
|
|
403b09 |
+ return (api.Command.get_plugin('vault_mod_internal') is
|
|
|
403b09 |
+ _fake_vault_mod_internal)
|
|
|
403b09 |
|
|
|
403b09 |
NO_CLI = classproperty(__NO_CLI_getter)
|
|
|
403b09 |
|
|
|
403b09 |
@@ -598,8 +598,8 @@ class vault_archive(Local):
|
|
|
403b09 |
|
|
|
403b09 |
@classmethod
|
|
|
403b09 |
def __NO_CLI_getter(cls):
|
|
|
403b09 |
- return isinstance(api.Command.vault_archive_internal,
|
|
|
403b09 |
- _fake_vault_archive_internal)
|
|
|
403b09 |
+ return (api.Command.get_plugin('vault_archive_internal') is
|
|
|
403b09 |
+ _fake_vault_archive_internal)
|
|
|
403b09 |
|
|
|
403b09 |
NO_CLI = classproperty(__NO_CLI_getter)
|
|
|
403b09 |
|
|
|
403b09 |
@@ -855,8 +855,8 @@ class vault_retrieve(Local):
|
|
|
403b09 |
|
|
|
403b09 |
@classmethod
|
|
|
403b09 |
def __NO_CLI_getter(cls):
|
|
|
403b09 |
- return isinstance(api.Command.vault_retrieve_internal,
|
|
|
403b09 |
- _fake_vault_retrieve_internal)
|
|
|
403b09 |
+ return (api.Command.get_plugin('vault_retrieve_internal') is
|
|
|
403b09 |
+ _fake_vault_retrieve_internal)
|
|
|
403b09 |
|
|
|
403b09 |
NO_CLI = classproperty(__NO_CLI_getter)
|
|
|
403b09 |
|
|
|
403b09 |
--
|
|
|
403b09 |
2.7.4
|
|
|
403b09 |
|