#6298 ldapupdate: Regression in handling of syntax errors in update files
Closed: Duplicate None Opened 7 years ago by mbabinsk.

Commit 00d4309 fixed inheritance problems in ScriptError exception, but forgot to update the definition of BadSyntax exception to call the parent's constructor during __init__.

This caused our test suite to fail with errors like this:

Error Message

AttributeError: can't set attribute

Stacktrace

self = <ipatests.test_install.test_updates.test_update testMethod=test_8_badsyntax>

    def test_8_badsyntax(self):
        """
            Test the updater with an unknown keyword (test_8_badsyntax)
            """
        with self.assertRaises(BadSyntax):
            modified = self.updater.update(
>               [os.path.join(self.testdir, "8_badsyntax.update")])

ipatests/test_install/test_updates.py:247: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
ipaserver/install/ldapupdate.py:916: in update
    self.parse_update_file(f, data, all_updates)
ipaserver/install/ldapupdate.py:528: in parse_update_file
    emit_item(logical_line)
ipaserver/install/ldapupdate.py:389: in emit_item
    raise BadSyntax("Unknown update action '%s', data source=%s" % (action, data_source_name))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = BadSyntax()
value = "Unknown update action 'bogus', data source=/var/lib/jenkins/workspace/freeipa-intree-tests-f24master/ipatests/test_install/8_badsyntax.update"

    def __init__(self, value):
        self.value = value
>       self.msg = "LDAPUpdate: syntax error: \n  %s" % value
E       AttributeError: can't set attribute

ipaserver/install/ldapupdate.py:86: AttributeError

This also has the potential to break error handling during upgrade from older FreeIPA deployments, so it should be fixed as soon as time/resources permit.


The root cause is the same as in #6294, closing as duplicate

Metadata Update from @mbabinsk:
- Issue assigned to mbabinsk
- Issue set to the milestone: 0.0 NEEDS_TRIAGE

7 years ago

Login to comment on this ticket.

Metadata