Univention Bugzilla – Bug 24081
shares/printer parameter uri benötigt zur Zeit ein Leerzeichen
Last modified: 2023-08-02 16:06:23 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
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.
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
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
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
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
<https://errata.software-univention.de/#/?erratum=5.0x756>