Univention Bugzilla – Bug 53598
cups-pdf printer setup broken for printermoderation
Last modified: 2021-11-29 17:19:48 CET
current setup creates a PDFDrucker like this DN: cn=PDFDrucker,cn=printers,dc=five,dc=local ACLtype: allow all description: Moderierter PDF-Drucker location: None model: None name: PDFDrucker producer: cn=misc,cn=cups,cn=univention,dc=five,dc=local sambaName: None spoolHost: master.five.local uri: cups-pdf:/ . with this, only one job is stored in "/var/spool/cups-pdf/%U" -> lp -d PDFDrucker /etc/fstab # (4x) -> find /var/spool/cups-pdf/Administrator/fstab__ol_cups-pdf_root.pdf and it is an empty pdf with this setup (model, uri!) DN: cn=PDFDrucker,cn=printers,dc=five,dc=local ACLtype: allow all description: Moderierter PDF-Drucker location: None model: cups-pdf/CUPS-PDF_noopt.ppd name: PDFDrucker producer: cn=PDF,cn=cups,cn=univention,dc=five,dc=local sambaName: None spoolHost: master.five.local uri: None it works -> lp -d PDFDrucker /etc/fstab # (4x) -> find find /var/spool/cups-pdf/Administrator/ /var/spool/cups-pdf/Administrator/ /var/spool/cups-pdf/Administrator/job_39-fstab__ol_cups-pdf_Administrator.pdf /var/spool/cups-pdf/Administrator/job_37-fstab__ol_cups-pdf_Administrator.pdf /var/spool/cups-pdf/Administrator/job_38-fstab__ol_cups-pdf_Administrator.pdf /var/spool/cups-pdf/Administrator/job_36-fstab__ol_cups-pdf_Administrator.pdf so probably 99ucs-school-umc-printermoderation.inst has to be modified (installation, update)
dc16c7c1e18d372e88eb3789498acea80035c5c9 - ucs-school-umc-printermoderation set proper model (cups-pdf/CUPS-PDF_noopt.ppd) and uri (cups-pdf:/) for PDFDrucker QA: test update and installation
1. ldapmodify needs to be called with Administrator credentials, otherwise: modifying entry "cn=PDFDrucker,cn=printers,l=school,l=dev" ldap_modify: Insufficient access (50) Object exists: cn=PDFDrucker,cn=printers,l=school,l=dev 2. Please use udm instead of ldapmodify to set the value: --set 'uri="cups-pdf:/" ""' 3. Please add `|| die` error handling to the modify-call, otherwise failure in 1 looks like successful. 4. The new value is not compliant with what UDM displays on the CLI: PrinterURI.tostring() returns None for that URI. We should patch the UDM syntax classs in a cloned bug: diff --git management/univention-directory-manager-modules/modules/univention/admin/syntax.py management/univention-directory-manager-modules/modules/univention/admin/syntax.py index f19ea715fd..36fbec58e4 100644 --- management/univention-directory-manager-modules/modules/univention/admin/syntax.py +++ management/univention-directory-manager-modules/modules/univention/admin/syntax.py @@ -434,7 +434,7 @@ class complex(ISyntax): return self.delimiter.join(texts) # FIXME: s/(delimiter)s/\1/ - return ''.join([s for sub in zip(self.delimiters, texts) for s in sub] + [self.delimiter[-1]]) + return ''.join([s for sub in zip(self.delimiter, texts) for s in sub] + [self.delimiter[-1]]) @classmethod def new(self): @@ -5352,6 +5352,8 @@ class PrinterURI(complex): Syntax to configure printer. >>> PrinterURI.parse(["uri://", "localhost"]) ['uri://', 'localhost'] + >>> PrinterURI.parse(["cups-pdf:/", ""]) + ['cups-pdf:/', ''] >>> PrinterURI.parse(["uri://", None]) #doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... @@ -5367,6 +5369,7 @@ class PrinterURI(complex): """ subsyntaxes = ((_('Protocol'), PrinterProtocol), (_('Destination'), string)) subsyntax_names = ('protocol', 'destination') + all_required = False @classmethod def parse(self, texts): @@ -5383,17 +5386,13 @@ class PrinterURI(complex): if len(texts) > len(self.subsyntaxes): raise univention.admin.uexceptions.valueInvalidSyntax(_("too many arguments")) - for i in range(len(texts)): - ud.debug(ud.ADMIN, ud.INFO, 'syntax.py: self.subsyntax[%s] is %s, texts is %s' % (i, self.subsyntaxes[i], texts)) - if not inspect.isclass(self.subsyntaxes[i][1]): - s = self.subsyntaxes[i][1] - else: - s = self.subsyntaxes[i][1]() - if texts[i] is None: - if self.min_elements is None or (i + 1) < self.min_elements: - raise univention.admin.uexceptions.valueInvalidSyntax(_("Invalid syntax")) - p = s.parse(texts[i]) - if p: + for i, (text, (desc, syn)) in enumerate(zip(texts, self.subsyntaxes)): + ud.debug(ud.ADMIN, ud.INFO, 'syntax.py: subsyntax[%s]=%s, text=%s' % (i, syn, text)) + if text is None and (self.min_elements is None or (i + 1) < count): + raise univention.admin.uexceptions.valueInvalidSyntax(_("Invalid syntax: %s > %s") % (self.name, desc,)) + s = syn() if inspect.isclass(syn) else syn + p = s.parse(text) + if p is not None: parsed.append(p) return parsed
5. model=$(univention-ldapsearch -b "$dn" | sed -ne 's|univentionPrinterModel: ||p') → please include the filter instead of using sed: univention-ldapsearch -b "$dn" '(|(univentionPrinterModel=None)(!(univentionPrinterModel=*)))' dn
4. has been outsourced into Bug #53702
fixed
OK :-)
UCS@school 5.0 v1 has been released. https://docs.software-univention.de/release-notes-ucsschool-5.0v1-de.html If this error occurs again, please clone this bug.