Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test valid docs fix #34744

Merged
merged 3 commits into from
Jul 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions salt/modules/ldap3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -430,6 +465,18 @@ 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'
directives="('add', 'example', ['example_val'])"
'''
l = connect(connect_spec)
# convert the "iterable of values" to lists in case that's what
Expand Down Expand Up @@ -477,6 +524,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
Expand Down
1 change: 1 addition & 0 deletions tests/integration/modules/sysmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_valid_docs(self):
allow_failure = (
'cp.recv',
'lxc.run_cmd',
'ipset.long_range',
'pkg.expand_repo_def',
'runtests_decorators.depends',
'runtests_decorators.depends_will_fallback',
Expand Down