2009-06-24 08:12:27 -05:00
|
|
|
# Authors:
|
|
|
|
# Rob Crittenden <rcritten@redhat.com>
|
|
|
|
# Pavel Zuna <pzuna@redhat.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2009 Red Hat
|
|
|
|
# see file 'COPYING' for use and warranty information
|
|
|
|
#
|
2010-12-09 06:59:11 -06:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2009-06-24 08:12:27 -05:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2010-12-09 06:59:11 -06:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-06-24 08:12:27 -05:00
|
|
|
"""
|
|
|
|
Test the `ipalib/plugins/netgroup.py` module.
|
|
|
|
"""
|
|
|
|
|
2010-07-14 13:45:15 -05:00
|
|
|
import nose
|
2013-09-30 03:50:59 -05:00
|
|
|
|
2009-06-24 08:12:27 -05:00
|
|
|
from ipalib import api
|
|
|
|
from ipalib import errors
|
2010-07-14 13:45:15 -05:00
|
|
|
from ipaserver.plugins.ldap2 import ldap2
|
2015-07-31 03:15:01 -05:00
|
|
|
from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_digits,
|
|
|
|
fuzzy_uuid, fuzzy_netgroupdn)
|
2013-05-21 06:40:27 -05:00
|
|
|
from ipatests.test_xmlrpc import objectclasses
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
from ipapython.dn import DN
|
2013-09-30 03:50:59 -05:00
|
|
|
from ipatests.test_xmlrpc.test_user_plugin import get_user_result
|
2009-06-24 08:12:27 -05:00
|
|
|
|
2010-07-14 13:45:15 -05:00
|
|
|
# Global so we can save the value between tests
|
|
|
|
netgroup_dn = None
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
netgroup1 = u'netgroup1'
|
|
|
|
netgroup2 = u'netgroup2'
|
2012-05-04 03:25:42 -05:00
|
|
|
netgroup_single = u'a'
|
2010-10-29 10:32:03 -05:00
|
|
|
|
|
|
|
host1 = u'ipatesthost.%s' % api.env.domain
|
2011-08-09 20:21:56 -05:00
|
|
|
host_dn1 = DN(('fqdn',host1),('cn','computers'),('cn','accounts'),
|
|
|
|
api.env.basedn)
|
2010-10-29 10:32:03 -05:00
|
|
|
|
|
|
|
unknown_host = u'unknown'
|
|
|
|
|
2012-04-30 06:29:08 -05:00
|
|
|
unknown_host2 = u'unknown2'
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
hostgroup1 = u'hg1'
|
2011-08-09 20:21:56 -05:00
|
|
|
hostgroup_dn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
|
|
|
|
api.env.basedn)
|
2010-10-29 10:32:03 -05:00
|
|
|
|
|
|
|
user1 = u'jexample'
|
2010-10-27 11:07:53 -05:00
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
# user2 is a member of testgroup
|
|
|
|
user2 = u'pexample'
|
|
|
|
|
|
|
|
group1 = u'testgroup'
|
|
|
|
|
2012-02-24 13:39:56 -06:00
|
|
|
invalidnetgroup1=u'+badnetgroup'
|
2012-03-27 08:15:20 -05:00
|
|
|
invalidnisdomain1=u'domain1,domain2'
|
|
|
|
invalidnisdomain2=u'+invalidnisdomain'
|
|
|
|
invalidhost=u'+invalid&host'
|
2012-02-24 13:39:56 -06:00
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
class test_netgroup(Declarative):
|
2009-06-24 08:12:27 -05:00
|
|
|
"""
|
|
|
|
Test the `netgroup` plugin.
|
|
|
|
"""
|
2010-10-29 10:32:03 -05:00
|
|
|
|
|
|
|
cleanup_commands = [
|
|
|
|
('netgroup_del', [netgroup1], {}),
|
|
|
|
('netgroup_del', [netgroup2], {}),
|
|
|
|
('host_del', [host1], {}),
|
|
|
|
('hostgroup_del', [hostgroup1], {}),
|
|
|
|
('user_del', [user1], {}),
|
|
|
|
('user_del', [user2], {}),
|
|
|
|
('group_del', [group1], {}),
|
|
|
|
]
|
|
|
|
|
|
|
|
tests=[
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to retrieve non-existent %r' % netgroup1,
|
|
|
|
command=('netgroup_show', [netgroup1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: netgroup not found' % netgroup1),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to update non-existent %r' % netgroup1,
|
|
|
|
command=('netgroup_mod', [netgroup1],
|
|
|
|
dict(description=u'Updated hostgroup 1')
|
|
|
|
),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: netgroup not found' % netgroup1),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to delete non-existent %r' % netgroup1,
|
|
|
|
command=('netgroup_del', [netgroup1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: netgroup not found' % netgroup1),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-02-24 13:39:56 -06:00
|
|
|
dict(
|
|
|
|
desc='Test an invalid netgroup name %r' % invalidnetgroup1,
|
|
|
|
command=('netgroup_add', [invalidnetgroup1], dict(description=u'Test')),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.ValidationError(name='name',
|
|
|
|
error=u'may only include letters, numbers, _, -, and .'),
|
2012-02-24 13:39:56 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-03-27 08:15:20 -05:00
|
|
|
dict(
|
|
|
|
desc='Test an invalid nisdomain1 name %r' % invalidnisdomain1,
|
2012-03-27 08:27:11 -05:00
|
|
|
command=('netgroup_add', [netgroup1],
|
|
|
|
dict(description=u'Test',nisdomainname=invalidnisdomain1)),
|
|
|
|
expected=errors.ValidationError(name='nisdomain',
|
|
|
|
error='may only include letters, numbers, _, -, and .'),
|
2012-03-27 08:15:20 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test an invalid nisdomain2 name %r' % invalidnisdomain2,
|
2012-03-27 08:27:11 -05:00
|
|
|
command=('netgroup_add', [netgroup1],
|
|
|
|
dict(description=u'Test',nisdomainname=invalidnisdomain2)),
|
|
|
|
expected=errors.ValidationError(name='nisdomain',
|
|
|
|
error='may only include letters, numbers, _, -, and .'),
|
2012-03-27 08:15:20 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
dict(
|
|
|
|
desc='Create %r' % netgroup1,
|
|
|
|
command=('netgroup_add', [netgroup1],
|
|
|
|
dict(description=u'Test netgroup 1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=netgroup1,
|
|
|
|
summary=u'Added netgroup "%s"' % netgroup1,
|
|
|
|
result=dict(
|
|
|
|
dn=fuzzy_netgroupdn,
|
|
|
|
cn=[netgroup1],
|
|
|
|
objectclass=objectclasses.netgroup,
|
|
|
|
description=[u'Test netgroup 1'],
|
|
|
|
nisdomainname=['%s' % api.env.domain],
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % netgroup2,
|
|
|
|
command=('netgroup_add', [netgroup2],
|
|
|
|
dict(description=u'Test netgroup 2')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=netgroup2,
|
|
|
|
summary=u'Added netgroup "%s"' % netgroup2,
|
|
|
|
result=dict(
|
|
|
|
dn=fuzzy_netgroupdn,
|
|
|
|
cn=[netgroup2],
|
|
|
|
objectclass=objectclasses.netgroup,
|
|
|
|
description=[u'Test netgroup 2'],
|
|
|
|
nisdomainname=['%s' % api.env.domain],
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-05-04 03:25:42 -05:00
|
|
|
dict(
|
|
|
|
desc='Create netgroup with name containing only one letter: %r' % netgroup_single,
|
|
|
|
command=('netgroup_add', [netgroup_single],
|
|
|
|
dict(description=u'Test netgroup_single')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=netgroup_single,
|
|
|
|
summary=u'Added netgroup "%s"' % netgroup_single,
|
|
|
|
result=dict(
|
|
|
|
dn=fuzzy_netgroupdn,
|
|
|
|
cn=[netgroup_single],
|
|
|
|
objectclass=objectclasses.netgroup,
|
|
|
|
description=[u'Test netgroup_single'],
|
|
|
|
nisdomainname=['%s' % api.env.domain],
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete %r' % netgroup_single,
|
|
|
|
command=('netgroup_del', [netgroup_single], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[netgroup_single],
|
2012-05-04 03:25:42 -05:00
|
|
|
summary=u'Deleted netgroup "%s"' % netgroup_single,
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-05-04 03:25:42 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
dict(
|
|
|
|
desc='Try to create duplicate %r' % netgroup1,
|
|
|
|
command=('netgroup_add', [netgroup1],
|
|
|
|
dict(description=u'Test netgroup 1')
|
|
|
|
),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.DuplicateEntry(
|
|
|
|
message=u'netgroup with name "%s" already exists' % netgroup1),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create host %r' % host1,
|
|
|
|
command=('host_add', [host1],
|
|
|
|
dict(
|
|
|
|
description=u'Test host 1',
|
|
|
|
l=u'Undisclosed location 1',
|
|
|
|
force=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=host1,
|
|
|
|
summary=u'Added host "%s"' % host1,
|
|
|
|
result=dict(
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
dn=host_dn1,
|
2010-10-29 10:32:03 -05:00
|
|
|
fqdn=[host1],
|
|
|
|
description=[u'Test host 1'],
|
|
|
|
l=[u'Undisclosed location 1'],
|
|
|
|
krbprincipalname=[u'host/%s@%s' % (host1, api.env.realm)],
|
|
|
|
objectclass=objectclasses.host,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
2010-11-10 15:47:29 -06:00
|
|
|
managedby_host=[host1],
|
2011-08-22 15:24:07 -05:00
|
|
|
has_keytab=False,
|
|
|
|
has_password=False,
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % hostgroup1,
|
|
|
|
command=('hostgroup_add', [hostgroup1],
|
|
|
|
dict(description=u'Test hostgroup 1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=hostgroup1,
|
|
|
|
summary=u'Added hostgroup "%s"' % hostgroup1,
|
|
|
|
result=dict(
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
dn=hostgroup_dn1,
|
2010-10-29 10:32:03 -05:00
|
|
|
cn=[hostgroup1],
|
|
|
|
objectclass=objectclasses.hostgroup,
|
|
|
|
description=[u'Test hostgroup 1'],
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
mepmanagedentry=[DN(('cn',hostgroup1),('cn','ng'),('cn','alt'),
|
|
|
|
api.env.basedn)],
|
2010-10-29 10:32:03 -05:00
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % user1,
|
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'add'),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % user2,
|
|
|
|
command=(
|
|
|
|
'user_add', [user2], dict(givenname=u'Test', sn=u'User2')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user2,
|
|
|
|
summary=u'Added user "%s"' % user2,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user2, u'Test', u'User2', 'add'),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % group1,
|
|
|
|
command=(
|
|
|
|
'group_add', [group1], dict(description=u'Test desc 1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=group1,
|
|
|
|
summary=u'Added group "%s"' % group1,
|
|
|
|
result=dict(
|
|
|
|
cn=[group1],
|
|
|
|
description=[u'Test desc 1'],
|
|
|
|
gidnumber=[fuzzy_digits],
|
|
|
|
objectclass=objectclasses.group + [u'posixgroup'],
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
dn=DN(('cn',group1),('cn','groups'),('cn','accounts'),
|
|
|
|
api.env.basedn),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add user %r to group %r' % (user2, group1),
|
|
|
|
command=(
|
|
|
|
'group_add_member', [group1], dict(user=user2)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
'dn': DN(('cn',group1),('cn','groups'),('cn','accounts'),
|
|
|
|
api.env.basedn),
|
2010-10-29 10:32:03 -05:00
|
|
|
'member_user': (user2,),
|
|
|
|
'gidnumber': [fuzzy_digits],
|
|
|
|
'cn': [group1],
|
|
|
|
'description': [u'Test desc 1'],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-03-27 08:15:20 -05:00
|
|
|
dict(
|
|
|
|
desc='Add invalid host %r to netgroup %r' % (invalidhost, netgroup1),
|
|
|
|
command=('netgroup_add_member', [netgroup1], dict(host=invalidhost)),
|
|
|
|
expected=errors.ValidationError(name='host',
|
2014-01-31 08:52:35 -06:00
|
|
|
error=u"only letters, numbers, '_', '-' are allowed. " +
|
|
|
|
u"DNS label may not start or end with '-'"),
|
2012-03-27 08:15:20 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
dict(
|
|
|
|
desc='Add host %r to netgroup %r' % (host1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(host=host1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add hostgroup %r to netgroup %r' % (hostgroup1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(hostgroup=hostgroup1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-03-09 03:45:15 -06:00
|
|
|
dict(
|
|
|
|
desc='Search for netgroups using no_user',
|
|
|
|
command=('netgroup_find', [], dict(no_user=user1)),
|
|
|
|
expected=dict(
|
|
|
|
count=2,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'2 netgroups matched',
|
|
|
|
result=[
|
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
2013-04-15 08:15:02 -05:00
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup2],
|
|
|
|
'description': [u'Test netgroup 2'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
2012-03-09 03:45:15 -06:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc="Check %r doesn't match when searching for %s" % (netgroup1, user1),
|
|
|
|
command=('netgroup_find', [], dict(user=user1)),
|
|
|
|
expected=dict(
|
|
|
|
count=0,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'0 netgroups matched',
|
|
|
|
result=[],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
dict(
|
|
|
|
desc='Add user %r to netgroup %r' % (user1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(user=user1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-03-09 03:45:15 -06:00
|
|
|
dict(
|
|
|
|
desc="Check %r doesn't match when searching for no %s" % (netgroup1, user1),
|
|
|
|
command=('netgroup_find', [], dict(no_user=user1)),
|
|
|
|
expected=dict(
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'1 netgroup matched',
|
|
|
|
result=[
|
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup2],
|
|
|
|
'description': [u'Test netgroup 2'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2010-10-29 10:32:03 -05:00
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add group %r to netgroup %r' % (group1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(group=group1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add netgroup %r to netgroup %r' % (netgroup2, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(netgroup=netgroup2)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add non-existent netgroup to netgroup %r' % (netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(netgroup=u'notfound')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=[(u'notfound', u'no such entry')],
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add duplicate user %r to netgroup %r' % (user1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(user=user1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
2010-12-01 10:23:52 -06:00
|
|
|
user=[('%s' % user1, u'This entry is already a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add duplicate group %r to netgroup %r' % (group1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(group=group1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
2010-12-01 10:23:52 -06:00
|
|
|
group=[('%s' % group1, u'This entry is already a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-04-17 11:42:35 -05:00
|
|
|
desc='Add duplicate host %r to netgroup %r' % (host1, netgroup1),
|
2010-10-29 10:32:03 -05:00
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(host=host1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
2010-12-01 10:23:52 -06:00
|
|
|
host=[('%s' % host1, u'This entry is already a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add duplicate hostgroup %r to netgroup %r' % (hostgroup1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(hostgroup=hostgroup1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
2010-12-01 10:23:52 -06:00
|
|
|
hostgroup=[('%s' % hostgroup1, u'This entry is already a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add unknown host %r to netgroup %r' % (unknown_host, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_add_member', [netgroup1], dict(host=unknown_host)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-04-30 06:29:08 -05:00
|
|
|
dict(
|
|
|
|
desc='Add invalid host %r to netgroup %r using setattr' %
|
|
|
|
(invalidhost, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_mod', [netgroup1],
|
|
|
|
dict(setattr='externalhost=%s' % invalidhost)
|
|
|
|
),
|
|
|
|
expected=errors.ValidationError(name='externalhost',
|
2014-01-31 08:52:35 -06:00
|
|
|
error=u"only letters, numbers, '_', '-' are allowed. " +
|
|
|
|
u"DNS label may not start or end with '-'"),
|
2012-04-30 06:29:08 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add unknown host %r to netgroup %r using addattr' %
|
|
|
|
(unknown_host2, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_mod', [netgroup1],
|
|
|
|
dict(addattr='externalhost=%s' % unknown_host2)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=u'netgroup1',
|
|
|
|
summary=u'Modified netgroup "netgroup1"',
|
|
|
|
result={
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
'externalhost': [unknown_host, unknown_host2],
|
|
|
|
},
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove unknown host %r from netgroup %r using delattr' %
|
|
|
|
(unknown_host2, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_mod', [netgroup1],
|
|
|
|
dict(delattr='externalhost=%s' % unknown_host2)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=u'netgroup1',
|
|
|
|
summary=u'Modified netgroup "netgroup1"',
|
|
|
|
result={
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
'externalhost': [unknown_host],
|
|
|
|
},
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
2010-10-29 10:32:03 -05:00
|
|
|
dict(
|
|
|
|
desc='Retrieve %r' % netgroup1,
|
|
|
|
command=('netgroup_show', [netgroup1], {}),
|
|
|
|
expected=dict(
|
|
|
|
value=netgroup1,
|
|
|
|
summary=None,
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Search for %r' % netgroup1,
|
|
|
|
command=('netgroup_find', [], dict(cn=netgroup1)),
|
|
|
|
expected=dict(
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'1 netgroup matched',
|
|
|
|
result=[
|
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-03-09 03:45:15 -06:00
|
|
|
dict(
|
|
|
|
desc='Search for %r using user' % netgroup1,
|
|
|
|
command=('netgroup_find', [], dict(user=user1)),
|
|
|
|
expected=dict(
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'1 netgroup matched',
|
|
|
|
result=[
|
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2012-03-09 03:45:15 -06:00
|
|
|
},
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-04-17 11:42:35 -05:00
|
|
|
desc='Search for all netgroups using empty member user',
|
|
|
|
command=('netgroup_find', [], dict(user=None)),
|
2012-03-09 03:45:15 -06:00
|
|
|
expected=dict(
|
|
|
|
count=2,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'2 netgroups matched',
|
|
|
|
result=[
|
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Test netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2012-03-09 03:45:15 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberof_netgroup': (netgroup1,),
|
|
|
|
'cn': [netgroup2],
|
|
|
|
'description': [u'Test netgroup 2'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2010-10-29 10:32:03 -05:00
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Update %r' % netgroup1,
|
|
|
|
command=('netgroup_mod', [netgroup1],
|
|
|
|
dict(description=u'Updated netgroup 1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=netgroup1,
|
|
|
|
summary=u'Modified netgroup "%s"' % netgroup1,
|
|
|
|
result={
|
|
|
|
'memberhost_host': (host1,),
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove host %r from netgroup %r' % (host1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(host=host1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberhost_hostgroup': (hostgroup1,),
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove hostgroup %r from netgroup %r' % (hostgroup1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(hostgroup=hostgroup1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberuser_user': (user1,),
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove user %r from netgroup %r' % (user1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(user=user1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'memberuser_group': (group1,),
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove group %r from netgroup %r' % (group1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(group=group1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'member_netgroup': (netgroup2,),
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove netgroup %r from netgroup %r' % (netgroup2, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(netgroup=netgroup2)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove host %r from netgroup %r again' % (host1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(host=host1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
2010-12-01 10:23:52 -06:00
|
|
|
host=[('%s' % host1, u'This entry is not a member')]
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove hostgroup %r from netgroup %r again' % (hostgroup1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(hostgroup=hostgroup1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
2010-12-01 10:23:52 -06:00
|
|
|
hostgroup=[('%s' % hostgroup1, u'This entry is not a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove user %r from netgroup %r again' % (user1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(user=user1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
2010-12-01 10:23:52 -06:00
|
|
|
user=[('%s' % user1, u'This entry is not a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove group %r from netgroup %r again' % (group1, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(group=group1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
netgroup=tuple(),
|
|
|
|
),
|
|
|
|
memberuser=dict(
|
2010-12-01 10:23:52 -06:00
|
|
|
group= [('%s' % group1, u'This entry is not a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove netgroup %r from netgroup %r again' % (netgroup2, netgroup1),
|
|
|
|
command=(
|
|
|
|
'netgroup_remove_member', [netgroup1], dict(netgroup=netgroup2)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
completed=0,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
2010-12-01 10:23:52 -06:00
|
|
|
netgroup=[('%s' % netgroup2, u'This entry is not a member')],
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
memberuser=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
memberhost=dict(
|
|
|
|
hostgroup=tuple(),
|
|
|
|
host=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
|
|
|
'dn': fuzzy_netgroupdn,
|
|
|
|
'cn': [netgroup1],
|
|
|
|
'description': [u'Updated netgroup 1'],
|
|
|
|
'nisdomainname': [u'%s' % api.env.domain],
|
2012-03-27 08:15:20 -05:00
|
|
|
'externalhost': [unknown_host],
|
2010-10-29 10:32:03 -05:00
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete %r' % netgroup1,
|
|
|
|
command=('netgroup_del', [netgroup1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[netgroup1],
|
2010-10-29 10:32:03 -05:00
|
|
|
summary=u'Deleted netgroup "%s"' % netgroup1,
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2010-10-29 10:32:03 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
# No way to convert this test just yet.
|
|
|
|
|
|
|
|
# def test_6b_netgroup_show(self):
|
|
|
|
# """
|
|
|
|
# Confirm the underlying triples
|
|
|
|
# """
|
|
|
|
# # Do an LDAP query to the compat area and verify that the entry
|
|
|
|
# # is correct
|
2015-06-22 05:58:43 -05:00
|
|
|
# conn = ldap2(api)
|
2015-07-20 09:04:07 -05:00
|
|
|
# conn.connect()
|
2010-10-29 10:32:03 -05:00
|
|
|
# try:
|
|
|
|
# entries = conn.find_entries('cn=%s' % self.ng_cn,
|
|
|
|
# base_dn='cn=ng,cn=compat,%s' % api.env.basedn)
|
|
|
|
# except errors.NotFound:
|
|
|
|
# raise nose.SkipTest('compat and nis are not enabled, skipping test')
|
|
|
|
# finally:
|
|
|
|
# conn.disconnect()
|
2013-10-31 11:55:23 -05:00
|
|
|
# triples = entries[0][0]['nisnetgrouptriple']
|
2010-10-29 10:32:03 -05:00
|
|
|
#
|
|
|
|
# # This may not prove to be reliable since order is not guaranteed
|
|
|
|
# # and even which user gets into which triple can be random.
|
|
|
|
# assert '(nosuchhost,jexample,example.com)' in triples
|
|
|
|
# assert '(ipatesthost.%s,pexample,example.com)' % api.env.domain in triples
|