Univention Bugzilla – Bug 52576
AttributeError: 'object' object has no attribute 'option' | UDM CLI doesn't handle create plus --append-option / --remove-option
Last modified: 2021-02-03 15:03:59 CET
The UDM CLIs help offers the arguments "--append-option" and "--remove-option" when using the "create" operation (at least on "shares/share" objects). But when using those, the CLI crashes: $ udm shares/share ... create options: --position Set position in tree --set Set variable to value, e.g. foo=bar --superordinate Use superordinate module --option Use only given module options --append-option Append the module option --remove-option Remove the module option --policy-reference Reference to policy given by DN --ignore_exists $ udm shares/share create --append-option=samba --remove-option=nfs --set name=test --set "path=/usr/share/ucs-school-veyon-windows" Traceback (most recent call last): File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 219, in doit output = univention.admincli.admin.doit(arglist) File "/usr/lib/python2.7/dist-packages/univention/admincli/admin.py", line 409, in doit out = _doit(arglist) File "/usr/lib/python2.7/dist-packages/univention/admincli/admin.py", line 729, in _doit object.option.remove(option) AttributeError: 'object' object has no attribute 'option'
Created attachment 10590 [details] Patch by phahn Allow --remove-option.
Applied the patch. univention-directory-manager-modules.yaml cfbc1b8081aa | Bug #52576: fix removing options on UDM CLI create univention-directory-manager-modules (14.0.20-1) cfbc1b8081aa | Bug #52576: fix removing options on UDM CLI create Merged to UCS 5.0: univention-directory-manager-modules (15.0.6-1) b9c1c3bc2e01 | Bug #52576: fix removing options on UDM CLI create
OK: code change OK: manual test: -------------------------------------------------------------- root@m20:~# udm shares/share create --append-option=samba --remove-option=nfs --set name=test --set "path=/usr/share/ucs-school-veyon-windows" --set host=$"$(hostname -f)" WARNING: The object is not going to be created underneath of its default containers. Object created: cn=test,dc=uni,dc=dtr root@m20:~# udm shares/share list --filter cn=test cn=test DN: cn=test,dc=uni,dc=dtr directorymode: 00755 ... -------------------------------------------------------------- → no NFS related properties are set OK: advisory (added package version: ce54ac3dd4)
<https://errata.software-univention.de/#/?erratum=4.4x886>