Bug 41072 - udm cli --remove doesn't work if spaces are in the key or value
udm cli --remove doesn't work if spaces are in the key or value
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - CLI
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Florian Best
Dirk Wiesenthal
:
Depends on:
Blocks: 51197
  Show dependency treegraph
 
Reported: 2016-04-19 14:55 CEST by Florian Best
Modified: 2021-05-25 16:03 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): External feedback, Usability
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-04-19 14:55:25 CEST
Having a shares/share object with the following attributes:
univentionShareSambaCustomSetting: admin users = administrator join-backup
univentionShareSambaCustomSetting: follow symlinks = yes
The handler has this in self.info['sambaCustomSettings']:
[['admin users', 'administrator join-backup'], ['follow symlinks', 'yes']]

It's not possible to remove one of the value because they have spaces in their key.

udm shares/share modify --dn "cn=Team-Folder,cn=shares,$ldap_base" --remove sambaCustomSettings='follow symlinks = yes'

udm shares/share modify --dn "cn=Team-Folder,cn=shares,$ldap_base" --remove sambaCustomSettings='"follow symlinks = yes"'

The syntax is a "complex" syntax so the code splits at '"' if present otherwise it splits at ' ' (which would be correct) but the problem is that there are spaces in the key name.

The effective code calls:
object.remove(['follow', 'symlinks', 'yes'])
instead of:
object.remove(['follow symlinks', 'yes'])

A solution would be to use the syntax class for splitting?!
Comment 1 Nico Stöckigt univentionstaff 2016-04-19 14:57:00 CEST
see also Ticket#2016041921000291
Comment 2 Michael Grandjean univentionstaff 2016-06-22 13:28:36 CEST
Experienced this today, too:

> udm policies/registry modify --dn "cn=foo,cn=policies,ou=schule01,dc=example,dc=org" --remove 'registry="grub/
default Univention Corporate Server, with Linux 3.10.0-ucs139-amd64"'
> test_val=['', 'grub/default', ' ', 'Univention Corporate Server, with Linux 3.10.0-ucs139-amd64', '']
> WARNING: cannot remove ['"grub/default"', '"Univention Corporate Server, with Linux 3.10.0-ucs139-amd64"'] from registry, value does not exist
Comment 3 Philipp Hahn univentionstaff 2017-03-29 10:28:17 CEST

*** This bug has been marked as a duplicate of bug 43562 ***
Comment 4 Florian Best univentionstaff 2017-06-29 19:13:17 CEST
The bug is still present.

eval "$(ucr shell)"
udm shares/share create --set name=Team-Folder --position cn=shares,$ldap_base --set host=localhost --set path=/asdf/ --set sambaCustomSettings='"follow symlinks" "yes"'
udm shares/share modify --dn "cn=Team-Folder,cn=shares,$ldap_base" --remove sambaCustomSettings='"follow symlinks" "yes"'

test_val=['', 'follow symlinks', ' ', 'yes', '']
WARNING: cannot remove ['"follow symlinks"', '"yes"'] from sambaCustomSettings, value does not exist
No modification: cn=Team-Folder,cn=shares,dc=school,dc=local

*** This bug has been marked as a duplicate of bug 43286 ***
Comment 5 Florian Best univentionstaff 2017-06-29 19:20:18 CEST
Added a test script:
r80659 | Bug #41072: add 59_udm/14_remove_values_from_share_sambaCustomSettings
Comment 6 Florian Best univentionstaff 2021-04-28 16:11:17 CEST
This also affected portal/entry:link and has therefor been fixed (Bug #51197).
The test case has been enabled.

univention-directory-manager-modules (15.0.9-1)
f5b4f895bd1c | Bug #41072: fix removal of values with complex syntax

ucs-test (7.0.22-11)
r80659 | Bug #41072: add 59_udm/14_remove_values_from_share_sambaCustomSettings

ucs-test (10.0.5-9)
f5b4f895bd1c | Bug #41072: fix removal of values with complex syntax

changelog-5.0-0.xml
9ab9fa746bcb | Changlog Bug #41072
Comment 7 Dirk Wiesenthal univentionstaff 2021-04-30 02:40:03 CEST
Works great. Already used in univention-portal and univention-server-overview
Comment 8 Florian Best univentionstaff 2021-05-25 16:03:21 CEST
UCS 5.0 has been released:
 https://docs.software-univention.de/release-notes-5.0-0-en.html
 https://docs.software-univention.de/release-notes-5.0-0-de.html

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