from __future__ import absolute_import
# Standard modules
-import sys
import os
import logging
import logging.config
-import re
-import traceback
import textwrap
-import copy
import shutil
import stat
# Third party modules
-import six
+# from ldap3 import ObjectDef, AttrDef, Reader, Writer
+from ldap3 import ObjectDef
-import ldap3
-
-from ldap3 import ObjectDef, AttrDef, Reader, Writer
-
-from ldap3.core.exceptions import LDAPKeyError
+# from ldap3.core.exceptions import LDAPKeyError
# Own modules
-from .global_version import __version__ as __global_version__
-
-from .errors import FunctionNotImplementedError, PpAppError
-
-from .common import pp, terminal_can_colors, to_bytes, to_bool
-
-from .merge import merge_structure
+from .common import pp
from .ldap_app import PpLdapAppError, PpLdapApplication
-__version__ = '0.4.4'
+__version__ = '0.4.5'
LOG = logging.getLogger(__name__)
if self.verbose > 2:
LOG.debug("Checking config section {!r} ...".format(section_name))
- if section_name.lower() not in ('mk-home', 'mk_home', 'mkhome') :
+ if section_name.lower() not in ('mk-home', 'mk_home', 'mkhome'):
continue
section = self.cfg[section_name]
v = section['initial_uid']
try:
uid = int(v)
- except (ValueError, TypeError) as e:
+ except (ValueError, TypeError):
msg = (
"Invalid initial numeric user Id ([{s}]/initial_uid "
"=> {v!r}) found in configuration.").format(s=section_name, v=v)
LOG.info("Reading Accounts from LDAP ...")
query_filter = '(&(objectclass=posixAccount)(objectclass=shadowAccount))'
- attributes = ["uid", "uidNumber", "homeDirectory", "gidNumber"]
+ # attributes = ["uid", "uidNumber", "homeDirectory", "gidNumber"]
person = ObjectDef(['posixAccount', 'shadowAccount'])
person += ["uid", "uidNumber", "homeDirectory", "gidNumber"]
- #self.user_entries = self.ldap_search(query_filter, attributes=attributes)
+ # self.user_entries = self.ldap_search(query_filter, attributes=attributes)
self.user_entries = self.ldap_search_subtree(person, query_filter)
LOG.debug("Found {} LDAP entries.".format(len(self.user_entries)))
self.exit(5)
LOG.debug("Current UID counter: {}".format(uid_counter))
- el_printed = False
-
i = 0
for dn in self.users.keys():
user = self.users[dn]
uid = user['uidNumber']
- gid = user['gidNumber']
+ # gid = user['gidNumber']
user_name = user['uid']
- home = user['homeDirectory']
+ # home = user['homeDirectory']
if uid == self.initial_uid: