Bug 52576 - AttributeError: 'object' object has no attribute 'option' | UDM CLI doesn't handle create plus --append-option / --remove-option
AttributeError: 'object' object has no attribute 'option' | UDM CLI doesn't h...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - CLI
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-7-errata
Assigned To: Florian Best
Daniel Tröder
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-01-12 08:55 CET by Daniel Tröder
Modified: 2021-02-03 15:03 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Usability
Max CVSS v3 score:
troeder: Patch_Available+


Attachments
Patch by phahn (838 bytes, patch)
2021-01-12 08:57 CET, Daniel Tröder
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2021-01-12 08:55:51 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'
Comment 1 Daniel Tröder univentionstaff 2021-01-12 08:57:15 CET
Created attachment 10590 [details]
Patch by phahn

Allow --remove-option.
Comment 2 Florian Best univentionstaff 2021-01-12 12:05:39 CET
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
Comment 3 Daniel Tröder univentionstaff 2021-01-12 14:55:09 CET
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)