#50373 DNAPluginSharedConfig.create() is case sensitive
Opened 4 months ago by vashirov. Modified 4 months ago

Issue Description

        log.info("Creating DNA shared config entry...")
        shared_configs = DNAPluginSharedConfigs(inst, ou_ranges.dn)
        shared_configs.create(properties={'dnaHostName': str(inst.host),
                                          'dnaPortNum': str(inst.port),
>                                         'dnaRemainingValues': '9501'})

dirsrvtests/tests/suites/plugins/dna_test.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/lib389/lib389/plugins.py:1922: in create
    return co.create(properties, self._basedn)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <lib389.plugins.DNAPluginSharedConfig object at 0x7f675d87d828>
properties = {'dnaHostName': 'server-rhel8.example.com', 'dnaPortNum': '38901', 'dnaRemainingValues': '9501'}, basedn = 'ou=ranges,dc=example,dc=com'
ensure = False

    def create(self, properties=None, basedn=None, ensure=False):
        """The shared config DNA plugin entry has two RDN values
            The function takes care about that special case
            """

        for attr in self._must_attributes:
            if properties.get(attr, None) is None:
>               raise ldap.UNWILLING_TO_PERFORM('Attribute %s must not be None' % attr)
E               ldap.UNWILLING_TO_PERFORM: Attribute dnaHostname must not be None

src/lib389/lib389/plugins.py:1847: UNWILLING_TO_PERFORM

Here we're passing dnaHostName in properties dict, but the method expects it to be dnaHostname (note the lower-case N).

The comparison should not be case sensitive.


I looked at other places in lib389 and the problem is a bit wider. We use dict but do not take into account attribute name normalization. Perhaps this should be solved by using case insensitive dictionaries.

An example implementation can be found in python requests library.

Metadata Update from @vashirov:
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None

4 months ago

Metadata Update from @mreynolds:
- Issue set to the milestone: 1.4.1

4 months ago

Login to comment on this ticket.

Metadata