Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Could not set 'printer' on ensure: Unexpected response from CUPS server. #23

Closed
bittner opened this issue Aug 11, 2017 · 14 comments
Closed

Comments

@bittner
Copy link

bittner commented Aug 11, 2017

Given Ubuntu 17.04 Zesty with Puppet Agent 4.8.2 and CUPS 2.2.2 (leoarnold-cups 1.2.2)

When I apply the manifest (e.g. by running puppet agent --test)

class profile::workstation {
  include cups

  cups_queue { 'HP_Officejet_Pro_6830':
    ensure    => 'printer',
    model     => 'drv:///hpcups.drv/hp-officejet_pro_6830.ppd',
    uri       => 'hp:/net/Officejet_Pro_6830?ip=172.23.56.90',
    require   => Package['hplip'],
    accepting => true,
    enabled   => true,
  }

  package {[
      'hplip',
    ]:
    ensure => present,
  }
}

In order to set up the HP Officejet Pro 6830 printer

Then I get the error message:

Could not set 'printer' on ensure: Unexpected response from CUPS server. at /etc/puppetlabs/code/environments/production/site/profile/manifests/workstation.pp:19
Wrapped exception:
Unexpected response from CUPS server.
Error: /Stage[main]/Profile::Workstation/Cups_queue[HP_Officejet_Pro_6830]/ensure: change from absent to printer failed: Could not set 'printer' on ensure: Unexpected response from CUPS server. at /etc/puppetlabs/code/environments/production/site/profile/manifests/workstation.pp:19

Interestingly, the CUPS error log remains untouched, but the CUPS access log confirms everything has gone well:

# tail -f /var/log/cups/access_log
localhost - - [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 401 192 CUPS-Add-Modify-Printer successful-ok
localhost - root [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 200 192 CUPS-Add-Modify-Printer successful-ok
localhost - - [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 401 223 CUPS-Add-Modify-Printer successful-ok
localhost - root [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 200 223 CUPS-Add-Modify-Printer successful-ok
localhost - - [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 401 44196 CUPS-Add-Modify-Printer successful-ok
localhost - root [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 200 44196 CUPS-Add-Modify-Printer successful-ok
localhost - - [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 401 191 CUPS-Add-Modify-Printer successful-ok
localhost - root [11/Aug/2017:19:59:21 +0200] "POST /admin/ HTTP/1.1" 200 191 CUPS-Add-Modify-Printer successful-ok

The printer (and scanner) is installed successfully and seems to be usable on the target system afterwards. The hp-... tools are installed, http://localhost:631 reports the printer to be available.

What is going on here? I'm puzzled. Can you explain?

It would help if there was no error being reported when all is good. Am I doing something wrong?

@leoarnold
Copy link
Owner

The module uses the ipptool command line utility to perform most of it's queries. In Ubuntu 16.10 and later, this tool seems to execute the queries correctly, but fails to return the results to stdout.

This seems to be a Ubuntu problem, since the same Version of Cups works perfectly in Fedora 25.

This is why no version of the module claims to be compatible with your version of Ubuntu (yet). Even the current master/HEAD only provides a clearer error message, but cannot yet work around the issue.

Closing as duplicate of #19.

@bittner
Copy link
Author

bittner commented Aug 11, 2017

Thanks Leo!

@leoarnold
Copy link
Owner

I have looked into the matter and it would help me very much in debugging if you could go to the system (with the printer set up correctly) and provide the output of the command

ipptool -t ipp://localhost/printers/HP_Officejet_Pro_6830 Get-Printer-Attributes.ipp

using this file: Get-Printer-Attributes.ipp

@bittner
Copy link
Author

bittner commented Aug 20, 2017

Okay, I'll try. Can you reopen the issue? Thanks!

And ... thanks for dedicating yourself to the issue! I appreciate that a lot.

@bittner
Copy link
Author

bittner commented Aug 20, 2017

On a Debian 8.8 Jessie box (our old setup we're about to replace) I get:

"Desktop/Get-Printer-Attributes.ipp":
    Desktop/Get-Printer-Attributes                                       [PASS]
        printer-is-shared (boolean) = false

Not sure if this helps already.

The Ubuntu 17.04 Zesty box (this is where the Puppet issue comes up) I can't set up again today (for technical reasons that I need to fix during office hours). Let me come back to you about this tomorrow.

@leoarnold
Copy link
Owner

This issue was closed as a duplicate of an open issue. It is still a duplicate and therefore will remain closed.

I really need the output on your desired target system in order to see whether you experience the Zesty issue I have identified (and probably can fix) or something else subject to your specific configuration.

@bittner
Copy link
Author

bittner commented Aug 21, 2017

$ ipptool -t ipp://localhost/printers/HP_Officejet_Pro_6830 Get-Printer-Attributes.ipp 
"Get-Printer-Attributes.ipp":
    Get-Printer-Attributes                                               [FAIL]
        RECEIVED: 9270 bytes in response
        status-code = successful-ok (successful-ok)
        Duplicate "pwg-raster-document-type-supported" attribute in printer-attributes-tag group
        Duplicate "pwg-raster-document-resolution-supported" attribute in printer-attributes-tag group
        Duplicate "pwg-raster-document-sheet-back" attribute in printer-attributes-tag group
        printer-is-shared (boolean) = false

(Not sure if the printer is already set up correctly and working since I have issues with logging in to the desktop.)

@leoarnold
Copy link
Owner

See, the request is all good, and in the last line, we even get the desired value. But due to this Debian patch, we get those pwg-raster* fields twice - sometimes even with different values in them - causing the [FAIL].

I'll implement a workaround for this scenario and ship it with version 2.0 of the module.

@bittner
Copy link
Author

bittner commented Aug 21, 2017

Thank you!

@bittner
Copy link
Author

bittner commented Sep 19, 2017

Any progress on this? Is there anything I can do to support the implementation of the workaround?

@leoarnold
Copy link
Owner

The implementation is pretty much done. Acceptance tests are passing for Yakkety and Zesty. I'm preparing the major release, but that will still take some doc polishing. You can try this prerelease in the meantime.

@bittner
Copy link
Author

bittner commented Oct 5, 2017

I have a hard time using the .tar.gz pre-release file for installing with Puppet (r10k, really). Do you have a branch in a repo that I can refer to from within our Puppetfile?

This repo doesn't seem to have any branches other than master. Where are the changes?

@leoarnold
Copy link
Owner

This repo doesn't seem to have any branches other than master. Where are the changes?

In master.

@bittner
Copy link
Author

bittner commented Oct 6, 2017

Great! -- I can confirm the installation works without error status using the implementation from master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants