Begin phicli
This commit is contained in:
parent
86e8ed669b
commit
75e2ee1b04
10
config.yml
10
config.yml
|
@ -14,12 +14,10 @@ ldap:
|
|||
validate: True # Can either be True or False. Default: False
|
||||
ca_certs: openldap/cert.pem
|
||||
|
||||
username: uid=phi,ou=Services,dc=unit,dc=macaomilano,dc=org
|
||||
password: phi
|
||||
|
||||
base_dn: dc=unit,dc=macaomilano,dc=org
|
||||
attribute_id: uid
|
||||
attribute_mail: mail
|
||||
# username: uid=phi,ou=Services,dc=unit,dc=macaomilano,dc=org
|
||||
# password: phi
|
||||
username: cn=root,dc=unit,dc=macaomilano,dc=org
|
||||
password: root
|
||||
|
||||
|
||||
logging:
|
||||
|
|
2
setup.py
2
setup.py
|
@ -14,7 +14,7 @@ setup(
|
|||
|
||||
package_dir={'': 'src'},
|
||||
packages=['phi', 'phi.api', 'phi.ldap'],
|
||||
scripts=['src/phid'],
|
||||
scripts=['src/phid', 'src/phicli'],
|
||||
|
||||
setup_requires=['pytest-runner'],
|
||||
install_requires=['pyYAML', 'ldap3'],
|
||||
|
|
27
src/phicli
Executable file
27
src/phicli
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python3
|
||||
from pprint import pformat as pp
|
||||
|
||||
import phi.ldap.client
|
||||
from phi.config import get_config
|
||||
from phi.logging import setup_logging, get_logger
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
config_file, config = get_config()
|
||||
|
||||
setup_logging(config.get('logging', {}))
|
||||
|
||||
# log.info("Found configuration at '{}':\n{}"
|
||||
# .format(config_file, pp(config)))
|
||||
log.info("Found configuration at '{}':\n".format(config_file))
|
||||
|
||||
log.info('Opening LDAP client')
|
||||
client = phi.ldap.client.Client(**config['ldap'])
|
||||
client.open()
|
||||
|
||||
#
|
||||
|
||||
log.info('Closing LDAP client')
|
||||
client.close()
|
Loading…
Reference in New Issue
Block a user