Bug 43397 - filter generation broken in 'connector/s4/mapping/dc/ignorelist'
filter generation broken in 'connector/s4/mapping/dc/ignorelist'
Product: UCS
Classification: Unclassified
Component: S4 Connector
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Lukas Oyen
Florian Best
: interim-2
: 43407 (view as bug list)
Depends on:
Blocks: 32086 44374
  Show dependency treegraph
Reported: 2017-01-23 14:01 CET by Florian Best
Modified: 2019-10-15 16:59 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?: Yes
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2017012321000251
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+

patch (679 bytes, patch)
2017-01-23 14:01 CET, Florian Best
Details | Diff
Fix to the mapping.py and correction in postinst-script (10.00 KB, application/x-tar)
2017-02-06 14:59 CET, Lukas Oyen

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2017-01-23 14:01:45 CET
Created attachment 8369 [details]

With the UCR variable connector/s4/mapping/dc/ignorelist: ucs01 a reject happens:

23.01.2017 13:09:31,333 LDAP        (PROCESS): sync from ucs:   Resync rejected file: /var/lib/univention-connector/s4/1484658595.135622
23.01.2017 13:09:31,349 LDAP        (WARNING): sync failed, saved as rejected 
23.01.2017 13:09:31,349 LDAP        (WARNING): Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 987, in resync_rejected_ucs
    if self.__sync_file_from_ucs(filename, append_error=' rejected'):
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 837, in __sync_file_from_ucs
    if not self._ignore_object(key, object) or ignore_subtree_match:
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1705, in _ignore_object
    if self.property[key].ignore_filter and self._filter_match(self.property[key].ignore_filter, object['attributes']):
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1688, in _filter_match
    return subfilter(filter, attributes)
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1680, in subfilter
    return subfilter(filter[1:-1], attributes)
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1683, in subfilter
    return connecting_filter(filter, attributes)
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1670, in connecting_filter
    return 1 in walk(filter[1:], attributes)
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1662, in walk
    results.append(subfilter(filter, attributes))
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1686, in subfilter
    return attribute_filter(filter, attributes)
  File "/usr/lib/pymodules/python2.7/univention/s4connector/__init__.py", line 1594, in attribute_filter
    raise ValueError('missing "=" in filter: %s' % filter)
ValueError: missing "=" in filter: ucs01

More debug information are at the ticket.

Attached is a fix which needs to be applied against /etc/univention/connector/s4/mapping.
Comment 1 Florian Best univentionstaff 2017-01-23 14:02:37 CET
@Jens: Please set the customer ID.
Comment 2 Florian Best univentionstaff 2017-01-23 14:24:26 CET
curl https://forge.univention.org/bugzilla/attachment.cgi?id=8369 | sed 's/mapping.py/mapping/g' | patch -p8 -d /etc/univention/connector/s4/
Comment 3 Stefan Gohmann univentionstaff 2017-01-24 06:54:28 CET
Does it work if you set connector/s4/mapping/dc/ignorelist to cn=ucs01?
Comment 4 Florian Best univentionstaff 2017-01-24 09:47:50 CET
(In reply to Stefan Gohmann from comment #3)
> Does it work if you set connector/s4/mapping/dc/ignorelist to cn=ucs01?
Well, but there is another check which will fail then:
conffiles/etc/univention/s4connector/s4/mapping.py-434-ignore_filter = ''
conffiles/etc/univention/s4connector/s4/mapping.py:435:for dc in configRegistry.get('connector/s4/mapping/dc/ignorelist', '').split(','):
conffiles/etc/univention/s4connector/s4/mapping.py-436-»   if dc:
conffiles/etc/univention/s4connector/s4/mapping.py-437-»   »   ignore_filter += '(cn=%s)' % (dc)
Comment 5 Florian Best univentionstaff 2017-01-24 13:02:10 CET
*** Bug 43407 has been marked as a duplicate of this bug. ***
Comment 6 Florian Best univentionstaff 2017-01-24 13:02:33 CET
Also consider Bug #43407 attachment 8371 [details]
Comment 7 Lukas Oyen univentionstaff 2017-02-06 14:59:27 CET
Created attachment 8400 [details]
Fix to the mapping.py and correction in postinst-script

The attached patches fix the errors in `mapping.py` and the postinst-script. They also add a case in the postinst-script to correct already misconfigured systems.
Comment 8 Lukas Oyen univentionstaff 2017-02-06 16:06:18 CET
Commited in r76451 + r76452.
Comment 9 Florian Best univentionstaff 2017-02-07 14:21:45 CET
# ucr unset connector/s4/mapping/dns/ignorelist
Unsetting connector/s4/mapping/dns/ignorelist

# invoke-rc.d univention-s4-connector restart 
Stopping Univention S4 Connector: univention-s4-connector.
Starting Univention S4 Connector: univention-s4-connector^[[A^[[A^[[ATraceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/s4connector/s4/main.py", line 64, in <module>
    import mapping
  File "/etc/univention/connector/s4/mapping.py", line 530
    'msGPO': univention.s4connector.property (
SyntaxError: invalid syntax
invoke-rc.d: initscript univention-s4-connector, action "restart" failed.
Comment 10 Lukas Oyen univentionstaff 2017-02-07 14:45:41 CET
Fixed in r76498.
Comment 11 Florian Best univentionstaff 2017-02-07 15:32:48 CET
OK: filter expressions are correctly build
OK: postinst update code
OK: changelog
Comment 12 Stefan Gohmann univentionstaff 2017-04-04 18:29:09 CEST
UCS 4.2 has been released:

If this error occurs again, please use "Clone This Bug".