mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add cli examples for ldap3 module
This commit is contained in:
parent
b94e0dd95a
commit
6fa40a0d46
1 changed files with 59 additions and 0 deletions
|
@ -231,6 +231,18 @@ def connect(connect_spec=None):
|
|||
|
||||
This object should be used as a context manager. It is safe
|
||||
to nest ``with`` statements.
|
||||
|
||||
CLI example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' ldap3.connect "{
|
||||
'url': 'ldaps://ldap.example.com/',
|
||||
'bind': {
|
||||
'method': 'simple',
|
||||
'dn': 'cn=admin,dc=example,dc=com',
|
||||
'password': 'secret'}
|
||||
}"
|
||||
'''
|
||||
if isinstance(connect_spec, _connect_ctx):
|
||||
return connect_spec
|
||||
|
@ -357,6 +369,18 @@ def add(connect_spec, dn, attributes):
|
|||
|
||||
:returns:
|
||||
``True`` if successful, raises an exception otherwise.
|
||||
|
||||
CLI example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' ldap3.add "{
|
||||
'url': 'ldaps://ldap.example.com/',
|
||||
'bind': {
|
||||
'method': 'simple',
|
||||
'password': 'secret',
|
||||
},
|
||||
}" "dn='dc=example,dc=com'" "attributes={'example': 'values'}"
|
||||
'''
|
||||
l = connect(connect_spec)
|
||||
# convert the "iterable of values" to lists in case that's what
|
||||
|
@ -386,6 +410,17 @@ def delete(connect_spec, dn):
|
|||
|
||||
:returns:
|
||||
``True`` if successful, raises an exception otherwise.
|
||||
|
||||
CLI example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' ldap3.delete "{
|
||||
'url': 'ldaps://ldap.example.com/',
|
||||
'bind': {
|
||||
'method': 'simple',
|
||||
'password': 'secret'}
|
||||
}" dn='cn=admin,dc=example,dc=com'
|
||||
'''
|
||||
l = connect(connect_spec)
|
||||
log.info('deleting entry: dn: {0}'.format(repr(dn)))
|
||||
|
@ -430,6 +465,17 @@ def modify(connect_spec, dn, directives):
|
|||
|
||||
:returns:
|
||||
``True`` if successful, raises an exception otherwise.
|
||||
|
||||
CLI example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' ldap3.modify "{
|
||||
'url': 'ldaps://ldap.example.com/',
|
||||
'bind': {
|
||||
'method': 'simple',
|
||||
'password': 'secret'}
|
||||
}" dn='cn=admin,dc=example,dc=com'
|
||||
'''
|
||||
l = connect(connect_spec)
|
||||
# convert the "iterable of values" to lists in case that's what
|
||||
|
@ -477,6 +523,19 @@ def change(connect_spec, dn, before, after):
|
|||
|
||||
:returns:
|
||||
``True`` if successful, raises an exception otherwise.
|
||||
|
||||
CLI example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' ldap3.change "{
|
||||
'url': 'ldaps://ldap.example.com/',
|
||||
'bind': {
|
||||
'method': 'simple',
|
||||
'password': 'secret'}
|
||||
}" dn='cn=admin,dc=example,dc=com'
|
||||
before="{'example_value': 'before_val'}"
|
||||
after="{'example_value': 'after_val'}"
|
||||
'''
|
||||
l = connect(connect_spec)
|
||||
# convert the "iterable of values" to lists in case that's what
|
||||
|
|
Loading…
Add table
Reference in a new issue