diff options
author | Rob Crittenden <rcritten@redhat.com> | 2007-12-11 17:34:15 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2007-12-11 17:34:15 -0500 |
commit | 23ffab533fde03171b023d50ba72b53d0ab8f1d7 (patch) | |
tree | 9309daef6950d83835cfb327ad13b1e0f81a6bb6 /ipa-python | |
parent | 5c217ce31a4b8c26941c86644b33b904734f61b8 (diff) | |
download | freeipa-23ffab533fde03171b023d50ba72b53d0ab8f1d7.tar.gz freeipa-23ffab533fde03171b023d50ba72b53d0ab8f1d7.tar.xz freeipa-23ffab533fde03171b023d50ba72b53d0ab8f1d7.zip |
Make the old entry option in update_*, check for empty parameters and
fix some problems reported by pychecker.
Diffstat (limited to 'ipa-python')
-rw-r--r-- | ipa-python/ipaclient.py | 4 | ||||
-rw-r--r-- | ipa-python/ipaerror.py | 6 | ||||
-rw-r--r-- | ipa-python/rpcclient.py | 35 |
3 files changed, 11 insertions, 34 deletions
diff --git a/ipa-python/ipaclient.py b/ipa-python/ipaclient.py index d815afa7..bd1fb235 100644 --- a/ipa-python/ipaclient.py +++ b/ipa-python/ipaclient.py @@ -19,14 +19,10 @@ #!/usr/bin/python -import sys - import ipa.rpcclient as rpcclient import entity import user import group -import ipa -import config import radius_util class IPAClient: diff --git a/ipa-python/ipaerror.py b/ipa-python/ipaerror.py index e3496336..59e26201 100644 --- a/ipa-python/ipaerror.py +++ b/ipa-python/ipaerror.py @@ -129,14 +129,14 @@ LDAP_NO_CONFIG = gen_error_code( "IPA configuration not found") # -# Input errors (sample - replace me) +# Function input errors # INPUT_CATEGORY = 0x0002 -INPUT_INVALID_ERROR = gen_error_code( +INPUT_INVALID_PARAMETER = gen_error_code( INPUT_CATEGORY, 0x0001, - "Illegal input") + "Invalid parameter(s)") # # Connection errors diff --git a/ipa-python/rpcclient.py b/ipa-python/rpcclient.py index 5656b99d..c993ac99 100644 --- a/ipa-python/rpcclient.py +++ b/ipa-python/rpcclient.py @@ -24,11 +24,8 @@ import socket import config from krbtransport import KerbTransport from kerberos import GSSError -import os -import base64 -import user -import ipa from ipa import ipaerror, ipautil +from ipa import config # Some errors to catch # http://cvs.fedora.redhat.com/viewcvs/ldapserver/ldap/servers/plugins/pam_passthru/README?root=dirsec&rev=1.6&view=auto @@ -36,7 +33,7 @@ from ipa import ipaerror, ipautil class RPCClient: def __init__(self): - ipa.config.init_config() + config.init_config() def server_url(self): """Build the XML-RPC server URL from our configuration""" @@ -47,25 +44,6 @@ class RPCClient: authentication""" return xmlrpclib.ServerProxy(self.server_url(), KerbTransport()) - def convert_entry(self,ent): - # Convert into a dict. We need to handle multi-valued attributes as well - # so we'll convert those into lists. - obj={} - for (k) in ent: - k = k.lower() - if obj.get(k) is not None: - if isinstance(obj[k],list): - obj[k].append(ent[k].strip()) - else: - first = obj[k] - obj[k] = () - obj[k].append(first) - obj[k].append(ent[k].strip()) - else: - obj[k] = ent[k] - - return obj - # Higher-level API def get_aci_entry(self, sattrs=None): @@ -168,7 +146,8 @@ class RPCClient: def get_user_by_email(self,email,sattrs=None): """Get a specific user's entry. Return as a dict of values. - Multi-valued fields are represented as lists. + Multi-valued fields are represented as lists. The result is a + dict. """ server = self.setup_server() if sattrs is None: @@ -245,7 +224,7 @@ class RPCClient: return ipautil.unwrap_binary_data(result) def get_all_users (self): - """Return a list containing a User object for each existing user.""" + """Return a list containing a dict for each existing user.""" server = self.setup_server() try: @@ -258,7 +237,7 @@ class RPCClient: return ipautil.unwrap_binary_data(result) def find_users (self, criteria, sattrs=None, searchlimit=0, timelimit=-1): - """Return a list: counter followed by a User object for each user that + """Return a list: counter followed by a dict for each user that matches the criteria. If the results are truncated, counter will be set to -1""" @@ -381,6 +360,8 @@ class RPCClient: except socket.error, (value, msg): raise xmlrpclib.Fault(value, msg) + return ipautil.unwrap_binary_data(result) + def find_groups (self, criteria, sattrs=None, searchlimit=0, timelimit=-1): """Return a list containing a Group object for each group that matches the criteria.""" |