leoarnold / puppet-cups

Puppet module for the Common Unix Printing System (CUPS)
https://forge.puppetlabs.com/leoarnold/cups
MIT License
9 stars 34 forks source link

Ubuntu 20.04 - Could not prefetch cups_queue provider 'cups' #414

Open jamesps-ebi opened 3 years ago

jamesps-ebi commented 3 years ago

Given Ubuntu 20.04, Puppet 6.24, CUPS 2.3.1, leoarnold-cups 2.2.2 When I apply the manifest

class hg_desktop::profile::cups
{

  # Printer driver file
  $ppd_name = 'KOC658UX.ppd'
  $ppd_path = "/usr/share/cups/model/${ppd_name}"

  # Install printer drivers
  file { $ppd_path:
    mode    => '0644',
    owner   => 'root',
    group   => 'root',
    source  => "puppet:///modules/hg_desktop/cups/ppd/${ppd_name}",
    require => Class[ 'cups::packages' ],
  }

  # Include Common Unix Printing System
  class { 'cups':
    default_queue => 'Follow_You',
  }

  # Please note for SMB protocol to work, samba client package
  # needs to be installed in the system.
  Class[ 'profile::hiera::packages' ]
  ->
  cups_queue { 'Follow_You':
    ensure       => 'printer',
    enabled      => true,
    accepting    => true,
    description  => 'EBI Follow_You Printing',
    ppd          => $ppd_path,
    uri          => 'smb://EBI/HARDCOPY/Follow_You',
    require      => File[ $ppd_path ],
  }
  ->
  cups_queue { 'FollowMe':
    ensure => absent,
  }

}

In order to add a new network/SMB printer queue Then I get the following error when running puppet agent -t on the node

Could not prefetch cups_queue provider 'cups': IPP query 'ipptool -t ipp://localhost/ /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION CUPS-Get-Printers
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
DISPLAY printer-name
}

STDOUT:
"/dev/stdin":
/dev/stdin [FAIL]
RECEIVED: 11038 bytes in response
status-code = client-error-bad-request ("media-type-supported": Bad keyword value "thick-1(-2nd)" - invalid character (RFC 8011 section 5.1.4).)
"media-type-supported": Bad keyword value "thick-1(-2nd)" - invalid character (RFC 8011 section 5.1.4).
printer-name (nameWithoutLanguage) = test_new

STDERR:

This is a config we previously had working on Ubuntu 18.04 with cups 2.2.7 and leoarnold-cups 2.0.2 and we're now testing on Ubuntu 20.04 nodes. As far as I can tell the printer in question IS added but is left disabled and not accepting jobs by default (also the above error from puppet agent logs).

leoarnold commented 3 years ago

Note the lines

status-code = client-error-bad-request ("media-type-supported": Bad keyword value "thick-1(-2nd)" - invalid character (RFC 8011 section 5.1.4).)
"media-type-supported": Bad keyword value "thick-1(-2nd)" - invalid character (RFC 8011 section 5.1.4).

If you compare RFC 8011 section 5.1.4, you will find that thick-1(-2nd) is not a valid keyword because of the parentheses.

If you adjust that line in the PPD file, everything should be okay again I guess. Not sure why CUPS is suddenly(?) picky about this, but keep in mind that Debian / Ubuntu apply their own maintainer patches before building OS packages.

leoarnold commented 3 years ago

See also https://github.com/leoarnold/puppet-cups/issues/6#issuecomment-225221877 and https://github.com/leoarnold/puppet-cups/issues/61#issuecomment-426715209.

jamesps-ebi commented 3 years ago

Thanks for your input. I'll look into your suggestion and see if I can solve this via the PPD file.

jamesps-ebi commented 3 years ago

Looks like you're right. Similar to #6 (comment) I have manually removed any lines from the PPD containing parentheses and the puppet manifest now successfully runs, though I have no idea what the impact of this would be.

So I've reached out to the printer manufacturer to explain the issue since even the latest driver PPD files have this problem. I think this issue can probably be closed since it's more a problem with the printer driver itself.