Comments (15)
Interesting issue. The investigation might take a little more back and forth than usual, but will surely be beneficial for both sides, as puppet-cups
aims to manage cupsd.conf
from version 2.0 onwards. Please note that Puppet 3.x has reached end of life, so future versions of the module will drop support.
My first assumption towards the problem would be that the module's mechanism for queue discovery fails. So I would kindly ask you to ...
- Check whether the binary
/usr/bin/ipptool
is present. If not, upgrading to the latest version ofpuppet-cups
from the Puppet Forge might already solve your issue. - Ensure that the managed queues are actually present using
lpstat -t
. - Paste the output of the command
ipptool -c ipp://localhost/ request.ipp
using
# request.ipp
{
OPERATION CUPS-Get-Printers
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
STATUS successful-ok
DISPLAY printer-name
}
from puppet-cups.
Here are the results if the ipptool command against the request.ipp script:
root@print:/home/me# ipptool -c ipp://localhost/ request.ipp
printer-name
lpstat -t:
scheduler is running
no system default destination
device for HP-LaserJet-M506-81: socket://172.16.0.81:9100
device for HP-LaserJet-M506DN-243: socket://172.16.0.243:9100
device for HP-LJP-P2055DN-202: socket://172.16.0.202:9100
HP-LaserJet-M506-81 accepting requests since Fri 27 Jan 2017 03:06:36 PM CST
HP-LaserJet-M506DN-243 accepting requests since Fri 27 Jan 2017 03:06:37 PM CST
HP-LJP-P2055DN-202 accepting requests since Fri 27 Jan 2017 03:06:36 PM CST
printer HP-LaserJet-M506-81 is idle. enabled since Fri 27 Jan 2017 03:06:36 PM CST
printer HP-LaserJet-M506DN-243 is idle. enabled since Fri 27 Jan 2017 03:06:37 PM CST
printer HP-LJP-P2055DN-202 is idle. enabled since Fri 27 Jan 2017 03:06:36 PM CST
Also the version of ipptool:
# whereis ipptool
ipptool: /usr/bin/ipptool /usr/share/man/man1/ipptool.1.gz
# ipptool --version
CUPS v2.1.3
In regards to Puppet v3; Are you saying that this module won't be compatible with v4 or I need to make changes to my files to make them work with Puppet 4?
The tagged version of puppet-cups we use in our Puppetfile is 1.2.2.
Update:
I commented out in my code any changes to /etc/cups/cupsd.conf and cups.cocket. I reverted to a previous snapshot in my test system to rerun puppet agent -t. When testing with the ipptool command you suggested I get this:
# ipptool -c ipp://localhost/ request.ipp
printer-name
HP-LaserJet-M506-81
HP-LaserJet-M506DN-243
HP-LJP-P2055DN-202
from puppet-cups.
I set up a test environment with the CUPS configuration you provided and was not able to verify your issue. ipptool
listed all installed queues as expected.
Let me list our evidence in your environment:
- The queues are definitely installed and available locally on the node as per
lpstat -t
. - CUPS is definitely running and listening on port 631, otherwise the
ipptool
request would fail. - CUPS will not expose the available queues to the
ipptool
request.
My next assumption would be that there is a typo in your cupsd.conf
, since Port 631
means Listen *:631
, which is in conflict with Listen localhost:631
.
My guess would be, that Nginx is listening on (say) port 8080 and then internally proxypassing the requests on to CUPS at localhost:631
which should not be exposed. If so, I suggest you delete Port 631
and just use Listen localhost:631
in your cupsd.conf
.
from puppet-cups.
As for compatibility: At the top, you stated that you are using Puppet 3.8.5 (which EOLed in Dec 2016).
leoarnold-cups
v1.x.x supports Puppet 3.x.x and 4.x.x.leoarnold-cups
v2.x.x will not work on Puppet 3.x.x anymore because it uses Puppet 4 syntax.
If leoarnold-cups
v1.x.x works for you, it will keep working if you transition to Puppet 4.
When leoarnold-cups
v2.0 ships and you want to benefit from the new options discussed in #7, you will have to run Puppet 4 and of course adapt your code, because you will want to get rid of your workaround for cupsd.conf
and use the new cups::server
class then.
Also, I am thinking about integrating your systemd
-fix in leoarnold-cups
v2.0, as it seems necessary to maintain idempotence.
from puppet-cups.
Thank you. I appreciate you working with me on some of the issues that may not be related to the puppet-cups module.
I am working on testing what you have suggested. I am testing one change at a time. It looks like /lib/systemd/system/cups.socket may need localhost:631 also, as you mentioned 631 implies *:631. When only using 631, puppet would recreate the printers on each run. When using localhost:631 (as you recommended for the cupsd.conf file) Puppet would not recreate those printers.
I also noticed that a reboot was needed in between some of these changes. Simply restarting cups was not sufficient (or stop cups, make change, start cups) for Puppet to stop recreating printers. I suspect I am missing something here but I can get by rebooting.
Background: We are transitioning to Puppet 4 shortly. I look forward to working on it. Thank you for the helpful information.
from puppet-cups.
@lordbink Once tried and tested, please document your findings here. It could drastically reduce my need for experimentation and thereby accelerate the development of the module.
from puppet-cups.
For reference, here is the cups systemd bug report and some possible solutions. My approach may or may not have been appropriate. It worked for our needs and there doesn't seem to be any problems with it. If you think of any let me know.
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1598300
As for the localhost:631 setting in cupsd.conf, you are absolutely correct. Once I removed port 631 and simply left "Listen localhost:631", puppet stopped recreating those printers. I will be doing more testing as this project progresses and definitely let you know what I find.
I am struggling with my nginx configuration, but I am assuming that is a completely separate issue unrelated to leoarnold-cups
. I think it is related to my lack of understanding the best way to configure the cupsd.conf file with nginx.
from puppet-cups.
Update:
ListenStream localhost:631
does not do anything in the way of keeping the web interface running. It also keeps other things from working like the web interface.
The following are my results from testing. I had to create a table to keep my own sanity in check. Every change I made was followed by a reboot to verify that those settings took. systemctl daemon-reload
and /etc/init.d/cups restart
did not seem to make a difference when applying changes. I was also connecting directly to http://host:631 directly, to eliminate potential issues from my nginx configuration.
cupsd.conf | cups.socket | web remote access | ipptool tests show printers | Cups keeps running |
---|---|---|---|---|
Listen 631 | ListenStream=631 | Yes | No | yes |
Listen localhost:631 | ListenStream=localhost:631 | no | yes | no |
Listen localhost:631 | ListenStream=631 | Yes | No | Yes |
Listen 631 | ListenStream=localhost:631 | Yes | No | No |
Listen localhost:631 | <blank - no setting> | No | Yes | No |
Listen 631 | <blank - no setting> | Yes | No | No |
I am pretty sure that I am not configuring cups correctly. Is there a setting other than Listen localhost:631
in cupsd.conf that will work with the ipptool command? Or is there a way to allow Listen 631
to work?
from puppet-cups.
There may be a difference with cups 2.1.3-4 and 2.2.02-2 in how Listen
is handled in cupsd.conf
or how ipptools works. Through aggressive pinning on my LTS Xenial install I was able to get cups updated using the Yakkety repos. Port 631
alone was able to work with ipptools as well as the web interface.
I will investigate this further as it creates other problems for me. At least I know there are some differences between the two cups versions and I can work with that in mind. I would be tempted to simply upgrade to Yakkety if it was LTS, although using pinned packages may invalidate that approach.
from puppet-cups.
I went back to stock Xenial for my cups packages. If I enable sharing for the printer, ipptool seems to work and thus puppet does not need to re-add the printer.
## Add printers to system. Adapted for Hiera.
define cups_print::resource::add_printer(
## Variable names should be the same from cups.conf
$ensure = $::cups_print::ensure,
$model = $::cups_print::driver,
$connection = $::cups_print::connection,
$accepting = true, ## Default setting
$shared = true, ## Default setting ## should be true for ipp to work
$enabled = true, ## Default setting
)
{
validate_re($ensure, '^(printer|class|absent)$',
"${ensure} is not supported for ensure. Allowed values are 'printer', 'class', and 'absent'.")
case $ensure {
'printer', default: {
cups_queue { $name:
ensure => $ensure,
model => $model,
uri => $connection,
accepting => $accepting,
shared => $shared,
enabled => $enabled,
}
}
# 'class':{} ##WIP
# 'absent':{} ##WIP
}
}
from puppet-cups.
Here is an update to my add_printer.pp resource:
## Add printers to system. Adapted for Hiera.
define mbx_cups_print::resource::add_printer(
## Variable names should be the same from printers.conf
$ensure = $::cups_print::ensure,
$model = $::cups_print::driver,
$connection = $::cups_print::connection,
$location = $::cups_print::location,
$description = $::cups_print::description,
$accepting = true,
$shared = true, ## This needs to be true for ipptools to work
$enabled = true,
)
{
validate_re($ensure, '^(printer|absent)$',
"${ensure} is not supported for ensure. Allowed values are 'printer' and 'absent'.")
case $ensure {
'printer', 'absent', default: {
if $model != 'raw' { ## raw printers do not have options and will error
cups_queue { $name:
ensure => $ensure,
location => $location,
description => $description,
model => $model,
uri => $connection,
accepting => $accepting,
shared => $shared,
enabled => $enabled,
require => Package['hplip'], ## make sure all drivers are available
options => {'PageSize' => 'Letter',}, ## offsite printing: move to hiera if we need A4
}
}
else {
cups_queue { $name:
ensure => $ensure,
location => $location,
description => $description,
model => $model,
uri => $connection,
accepting => $accepting,
shared => $shared,
enabled => $enabled,
require => Package['hplip'], ## make sure all drivers are available
}
}
}
# 'class':{} ## This will need to be looked at and tested
}
}
We had some issues setting default paper size. I am uncertain if 'options' should be allowed to be blank/udefined. Some variation of the following simply did not work:
if $model != 'raw' { ## raw printers do not have options
$options = "{'PageSize' => 'Letter',}"
}
else {
$options = "''"
}
...
cups_queue { $name:
...
options => $options,
...
}
...
Error:
Error: Failed to apply catalog: Parameter options failed on Cups_queue[HP-LaserJet-M506DN-243]: Please provide a hash value. at /etc/puppet/environments/signal_print_updates/modules/cups_print/manifests/resource/add_printer.pp:40
This is not an issue for us, but a continuation of what I have done previously by sharing my experiences. I hope this is beneficial. There may be a better approach to this that I have not thought of.
from puppet-cups.
No priority. Simply updating existing scripts. At some point when I get on the master branch (or 2.0) for my environment I will consider simply creating a branch to eventually be pushed/merged with the main project.
## define: mbx_cups_print::resource::add_printer
## Add printers to system. Adapted for Hiera.
define mbx_cups_print::resource::add_printer(
## Variable names should be the same from printers.conf
$ensure = $::cups_print::ensure,
$model = $::cups_print::driver,
$connection = $::cups_print::connection,
$location = $::cups_print::location,
$description = $::cups_print::description,
$pagesize = $::cups_print::pagesize,
$duplex = $::cups_print::duplex,
$accepting = true,
$shared = true, ## This needs to be true for ipptools to work
$enabled = true,
)
{
validate_re($ensure, '^(printer|absent)$',
"${ensure} is not supported for ensure. Allowed values are 'printer' and 'absent'.")
## This could be better. TODO: It is hard to gauge what to do with only one
## printer to use the duplex option.
## TODO: Option1 works when the settings are already correct (it does not rerun the job)
## It does not work when it tried to change this setting
if $duplex != undef {
$set_options = {
'Duplex' => $duplex, ##Duplex/2-Sided Printing: None *DuplexNoTumble DuplexTumble
'Option1' => 'True', ## Option1/Duplexer: False *True
'PageSize' => $pagesize, ## offsite printing: allow a4
}
}
else {
$set_options = { 'PageSize' => $pagesize,} ## offsite printing: allow a4
}
case $ensure {
'printer', 'absent', default: {
if $model != 'raw' { ## raw printers do not have options and will error
cups_queue { $name:
ensure => $ensure,
location => $location,
description => $description,
model => $model,
uri => $connection,
accepting => $accepting,
shared => $shared,
enabled => $enabled,
require => Package['hplip'], ## make sure all drivers are available
options => $set_options,
}
}
else {
cups_queue { $name:
ensure => $ensure,
location => $location,
description => $description,
model => $model,
uri => $connection,
accepting => $accepting,
shared => $shared,
enabled => $enabled,
require => Package['hplip'], ## make sure all drivers are available
}
}
}
# 'class':{} ## This will need to be looked at and tested
}
}
from puppet-cups.
@lordbink Not sure if I caught up with all your questions:
- The
options
key will not handle strings, should be fine with empty hashes, i.e.{}
. - As far as I understand you removed the systemd workaround from your setup.
- As of 0da4c5d,
Class[cups]
can manage theListen
andWebinterface
directives incupsd.conf
. All others will be set to package vendor defaults.
Anything else? Or can we close the issue?
from puppet-cups.
Closing due to inactivity. Reopen if necessary.
from puppet-cups.
@tequeter I opted for a standalone class now. May those include it who run into problems:
https://github.com/leoarnold/puppet-cups#systemd-based-linux-distributions
from puppet-cups.
Related Issues (20)
- Module cannot be upgraded from 1.2.2 to 2.2.0 without first loading 2.0.x HOT 3
- /var/log/cups/error_log flooded with SSL errors HOT 4
- [Feature] Structured facts with printer capabilities HOT 4
- Add possibility to restrict queue usage based on IP addresses HOT 6
- Deprecation message prevents creation of queue HOT 4
- Could not prefetch cups_queue provider 'cups' on Ubuntu 18.04 HOT 14
- [Feature] Configurability for MaxJobs and PreserveJobHistory HOT 3
- Configuration for MaxSubscriptions (needed for > 100 clients)
- Depfu Error: Depfu is stuck and needs your help
- Depfu Error: Depfu is stuck and needs your help
- spec/acceptance/puppet/cups_issue_4766_spec.rb fails on centos7 HOT 2
- "Unable to connect" on slow restart (EL7) HOT 1
- Error on "purge_unmanaged_queues" with CUPS stopped HOT 2
- Depfu Error: Depfu is stuck and needs your help
- Depfu Error: Depfu is stuck and needs your help
- Please add an options hash
- Enhancement Request : need MaxJobsPerPrinter directive to be added in cupsd template file _directives.erb HOT 2
- AuthInfoRequired username,password setup HOT 2
- Ubuntu 20.04 - Could not prefetch cups_queue provider 'cups' HOT 4
- Failure to add IPP Everywhere queue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppet-cups.