Bug 24081 - shares/printer parameter uri benötigt zur Zeit ein Leerzeichen
shares/printer parameter uri benötigt zur Zeit ein Leerzeichen
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - CLI
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-4-errata
Assigned To: Marius Meschter
Florian Best
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-17 14:52 CEST by Arvid Requate
Modified: 2023-08-02 16:06 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.006
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): bitesize
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate univentionstaff 2011-10-17 14:52:16 CEST
Die Syntax des uri Parameters von shares/printer ist in UDM cli unter ucs_3.0 etwas eigenartig:

root@master:~# udm shares/printer create --set name=printer2 --set spoolHost=$hostname.$domainname --set uri=file://tmp/printer2 --set model="foomatic-rip/linuxprinting.org-gs-builtin/Generic/Generic-PostScript_Printer-Postscript.ppd.gz" --position cn=printers,$ldap_base 
E: Invalid Syntax: Verbindung: Nicht genug Parameter

root@master:~# udm shares/printer create --set name=printer2 --set spoolHost=$hostname.$domainname --set uri='file:/ /tmp/printer2' --set model="foomatic-rip/linuxprinting.org-gs-builtin/Generic/Generic-PostScript_Printer-Postscript.ppd.gz" --position cn=printers,$ldap_base 
Object created: cn=printer2,cn=printers,dc=arucs3ms2i2,dc=qa
Comment 1 Moritz Muehlenhoff univentionstaff 2013-05-23 11:35:23 CEST
Im neuen Handbuch gibt es bald einen Abschnitt, in dem verschiedene Beispielaufrufe für den UDM-CLI vorgestellt werden. Dort wird auf das Leerzeichen zwischen URI und URI-Zielpfad nochmal hingewiesen.

Ich denke wir sollten den aktuellen CLICode so belassen; es gibt zu viele bestehende Einträge im bestehenden Format. Außerdem würde eine Änderung bestehende Skripte stören.
Comment 2 Philipp Hahn univentionstaff 2017-03-29 10:24:40 CEST
udm-cli alread provides a better error message:
> E: Invalid Syntax: Connection: Protocol and destination have to be specified.


handlers/shares/printer.py:
115 »···'uri': univention.admin.property(
118 »···»···syntax=univention.admin.syntax.PrinterURI,

syntax.py
3328 class PrinterProtocol(UDM_Attribute):
3329 »···udm_module = 'settings/printeruri'                                                                         
3330 »···attribute = 'printeruri'
...
3334 class PrinterURI(complex):
3335 »···subsyntaxes = ((_('Protocol'), PrinterProtocol), (_('Destination'), string))
...
3341 »···»···if self.min_elements is not None:
3342 »···»···»···count = self.min_elements
3343 »···»···else:
3344 »···»···»···count = len(self.subsyntaxes) if 'pdf' not in texts[0] else len(self.subsyntaxes) - 1
3345 
3346 »···»···if len(texts) < count:
3347 »···»···»···raise univention.admin.uexceptions.valueInvalidSyntax(_('Protocol and destination have to be specified.'))

So PrinterURI already has some special handling and could be extended easily to split schema://host:port/path
Comment 3 Marius Meschter univentionstaff 2023-07-31 14:55:36 CEST
protocol and path of a printer URI can now be parsed when given without a whitespace via the UDM CLI

univention-directory-manager-modules.yaml
216cd165cc76 | feat: parse udm cli printer uri without whitespace

univention-directory-manager-modules (15.0.24-15)
216cd165cc76 | feat: parse udm cli printer uri without whitespace

ucs-test (10.0.15-16)
216cd165cc76 | feat: parse udm cli printer uri without whitespace
Comment 4 Marius Meschter univentionstaff 2023-08-01 17:36:49 CEST
only sanitize the printer URI when it has actually changed

univention-directory-manager-modules.yaml
a8106be2a05c | fix(udm): only sanitize printer URI if changed
216cd165cc76 | feat: parse udm cli printer uri without whitespace

univention-directory-manager-modules (15.0.24-16)
a8106be2a05c | fix(udm): only sanitize printer URI if changed
Comment 5 Florian Best univentionstaff 2023-08-02 10:31:35 CEST
OK: URIs can be specified via command line (only)
OK: the detection if the scheme is separated with :/ or :// is correct
OK: exceptional cases for cups-pdf and file:/
OK: error handling moved partly from syntax class into _ldap_pre_ready
OK: sanitization is only done during create or modification of uri
OK: new test cases cover new behavior
OK: YAML advisory
Comment 6 Christian Castens univentionstaff 2023-08-02 16:06:23 CEST
<https://errata.software-univention.de/#/?erratum=5.0x756>