leoarnold / puppet-cups Goto Github PK
View Code? Open in Web Editor NEWPuppet module for the Common Unix Printing System (CUPS)
Home Page: https://forge.puppetlabs.com/leoarnold/cups
License: MIT License
Puppet module for the Common Unix Printing System (CUPS)
Home Page: https://forge.puppetlabs.com/leoarnold/cups
License: MIT License
Given RHEL 7.5 with Puppet 5.5.8 and CUPS 1.6.3.
When I apply the manifest
class { 'cups':
web_interface => true,
browsing => true,
}
In order to enable browsing
Then Browsing
should be set to On
:
https://github.com/leoarnold/puppet-cups/blob/master/templates/cupsd.conf.erb#L9
The default settings for these are 500
jobs and PreserveJobHistory
is true.
This means that up to 500 job files will be kept in the spool directory. For large jobs, this easily adds up to GB of data.
It would be nice to be able to configure MaxJobs
and / or PreserveJobHistory
with this module to limit hefty space usage in case full history is not needed.
Given Centos7 with Ruby 2.0.0, Puppet 3.8.7 and CUPS 1.6.3.
When I apply the manifest
include '::cups'
class { '::cups':
purge_unmanaged_queues => 'true'
}
In order to Remove unwanted queues
Then I get the error message:
Error: Could not parse for environment production: Syntax error at 'purge_unmanaged_queues' at /root/cups-install/cups.pp:4:2 on node...
Given CentOS 7.7 with Puppet 5.5.17 and CUPS 1.6.3.
When I have about 150 clients.
In order to Support 150 clients.
Then I get the error message:
E [14/Jan/2020:13:25:39 +0100] Returning IPP client-error-too-many-subscriptions for Create-Printer-Subscription (/)
every minute in cups error log.
Solution
Define MaxSubscriptions
(and of course, max_clients
which this module already supports).
In total, there are four variables of interest here:
MaxSubscriptions
MaxSubscriptionsPerJob
MaxSubscriptionsPerPrinter
MaxSubscriptionsPerUser
It would be nice to see this supported (since this is the natural extension of the max_clients
property). The default within cups seems to be 100 maximum subscribers.
I’m not sure if this is the same issue as #12 – there seem to be a lot of things in there which aren’t directly related to my problem.
Given Ubuntu 17.10 with Puppet Agent 4.10.4 and CUPS 2.2.4. I haven’t changed anything about the default CUPS configuration (e. g. cupsd.conf
) that comes with Ubuntu 17.10.
When I apply the manifest
printers.pp
class { cups:
default_queue => 'usbprint',
papersize => a4,
}
cups_queue { 'usbprint':
ensure => printer,
uri => 'usb://Dell/Color%20MFP%20S2825cdn?serial=FH8080296&interface=1',
model => 'lsb/usr/Dell/Dell_Color_MFP_S2825cdn.ppd.gz',
enabled => true,
accepting => true,
shared => false,
}
cups_queue { 'netprint1':
ensure => printer,
uri => 'smb://print.example.com/netprint1',
model => 'postscript-hp:0/ppd/hplip/HP/hp-laserjet_5100_series-ps.ppd',
accepting => true,
}
cups_queue { 'netprint2':
ensure => printer,
uri => 'smb://print2.example.com/netprint2',
model => 'drv:///hpcups.drv/hp-laserjet_p4014dn.ppd',
accepting => true,
}
In order to set up local and network printers
Then I get the error message:
Not an error message, but each time I run puppet apply
, the printers seem to be recreated:
# puppet apply printers.pp
Notice: Compiled catalog for pc.ad.example.com in environment production in 0.17 seconds
Notice: /Stage[main]/Main/Cups_queue[usbprint]/ensure: created a printer
Notice: /Stage[main]/Main/Cups_queue[netprint1]/ensure: created a printer
Notice: /Stage[main]/Main/Cups_queue[netprint2]/ensure: created a printer
Notice: Applied catalog in 1.23 seconds
Additional information:
/usr/bin/ipptool
is presentlpstat -t
:# lpstat -t
scheduler is running
system default destination: usbprint
device for netprint1: smb://print.example.com/netprint1
device for netprint2: smb://print2.example.com/netprint2
device for usbprint: usb://Dell/Color%20MFP%20S2825cdn?serial=FH8080296&interface=1
netprint1 accepting requests since Fri 20 Oct 2017 04:15:07 PM CEST
netprint2 accepting requests since Fri 20 Oct 2017 04:15:07 PM CEST
usbprint accepting requests since Sat 21 Oct 2017 11:47:29 AM CEST
printer netprint1 disabled since Fri 20 Oct 2017 04:15:07 PM CEST -
reason unknown
printer netprint2 disabled since Fri 20 Oct 2017 04:15:07 PM CEST -
reason unknown
printer usbprint is idle. enabled since Sat 21 Oct 2017 11:47:29 AM CEST
# 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
}
the output of ipptool -c ipp://localhost/ request.ipp
is
# ipptool -c ipp://localhost/ request.ipp
successful-ok
Setting shared => true
on the printers did not have any effect.
Given Ubuntu 16.10 Yakkety with Puppet Agent 4.9.3 and CUPS 2.2.
When I run
puppet resource cups_queue
And queues are present on the node
Then I get no output (v1.2.2) or an error message about an RFC (v2.0.0).
Note This problem does NOT occur on Fedora 25 which also runs CUPS 2.2.
Given Scientific Linux 6 with Ruby 1.8.7, Puppet 3.6.2 and CUPS 1.4.2.
Due to the way my inheritance is structured, there is the possibility that a system may inherit the cups module, but I'd rather it not run the cups service.
For example:
I include the cups module for all managed workstations. However, there are no defined printers for systems within the kiosk area. If the cups service is not running, attempts to print result in an error given to the user indicating printing will not work from that system. If the cups service is running, users are not given such an error and they often expect the print job to "do something". I am attempting to explicitly manage the service as disabled.
Selectively disabling the service for a specific host group is less complex for our structure than adding the module for a bunch of host groups.
Given Ubuntu 16.04 with Ruby 2.3.0, Puppet 3.8.5 and CUPS 2.1.3.
We have a printer that is specified like this (buggy printer)
N3423_Multifunction_Color:
uri: 'ksmb://ads/tu00000-swprint.ads.mwn.de/TUEILNT-N3423_Multifunction'
description: 'KonicaMinolta C364e BizHub Multifunction Printer for Stapled Color Print'
location: 'N3423 Printers Room'
ppd: '/etc/cups/ppd/N3423_Multifunction_Color.ppd'
(The PPD is copied before to the node and it's there, the ksmb protocol is a custom addition, and the shown hiera fragment gets passed to the corresponding arguments of a Cups_queue
instance.).
To compare, a printer defined like this works: (working printer)
N3423_BW:
uri: 'ksmb://ads/tu00000-swprint.ads.mwn.de/TUEILNT-N3423_BW'
description: 'HP LaserJet Enterprise 600 M602x Black and White Printer'
location: 'N3423 Printers Room'
model: 'postscript-hp:2/ppd/hplip/HP/hp-laserjet_600_m601_m602_m603-ps.ppd'
The significant difference here is the use of the model
parameter, and not the ppd
parameter.
When running puppet, the printer gets added, but we see the following error in the puppet agent log:
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -v /dev/null'
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -P /etc/cups/ppd/N3423_Multifunction_Color.ppd'
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -v ksmb://ads/tu00000-swprint.ads.mwn.de/TUEILNT-N3423_Multifunction'
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -D KonicaMinolta C364e BizHub Multifunction Printer for Stapled Black and White Print'
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -L N3423 Printers Room'
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -o SelectColor=Grayscale'
Debug: Executing '/usr/sbin/lpadmin -E -p N3423_Multifunction_BW -o printer-is-shared=false'
Debug: Cups_queue[N3423_Multifunction_BW](provider=cups): Circumventing CUPS issue #4781 by temporarily allowing access for 'root'
Error: Could not set 'printer' on ensure: Unexpected response from CUPS server.
Error: Could not set 'printer' on ensure: Unexpected response from CUPS server.
Wrapped exception:
Unexpected response from CUPS server.
Error: /Stage[main]/All::Profile::Printing/Cups_queue[N3423_Multifunction_BW]/ensure: change from absent to printer failed: Could not set 'printer' on ensure: Unexpected response from CUPS server.
Unfortunately the error message is not very helpful, so I applied this patch to get more debug output, and that's what we get now:
err Puppet Could not set 'printer' on ensure: Unexpected response from CUPS server.
resource:/printers/N3423_Multifunction_BW
request:
{
OPERATION get-printer-attributes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
ATTR uri printer-uri $uri
STATUS successful-ok
DISPLAY requesting-user-name-denied
}
STDOUT:
STDERR:
successful-ok
Executing the same commands as the puppet-cups module does on the console for the non-working and the working printer results in that:
$ echo '{OPERATION get-printer-attributes GROUP operation ATTR charset attributes-charset utf-8 ATTR language attributes-natural-language en ATTR uri printer-uri $uri STATUS successful-ok DISPLAY requesting-user-name-denied }' | ipptool -c 'ipp://localhost/printers/N3423_Multifunction_BW' /dev/stdin
successful-ok
$ echo $?
1
$ echo '{OPERATION get-printer-attributes GROUP operation ATTR charset attributes-charset utf-8 ATTR language attributes-natural-language en ATTR uri printer-uri $uri STATUS successful-ok DISPLAY requesting-user-name-denied }' | ipptool -c 'ipp://localhost/printers/N3423_BW' /dev/stdin
requesting-user-name-denied
$ echo $?
0
The cups /var/log/cups/error_log
on that node when executing these commands shows this (timestamps removed). Essentially, the CUPS seems to send the same response in both cases.
non-working case:
[Client 1] Accepted from localhost:57342 (IPv6)
[Client 1] Waiting for request.
[Client 1] POST /printers/N3423_Multifunction_BW HTTP/1.1
cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
[Client 1] Read: status=200
[Client 1] No authentication data provided.
[Client 1] 1.1 Get-Printer-Attributes 84942
Get-Printer-Attributes ipp://localhost:631/printers/N3423_Multifunction_BW
[Client 1] Returning IPP successful-ok for Get-Printer-Attributes (ipp://localhost:631/printers/N3423_Multifunction_BW) from localhost
[Client 1] Content-Length: 10844
[Client 1] cupsdSendHeader: code=200, type="application/ipp", auth_type=0
[Client 1] con->http=0x55ba199d8d20
[Client 1] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_LENGTH, data_remaining=10844, response=0x55ba19a1a2b0(IPP_STATE_DATA), pipe_pid=0, file=-1
[Client 1] Writing IPP response, ipp_state=IPP_STATE_DATA, old wused=0, new wused=0
[Client 1] bytes=0, http_state=0, data_remaining=10844
[Client 1] Flushing write buffer.
[Client 1] New state is HTTP_STATE_WAITING
[Client 1] Waiting for request.
cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
[Client 1] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
[Client 1] Closing connection.
cupsdSetBusyState: newbusy="Not busy", busy="Not busy"
working case:
[Client 4] Accepted from localhost:57564 (IPv6)
[Client 4] Waiting for request.
[Client 4] POST /printers/N3423_BW HTTP/1.1
cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
[Client 4] Read: status=200
[Client 4] No authentication data provided.
[Client 4] 1.1 Get-Printer-Attributes 104670
Get-Printer-Attributes ipp://localhost:631/printers/N3423_BW
[Client 4] Returning IPP successful-ok for Get-Printer-Attributes (ipp://localhost:631/printers/N3423_BW) from localhost
[Client 4] Content-Length: 9075
[Client 4] cupsdSendHeader: code=200, type="application/ipp", auth_type=0
[Client 4] con->http=0x5571c8917d20
[Client 4] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_LENGTH, data_remaining=9075, response=0x5571c8925ec0(IPP_STATE_DATA), pipe_pid=0, file=-1
[Client 4] Writing IPP response, ipp_state=IPP_STATE_DATA, old wused=0, new wused=0
[Client 4] bytes=0, http_state=0, data_remaining=9075
[Client 4] Flushing write buffer.
[Client 4] New state is HTTP_STATE_WAITING
[Client 4] Waiting for request.
cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
[Client 4] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
[Client 4] Closing connection.
cupsdSetBusyState: newbusy="Not busy", busy="Not busy"
I don't know where things go wrong. I have the feeling ipptool is not behaving as it should, but do you have an idea why? I think the main difference between the two printers is the PPD file, but I don't see how that would influence this particular request?
Maybe I'm missing something here, but after setting shared => true
on a cups_queue
it is still impossible to print on that queue from the network, because the cupsd.conf
template has the root Location hardcoded with a default-deny and without any allow:
<Location />
Order allow,deny
</Location>
As far as I know about CUPS, to actually be able to print from the network there must be an Allow @LOCAL
(to allow printing from the subnets CUPS is listening on, this is what cupsctl --share-printers
does) or an Allow all
(to allow printing from remote subnets, this is what cupsctl --share-printers --remote-any
does) in the root location.
If this is correct I'd propose a new parameter on the cups
class to choose between those three alternatives (no allows, allow local, allow all) and/or a list or hash to let the user specify more fine-grained access rules.
Given SmartOS x86_64 with Puppet v5 and CUPS 1.5.
When I apply the manifest
class cups_print_server
{
include cups
cups_queue { 'MinimalRaw':
ensure => 'printer',
uri => 'lpd://192.168.2.105/binary_p1'
}
}
In order to Create a print queue
Then I get the error message:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/cups_queue: /home/david.hromyk/.puppetlabs/etc/code/environments/internal/modules/cups/lib/puppet/type/cups_queue.rb:104: unknown type of %string
return "created a #{should_to_s(new_value)}" unless %i[class printer].include?(current_value)
^ (file: /home/david.hromyk/.puppetlabs/etc/code/environments/internal/modules/cups_print_server/manifests/init.pp, line: 6, column: 3) on node ops-b3-print02.lrscorp.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Hi,
I'm trying to use the module on Ubuntu 16.04 (xenial), which comes with cups 2.1.3. Currently, the module only installs the "cups" package, which does not contain the ipptool binary. So the package should install cups-ipp-utils as well (available since Ubuntu 15.10, see http://packages.ubuntu.com/search?keywords=cups-ipp-utils). For Debian, it looks like the next release will have that package as well (https://packages.debian.org/search?keywords=cups-ipp-utils).
Could you add that to the default list of packages?
Philipp
Given Archlinux with Puppet 6.8.1 and CUPS 2.3.0.
When I apply the manifest
include '::cups'
cups_queue { "Home_Brother_test":
ensure => "printer",
accepting => true,
description => "Brother Home Test",
enabled => true,
shared => false,
uri => "ipp://172.20.0.20:80/",
model => "drv:///cupsfilters.drv/pwgrast.ppd",
}
# Your manifest here
In order to create a new queue
Then I get the error message:
Error: Execution of '/usr/bin/lpadmin -p Home_Brother_test -m drv:///cupsfilters.drv/pwgrast.ppd' returned 1: lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.
lpadmin: Unable to open PPD "/tmp/a1cf35d836ea5": Missing asterisk in column 1 on line 1.
Error: /Stage[main]/Workstation::Flony/Cups_queue[Home_Brother_test]/ensure: change from absent to printer failed: Execution of '/usr/bin/lpadmin -p Home_Brother_test -m drv:///cupsfilters.drv/pwgrast.ppd' returned 1: lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.
lpadmin: Unable to open PPD "/tmp/a1cf35d836ea5": Missing asterisk in column 1 on line 1.
NB: it used to work (last use was in october 2018), so an upgrade of cups broke the module. Also, creating the queue manually and then running the module correctly detects it as "done"
Given macos 10.12 sierra with Puppet Agent 4.9.0.
When The module is installed on the server but not used on the mac client, I know you don't support Darwin although I would love you to ;)
In order to apply catalog on client
Then agent hangs for ages on all 4 of you cups facts and sometimes it even fails to complete. At best it takes over 20 minutes to run. After I uninstalled this module it runs in seconds but I use this module for linux clients.
Facter: fact "cups_classes" has resolved to [].
Facter: fact "cups_classmembers" has resolved to {}.
Facter: fact "cups_printers" has resolved to [].
Facter: fact "cups_queues" has resolved to [].
Given Ubuntu 18.04.1 with Puppet 5.5.6 and CUPS 2.2.7.
When I apply the manifest
lookup('classes', {merge => unique}).include
in site.pp and then the following hiera:
classes:
- types
- ksmb
- cups
types::files:
'/usr/share/cups/model/KOC658UX.ppd':
ensure: file
replace: yes
source: puppet:///modules/fileserver/ppds/KOC658UX.ppd
mode: '0644'
group: lp
cups::resources:
USB_Building_Printing:
ensure: printer
uri: ksmb://cs-print/USB-BUILDING-PRINTING
ppd: '/usr/share/cups/model/KOC658UX.ppd'
make_and_model: 'KONICA MINOLTA C658SeriesPS(P)'
shared: false
enabled: true
accepting: true
description: All Urban Sciences printers, swipe your campus card at any printer to collect your job.
options:
KMDuplex: 2Sided
PageSize: A4
PaperSources: PC215
Finisher: FS533
KOPunch: PK519-4
SaddleUnit: None
PrinterHDD: HDD
SelectColor: Grayscale
Model: C458
TextPureBlack: On
cups::default_queue: USB_Building_Printing
cups::papersize: A4
In order to create a ksmb queue using the Konica Minolta driver sourced in the manifest.
Then I get the error message:
(run puppet agent -td)
Debug: IPP query 'ipptool -c ipp://localhost/printers/USB_Building_Printing /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION Get-Printer-Attributes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
ATTR uri printer-uri $uri
STATUS successful-ok
DISPLAY device-uri
}
STDOUT:
STDERR:
successful-ok
Debug: Executing: '/usr/sbin/lpadmin -E -p USB_Building_Printing -o KMDuplex=2Sided'
Debug: Executing: '/usr/sbin/lpadmin -E -p USB_Building_Printing -o PageSize=A4'
Debug: Executing: '/usr/sbin/lpadmin -E -p USB_Building_Printing -o PaperSources=PC215'
Debug: Executing: '/usr/sbin/lpadmin -E -p USB_Building_Printing -o Finisher=FS533'
Debug: Executing: '/usr/sbin/lpadmin -E -p USB_Building_Printing -o KOPunch=PK519-4'
Error: Execution of '/usr/sbin/lpadmin -E -p USB_Building_Printing -o KOPunch=PK519-4' returned 1: lpadmin: Success
Error: /Stage[main]/Cups::Queues::Resources/Cups_queue[USB_Building_Printing]/options: change from {"Finisher"=>"FS533", "KMDuplex"=>"2Sided", "KOPunch"=>"None", "Model"=>"C658", "PageSize"=>"A4", "PaperSources"=>"PC215", "PrinterHDD"=>"HDD", "SaddleUnit"=>"None", "SelectColor"=>"Auto", "TextPureBlack"=>"Auto"} to {"Finisher"=>"FS533", "KMDuplex"=>"2Sided", "KOPunch"=>"PK519-4", "Model"=>"C458", "PageSize"=>"A4", "PaperSources"=>"PC215", "PrinterHDD"=>"HDD", "SaddleUnit"=>"None", "SelectColor"=>"Grayscale", "TextPureBlack"=>true} failed: Execution of '/usr/sbin/lpadmin -E -p USB_Building_Printing -o KOPunch=PK519-4' returned 1: lpadmin: Success
Notice: /Stage[main]/Cups::Queues::Default/Exec[cups::queues::default]: Dependency Cups_queue[USB_Building_Printing] has failures: true
Warning: /Stage[main]/Cups::Queues::Default/Exec[cups::queues::default]: Skipping because of failed dependencies
Debug: /Stage[main]/Cups::Queues::Default/Exec[cups::queues::default]: Resource is being skipped, unscheduling all events
Debug: Class[Cups::Queues::Default]: Resource is being skipped, unscheduling all events
Debug: Class[Cups::Queues::Resources]: Resource is being skipped, unscheduling all events
Debug: Class[Cups::Queues]: Resource is being skipped, unscheduling all events
Debug: Class[Cups]: Resource is being skipped, unscheduling all events
Info: Class[Cups]: Unscheduling all events on Class[Cups]
Even thought the queue has been added (lpstat -p
confirms it), I get red error text in the Puppet run, and the setting of the default queue and restarting of the daemon is skipped.
Each time I attempt the Puppet run, the key-value pair in /usr/sbin/lpadmin -E -p USB_Building_Printing -o key=value
is different, but each time the last one says "returned 1: lpadmin: Success". If I run those lpadmin commands at the command line as root, they exit with 0.
If the papersize is specified, this module does not ensure that the corresponding libpaper(-utils) package is installed (containing the used paperconfig
tool) even if package_manage
is set to true
. As a result this module fails if the command paperconfig
is not available.
It would be nice to be able to restrict queue usage based on IP addresses. It seems that at the moment access control is only possible based on user/group information.
HI,
to use your module i need the ppd-package
for Debian : openprinting-ppds
for Suse: OpenPrintingPPDs
I have insert this manually in the file: manifests/params.pp
so that all host will install this packages.
Hello,
ServerAlias & ServerName are needed in order to avoid a cupsd bug.
E [06/Feb/2019:15:24:17 +0100] [Client 243] Request from "7.7.7.7" using invalid Host: field "print.domain.tld:631".
That bug exist if you use FQDN in the ipp queue URI, eg. "ipp://print.domain.tld:631/printers/printer1"
The workaround is to use "ServerAlias *" in cupsd.conf
Given the current master 35efb59 and current Vagrant box bento/centos-7.6 (virtualbox, 201907.24.0)
.
When I run the acceptance testsuite for centos7
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_destroy=no bundle exec rake beaker:centos-7.6-x64
In order to get some patches ready for review.
Then I get the error message:
Failures:
1) Circumventing CUPS issue #4766 when ensuring a queue when is shared via IPP by some remote host when 'shared' is set to true fails to apply changes
Failure/Error: command = apply_manifest(manifest, expect_failures: true)
Beaker::Host::CommandFailure:
Host 'centos-7-x64' exited with 2 running:
puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest.pp.qn2oBl
Last 10 lines of output were:
Info: Loading facts
Info: Loading facts
Notice: Compiled catalog for centos-7-x64.fr.dgs.group in environment production in 0.05 seconds
Info: Applying configuration version '1581696287'
Notice: /Stage[main]/Main/Cups_queue[Office]/ensure: created a printer
Notice: Applied catalog in 0.10 seconds
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/host.rb:395:in `exec'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/helpers/host_helpers.rb:83:in `block in on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/shared/host_manager.rb:130:in `run_block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/patterns.rb:37:in `block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/helpers/host_helpers.rb:63:in `on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-puppet-1.18.11/lib/beaker-puppet/helpers/puppet_helpers.rb:529:in `block in apply_manifest_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/shared/host_manager.rb:130:in `run_block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/patterns.rb:37:in `block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-puppet-1.18.11/lib/beaker-puppet/helpers/puppet_helpers.rb:457:in `apply_manifest_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-puppet-1.18.11/lib/beaker-puppet/helpers/puppet_helpers.rb:536:in `apply_manifest'
# ./spec/acceptance/puppet/cups_issue_4766_spec.rb:52:in `block (5 levels) in <top (required)>'
2) Circumventing CUPS issue #4766 when ensuring a queue when is shared via IPP by some remote host when 'shared' is set to false fails to apply changes
Failure/Error: command = apply_manifest(manifest, expect_failures: true)
Beaker::Host::CommandFailure:
Host 'centos-7-x64' exited with 2 running:
puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest.pp.YIK9KE
Last 10 lines of output were:
Info: Loading facts
Info: Loading facts
Notice: Compiled catalog for centos-7-x64.fr.dgs.group in environment production in 0.05 seconds
Info: Applying configuration version '1581696290'
Notice: /Stage[main]/Main/Cups_queue[Office]/ensure: created a printer
Notice: Applied catalog in 7.24 seconds
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/host.rb:395:in `exec'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/helpers/host_helpers.rb:83:in `block in on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/shared/host_manager.rb:130:in `run_block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/patterns.rb:37:in `block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/helpers/host_helpers.rb:63:in `on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-puppet-1.18.11/lib/beaker-puppet/helpers/puppet_helpers.rb:529:in `block in apply_manifest_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/shared/host_manager.rb:130:in `run_block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-4.14.1/lib/beaker/dsl/patterns.rb:37:in `block_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-puppet-1.18.11/lib/beaker-puppet/helpers/puppet_helpers.rb:457:in `apply_manifest_on'
# ./vendor/bundle/ruby/2.5.0/gems/beaker-puppet-1.18.11/lib/beaker-puppet/helpers/puppet_helpers.rb:536:in `apply_manifest'
# ./spec/acceptance/puppet/cups_issue_4766_spec.rb:74:in `block (5 levels) in <top (required)>'
Finished in 8 minutes 17 seconds (files took 1 minute 16.87 seconds to load)
147 examples, 2 failures
Failed examples:
rspec ./spec/acceptance/puppet/cups_issue_4766_spec.rb:51 # Circumventing CUPS issue #4766 when ensuring a queue when is shared via IPP by some remote host when 'shared' is set to true fails to apply changes
rspec ./spec/acceptance/puppet/cups_issue_4766_spec.rb:73 # Circumventing CUPS issue #4766 when ensuring a queue when is shared via IPP by some remote host when 'shared' is set to false fails to apply changes
Indeed, on that Vagrant box, it does not seem to be an error to share an IPP queue:
[root@centos-7-x64 ~]# lpadmin -p test -v ipp://127.0.0.1/printers/MyPrinter
[root@centos-7-x64 ~]# lpadmin -E -p test -o printer-is-shared=false
[root@centos-7-x64 ~]# lpadmin -E -p test -o printer-is-shared=true
[root@centos-7-x64 ~]# rpm -q cups
cups-1.6.3-40.el7.x86_64
Would it make sense to retain the first example in that file (most important AFAICT) and remove the two that fail, as they are testing a varying behavior of CUPS rather than the module?
It would be useful to have printer capabilities available per queue via structured facts, i.e. the output of lpoptions -p Office -l
in a way useable in Puppet.
Our use case would be to create a webpage using puppetlabs-concat
which contains a table with a link to the queue name, driver installation script and printer capabilities (A3, colour etc.) for each queue.
Given Red Hat Enterprise Linux Server release 7.4 (Maipo) with Puppet 2017.2.1 and CUPS cups-1.6.3-29.el7.x86_64.
When I apply the manifest
class { '::cups':
listen => [ 'localhost:631', '/var/run/cups/cups.sock', "${::fqdn}:631" ],
web_interface => true,
}
In order to
Install the cups software and make the web interface accessible from off the machine.
Then I get the error message when attempting to access the web interface on ${::fqdn}:631
Forbidden
I then disabled puppet and added the line
Allow from all to the cupsd.conf
<Location />
Order allow,deny
Allow from all
</Location>
<Location /admin>
Order allow,deny
Allow from all
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow from all
</Location>
<Location /admin/log>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow from all
</Location>
I think the template needs to account for Allow from options. Omitting them seems to not allow access from off the box. Ideally you would be able to pass different IPs to the Allow from attributes.
I very much appreciate your hiera integration. With Puppet 3, a hiera look up is automatic.
I'm looking to drive this from an ENC rather than hiera. Can the hiera lookups be switched to class parameters (around https://github.com/leoarnold/puppet-cups/blob/master/manifests/init.pp#L55 ) so that I can pass them in via my ENC?
This would provide me significantly cleaner integration while not breaking existing hiera users.
Thoughts?
(relevant link: https://docs.puppet.com/hiera/1/puppet.html#automatic-parameter-lookup)
Hi,
If possible, please create a new version as it's still use the v2.0.3 in puppet ( https://forge.puppet.com/leoarnold/cups ) and you can greatly improve it since :
released this on 18 Jan · 73 commits to master since this release
Given Ubuntu 16.04 with Puppet 4.10.9cups and CUPS 2.1.3-4.
When I apply the manifest with puppet agent -t
on a node
class profile::config_printers {
include '::cups'
# Using a suitable model from the output of the command lpinfo -m on the node
cups_queue { 'Hackerspace_BW_Printer_LexmarkT644':
ensure => 'printer',
model => 'foomatic-db-compressed-ppds:0/ppd/foomatic-ppd/Lexmark-T644-Postscript.ppd',
uri => 'socket://192.168.43.101', # Replace with your printer's URI
accepting => true,
enabled => true,
options => {
'Duplex' => 'DuplexNoTumble',
}
}
Then I get the error message, but only the first time it runs. The next time it runs fine.
Notice: /Stage[main]/Cups::Packages/Package[cups-ipp-utils]/ensure: created
Notice: /Stage[main]/Cups::Server::Config/File[/etc/cups/cupsd.conf]/content:
--- /etc/cups/cupsd.conf 2018-01-28 18:34:17.929267910 -0800
+++ /tmp/puppet-file20180206-20699-yiavls 2018-02-06 14:46:11.991882507 -080
... etc...
Notice: /Stage[main]/Cups::Server::Config/File[/etc/cups/cupsd.conf]/content: content changed '{md5}32590abea589afef53ecf6c9ba672a6f' to '{md5}7e38c409f60039663ffbc3560cb1fb87'
Notice: /Stage[main]/Cups::Server::Config/File[/etc/cups/cupsd.conf]/group: group changed 'root' to 'lp'
Notice: /Stage[main]/Cups::Server::Config/File[/etc/cups/cupsd.conf]/mode: mode changed '0644' to '0640'
Info: Class[Cups::Server::Config]: Scheduling refresh of Class[Cups::Server::Services]
Info: Class[Cups::Server::Services]: Scheduling refresh of Service[cups]
Notice: /Stage[main]/Cups::Server::Services/Service[cups]: Triggered 'refresh' from 1 events
Error: Failed to apply catalog: IPP query 'ipptool -c ipp://localhost/ /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION CUPS-Get-Classes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
DISPLAY printer-name
DISPLAY member-names
}
STDOUT:
STDERR:
ipptool: Unable to connect to localhost on port 631 - Transport endpoint is not connected
Given Ubuntu 18.04 LTS with Puppet 6.4.2 and CUPS 2.2.7 and leoarnold/cups 2.2.2.
When I apply the manifest
I use roles and profiles. The profiles::printing class follows:
class profiles::printing {
# for convenience so I don't type the same thing over and over
$ppdpath = '/usr/share/cups/model'
$models = ['KMC759ux.ppd']
case $facts['lsbdistid'] {
'Raspbian': {
$packages = ['cups-bsd', 'a2ps']
}
default: {
$packages = ['cups-bsd', 'a2ps', 'indicator-printers']
}
}
include ksmb # this is a single-class module that installs the "ksmb" kerberised SMB backend.
class { 'cups':
default_queue => 'USB_Building_Printing',
papersize => 'A4',
}
package { $packages:
ensure => installed,
}
file { $ppdpath: ensure => directory }
$models.each | $model | {
file { $model:
ensure => file,
replace => yes,
source => "puppet:///modules/profiles/ppds/${model}",
path => "${ppdpath}/${model}",
group => 'lp',
mode => '0644',
}
}
cups_queue { 'USB_Building_Printing':
ensure => 'printer',
uri => 'ksmb://cs-print/USB-BUILDING-PRINTING',
ppd => "${ppdpath}/KMC759ux.ppd",
shared => false,
enabled => true,
accepting => true,
description => 'All Urban Sciences printers, swipe your campus card at any printer to collect your job.',
options => {
'KMDuplex' => '2Sided',
'PageSize' => 'A4',
'InputSlot' => 'Tray4',
'PaperSources' => 'PC215',
'Finisher' => 'FS533',
'KOPunch' => 'PK519-4',
'SaddleUnit' => 'None',
'PrinterHDD' => 'HDD',
'SelectColor' => 'Grayscale',
'Model' => 'C458',
'TextPureBlack' => 'On',
},
}
}
iptables-save says -A INPUT -i lo -m comment --comment "002 accept all loopback traffic" -j ACCEPT
in respect of traffic to 127.0.0.1.
I don't think it's #6 again because my doctored ppd file passes ipptool:
~/git/PUPPET/puppet5(50-rolesprofiles) » cupstestppd site/profiles/files/ppds/KMC759ux.ppd
site/profiles/files/ppds/KMC759ux.ppd: PASS
In order to manage the pull printer queues.
Then I get the error message:
Debug: /Stage[main]/Cups::Server::Config/File[/etc/cups/lpoptions]: Nothing to manage: no ensure and the resource doesn't exist
Debug: Class[Cups::Server::Config]: The container Stage[main] will propagate my refresh event
Debug: Class[Cups::Server::Config]: The container Class[Cups::Server] will propagate my refresh event
Info: Class[Cups::Server::Config]: Scheduling refresh of Class[Cups::Server::Services]
Info: Class[Cups::Server::Services]: Scheduling refresh of Service[cups]
Debug: Executing: '/bin/systemctl is-active cups'
Debug: Executing: '/bin/systemctl is-enabled cups'
Debug: Executing: '/bin/systemctl is-active cups'
Debug: Executing: '/bin/systemctl show cups --property=NeedDaemonReload'
Debug: Executing: '/bin/systemctl restart cups'
Notice: /Service[cups]: Triggered 'refresh' from 1 event
Debug: /Service[cups]: The container Class[Cups::Server::Services] will propagate my refresh event
Debug: Class[Cups::Server::Services]: The container Stage[main] will propagate my refresh event
Debug: Class[Cups::Server::Services]: The container Class[Cups::Server] will propagate my refresh event
Debug: Class[Cups::Server]: The container Stage[main] will propagate my refresh event
Debug: Class[Cups::Server]: The container Class[Cups] will propagate my refresh event
Debug: Prefetching cups resources for cups_queue
Error: Could not prefetch cups_queue provider 'cups': IPP query 'ipptool -c ipp://localhost/ /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION CUPS-Get-Classes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
DISPLAY printer-name
DISPLAY member-names
}
STDOUT:
STDERR:
ipptool: Unable to connect to localhost on port 631 - Operation now in progress
Debug: Storing state
Debug: Pruned old state cache entries in 0.00 seconds
Debug: Stored state in 0.02 seconds
Error: Failed to apply catalog: IPP query 'ipptool -c ipp://localhost/ /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION CUPS-Get-Classes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
DISPLAY printer-name
DISPLAY member-names
}
STDOUT:
STDERR:
ipptool: Unable to connect to localhost on port 631 - Operation now in progress
Removing the queue with lpadmin -x doesn't solve the problem.
The same manifest on a Raspbian 9.4 Pi running Puppet 4.8.2 gives:
Debug: Exec[cups::papersize](provider=posix): Executing check 'cat /etc/papersize | grep -w A4'
Debug: Executing: 'cat /etc/papersize | grep -w A4'
Debug: Exec[cups::papersize](provider=posix): Executing 'paperconfig -p A4'
Debug: Executing: 'paperconfig -p A4'
Notice: /Stage[main]/Cups::Server::Config/Exec[cups::papersize]/returns: executed successfully
Debug: /Stage[main]/Cups::Server::Config/Exec[cups::papersize]: The container Class[Cups::Server::Config] will propagate my refresh event
Debug: /Stage[main]/Cups::Server::Config/File[/etc/cups/lpoptions]: Nothing to manage: no ensure and the resource doesn't exist
Debug: Class[Cups::Server::Config]: The container Stage[main] will propagate my refresh event
Debug: Class[Cups::Server::Config]: The container Class[Cups::Server] will propagate my refresh event
Info: Class[Cups::Server::Config]: Scheduling refresh of Class[Cups::Server::Services]
Info: Class[Cups::Server::Services]: Scheduling refresh of Service[cups]
Debug: Executing: '/bin/systemctl is-active cups'
Debug: Executing: '/bin/systemctl is-enabled cups'
Debug: Executing: '/bin/systemctl is-active cups'
Debug: Executing: '/bin/systemctl restart cups'
Notice: /Stage[main]/Cups::Server::Services/Service[cups]: Triggered 'refresh' from 1 events
Debug: /Stage[main]/Cups::Server::Services/Service[cups]: The container Class[Cups::Server::Services] will propagate my refresh event
Debug: Class[Cups::Server::Services]: The container Stage[main] will propagate my refresh event
Debug: Class[Cups::Server::Services]: The container Class[Cups::Server] will propagate my refresh event
Debug: Prefetching cups resources for cups_queue
Debug: Storing state
Debug: Stored state in 0.55 seconds
Error: Failed to apply catalog: IPP query 'ipptool -c ipp://localhost/ /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION CUPS-Get-Classes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
DISPLAY printer-name
DISPLAY member-names
}
STDOUT:
STDERR:
ipptool: Unable to connect to localhost on port 631 - Operation now in progress
Given Centos7 with Ruby 2.0.0, Puppet 3.8.7 and CUPS 1.6.3.
When I apply the manifest
In order to Install Printer Drivers Using Open Printing
Then Not implemented
It would be great if there was a way to specify which print drivers you wanted to install via open printing (http://www.openprinting.org/printers) or maybe even from manufacturers downloads.
Way more bonus points if it can implement Windows Printer Driver auto install as well (https://wiki.samba.org/index.php/Configuring_Point'n'Print_automatic_printer_driver_deployment)
Hello,
In most cases that means something is wrong with your current Bundler setup and we can't fix it automatically:
Bundler Error: Could not find gem 'puppet (= 5.5.18, ~> 6.0)' in any of the gem sources listed in your Gemfile.
Bundler Error: Could not find gem 'puppet (= 5.5.17, ~> 6.0)' in any of the gem sources listed in your Gemfile.
Bundler Error: Could not find gem 'puppet (= 5.5.16, ~> 6.0)' in any of the gem sources listed in your Gemfile.
After you've fixed the problem, please activate this project again in the Depfu Dashboard.
👉 We will not send you further PRs until this is fixed and the repo is activated again.
If you need help or this looks like an error on our side, please send us an email.
Given Ubuntu 16.04 with Ruby 2.3.0, Puppet 3.8.5 and CUPS 2.1.3
When I apply the manifest
include '::cups'
# default cups settings
Cups_queue {
accepting => true,
enabled => true,
}
cups_queue { 'name':
ensure => 'printer',
uri => 'socket://url:9100',
description => 'xxx',
model => 'postscript-hp:0/ppd/hplip/HP/hp-laserjet_400_m401dne-ps.ppd',
location => 'xxx',
}
the printer is set to enabled = false/accepting = false. When I add enabled/accepting to the cups_queue instance (not to the default), the queues are accepting and enabled. So it seems the default values are not taken into account.
Do you need any additional logs for that? Which ones?
Requesting RHEL 6 support.
Given RHEL 6.9 with Puppet Enterprise 2017.3 and CUPS cups-1.4.2-78.el6_9.x86_64.
When I have tried to configure via Hiera data as follows:
cups::web_interface: false
cups::package_manage: false
cups::resources:
mylp:
ensure: printer
uri: lpd://print.domain.lcl/mylp
In order to Do basic print queue configuration
Then I get the error message:
With package_manage set to true/default:
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install cups-ipptool' returned 1: Error: Nothing to do
Error: /Stage[main]/Cups::Packages/Package[cups-ipptool]/ensure: change from purged to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install cups-ipptool' returned 1: Error: Nothing to do
With package_manage set to false:
Error: /Stage[main]/Cups::Server::Services/Service[cups]: Failed to call refresh: Could not start Service[cups]: Execution of '/sbin/service cups start' returned 1: Starting cups: cupsd: Child exited with status 1!
[FAILED]
Error: /Stage[main]/Cups::Server::Services/Service[cups]: Could not start Service[cups]: Execution of '/sbin/service cups start' returned 1: Starting cups: cupsd: Child exited with status 1!
[FAILED]
Info: Class[Cups]: Unscheduling all events on Class[Cups]
Info: Stage[main]: Unscheduling all events on Stage[main]
Error: Could not find a suitable provider for cups_queue
Sorry for bringing this up again.
The AuthInfoRequired is actually a queue option, for example:
<Printer 155LG.G10-ToshibaEstudio2540c>
UUID urn:uuid:27a6e0d3-c410-3f47-7bf3-6c403d5dfdea
AuthInfoRequired username,password
Info 155LG.G10-ToshibaEstudio2540c
MakeModel TOSHIBA ColorMFP
DeviceURI smb://uom-print.unimelb.edu.au/155LG.G10-ToshibaEstudio2540c
State Stopped
StateTime 1486697339
ConfigTime 1486697341
Type 8433884
Accepting No
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
</Printer>
Other options are "none" and "negotiate". This will trigger cups to prompt for a password before shelling out the print command.
I think you implemented it as a printer option. Could that be changed please? Sorry for the confusion.
Thanks.
Uli
Given Ubuntu 16.10 with Puppet Agent 3.8.7. CUPS is not yet installed and would have been installed fresh onto this PC by this Puppet module, had it worked.
When I apply the manifest
class { 'cups':
papersize => 'A4',
webinterface => true,
}
cups_queue { 'PostRoom826':
ensure => 'printer',
uri => 'ksmb://fontburn64.campus.ncl.ac.uk/CompSci826',
ppd => "${::ksmb::ppdpath}/KMbeuC554ux.ppd",
accepting => true,
enabled => true,
}
In order to add CUPS with a kerberised samba print queue. The "ksmb://" URI is for the kerberisation backend and works using this version of puppet-cups on Debian Jessie.
Then I get the error message:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/cups_queue: /etc/puppet/modules/cups/lib/puppet/type/cups_queue.rb:185: syntax error, unexpected ':', expecting ')'
newproperty(:members, array_matching: :all) do
^
/etc/puppet/modules/cups/lib/puppet/type/cups_queue.rb:252: syntax error, unexpected kEND, expecting $end on node 16dcompl018.ncl.ac.uk
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Checking the error_log
, I find tons of these during each puppet run, making the log almost unparseable to a human:
E [16/Jun/2019:18:08:21 +0200] Fatal error during SSL shutdown!
E [16/Jun/2019:18:08:24 +0200] Fatal error during SSL shutdown!
I can reproduce that running lpoptions -E -p queuename -l
. Dropping the -E
, the error vanishes.
It seems that is some kind of inconvenience / bug at least in CUPS on RHEL 7.6.
However, that makes me wonder whether the easiest solution would be to just drop -E
here:
puppet-cups/lib/puppet/provider/cups_queue/cups.rb
Lines 310 to 319 in e191aa5
-E
is also not used in README.md
, for example.Given
init.pp
class cups_print (
$add_printer = {},
){
include cups
## Need for custom config settings
file { '/etc/cups/cupsd.conf':
ensure => 'file',
owner => 'root',
group => 'lp',
mode => '0644',
source => 'puppet:///modules/cups_print/etc/cups/cupsd.conf',
require => Package['cups'],
notify => Service['cups'],
}
## Need this otherwise cups stops running after 6 minutes ## would like better work around
file { '/lib/systemd/system/cups.socket':
source => 'puppet:///modules/cups_print/etc/cups/cups.socket',
require => Package[ 'cups' ],
mode => '0644',
owner => 'root',
notify => Service['cups'],
}
## Using nginx for PAM/Cups Authentication
file { '/etc/pam.d/nginx':
ensure => 'file',
path => '/etc/pam.d/nginx',
content => '@include common-auth',
}
create_resources('cups_print::resource::add_printer', $add_printer )
}
cupsd.conf
LogLevel info
Port 631
Browsing Off
DefaultAuthType None
ServerAlias *
Listen localhost:631
DefaultEncryption Never ## use nginx for ssl
<Location />
Allow From All
</Location>
<Location /admin>
Order allow,deny
Allow From All
</Location>
<Location /admin/conf>
Order allow,deny
Allow From All
</Location>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order allow,deny
Allow From All
</Limit>
add_printer.pp
## define: cups_print::resource::add_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 = false, ## Default setting
$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
}
}
hierra: print.domain.com.yaml
## Cups specific settings:
cups_print::add_printer:
'HP-LaserJet-M506DN-243':
ensure: 'printer'
model: 'raw'
#model: 'drv:///sample.drv/generic.ppd'
connection: 'socket://172.16.0.243:9100'
'HP-LJP-P2055DN-202':
ensure: 'printer'
model: 'lsb/usr/cupsfilters/pxlmono.ppd'
connection: 'socket://172.16.0.202:9100'
'HP-LaserJet-M506-81':
ensure: 'printer'
model: 'lsb/usr/cupsfilters/pxlmono.ppd'
connection: 'socket://172.16.0.81:9100'
'WP-HP-LaserJet-M506-81':
ensure: 'absent'
/lib/systemd/system/cups.socket
[Unit]
Description=CUPS Scheduler
[Socket]
ListenStream=/var/run/cups/cups.sock
ListenStream=631 ## this is needed or cups stops running after 6 minutes
[Install]
WantedBy=sockets.target
Issue
When puppet is run the printers get added every single time. This will be a problem when puppet is run as each printer appears to be deleted and then added. At that time a print job may fail. This seems to be an issue mostly when the /etc/cups/cupsd.conf file has been modified by puppet or the /lib/systemd/system/cups.socket file. When using default versions of those files, there does not seem to problem with puppet recreating printers. I am not sure how to work around this issue.
Error message
Debug: Executing '/usr/sbin/lpadmin -E -p HP-LaserJet-M506DN-243 -v /dev/null'
Debug: Executing '/usr/sbin/lpadmin -E -p HP-LaserJet-M506DN-243 -m raw'
Debug: Executing '/usr/sbin/lpadmin -E -p HP-LaserJet-M506DN-243 -v socket://172.16.0.243:9100'
Debug: Executing '/usr/sbin/lpadmin -E -p HP-LaserJet-M506DN-243 -o printer-is-shared=false'
Debug: Cups_queue[HP-LaserJet-M506DN-243](provider=cups): Circumventing CUPS issue #4781 by temporarily allowing access for 'root'
Debug: Executing '/usr/sbin/lpadmin -E -p HP-LaserJet-M506DN-243 -u allow:root'
Debug: Executing '/usr/sbin/cupsenable -E HP-LaserJet-M506DN-243'
Debug: Executing '/usr/sbin/lpadmin -E -p HP-LaserJet-M506DN-243 -u allow:all'
Debug: Executing '/usr/sbin/cupsaccept -E HP-LaserJet-M506DN-243'
Notice: /Stage[main]/cups_print/cups_print::Resource::Add_printer[HP-LaserJet-M506DN-243]/Cups_queue[HP-LaserJet-M506DN-243]/ensure: created a printer
Debug: /Stage[main]/cups_print/cups_print::Resource::Add_printer[HP-LaserJet-M506DN-243]/Cups_queue[HP-LaserJet-M506DN-243]: The container cups_print::Resource::Add_printer[HP-LaserJet-M506DN-243] will propagate my refresh event
Debug: cups_print::Resource::Add_printer[HP-LaserJet-M506DN-243]: The container Class[cups_print] will propagate my refresh event
Debug: Class[cups_print]: The container Stage[main] will propagate my refresh event
root@print:/etc/cups# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for print.mydomain.com
Info: Applying configuration version '1485546210'
Notice: /Stage[main]/puppet/Exec[apt-update-puppet]/returns: executed successfully
Notice: /Stage[main]/cups_print/cups_print::Resource::Add_printer[HP-LJP-P2055DN-202]/Cups_queue[HP-LJP-P2055DN-202]/ensure: created a printer
Notice: /Stage[main]/cups_print/cups_print::Resource::Add_printer[HP-LaserJet-M506-81]/Cups_queue[HP-LaserJet-M506-81]/ensure: created a printer
Notice: /Stage[main]/cups_print/cups_print::Resource::Add_printer[HP-LaserJet-M506DN-243]/Cups_queue[HP-LaserJet-M506DN-243]/ensure: created a printer
Notice: Finished catalog run in 5.37 seconds
Let me know if anything stands out in my configuration or if you have any suggestions.
Hello.
I've faced with some issue related to the restart process of cupsd on Ubuntu 18.04.1:
I always receive this message while puppet perform cupsd process restart:
Failed to apply catalog:
IPP query 'ipptool -c ipp://localhost/ /dev/stdin' failed.
EXITCODE: 1
STDIN:
{
OPERATION CUPS-Get-Classes
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
DISPLAY printer-name DISPLAY member-names
}
STDOUT:
STDERR: ipptool: Unable to connect to localhost on port 631 - Operation now in progress
But in the real the daemon is restarted and second puppet run always successful and returns no errors.
Looks like we need to implement something like short timeout here.
Regards, Mark
As the page on puppet forge states, I should open an issue first, and not just put in a pull request:
The init.pp should pull from params.pp hiera data weather or not to install cups, or to enable it or not. We have several dozen machines that ship with cups, and would like to use this module to manage the setup, but also have the ability to ensure cups is removed, or is installed, but not running. Several distributions of linux ship with cups installed by default, and we need to manage them in a well understood method with contributed modules as we use the r10k/roles/profiles setup.
I can provide the pull request upon request.
The Hiera example in https://forge.puppet.com/leoarnold/cups/1.2.2/readme#using-hiera says:
---
cups::default_queue: 'GroundFloor'
cups::hiera: priority
cups_queue:
'Office':
ensure: 'printer'
uri: 'lpd://192.168.2.105/binary_p1'
'GroundFloor':
ensure: 'class'
members: ['Office', 'Warehouse']
It should probably say:
---
cups::default_queue: 'GroundFloor'
cups::hiera: priority
cups::resources:
'Office':
ensure: 'printer'
uri: 'lpd://192.168.2.105/binary_p1'
'GroundFloor':
ensure: 'class'
members: ['Office', 'Warehouse']
substituting cups_queue with cups::resources.
Given Fedora 27 with Puppet 5.5.8 and CUPS 2.2.4.
When I apply the manifest
include '::cups'
cups::resources:
lab001:
ensure: printer
accepting: true
access:
policy: allow
users: ['all']
description: "Lab001"
enabled: true
held: false
location: "London site"
make_and_model: "Zebra CPCL Label Printer"
shared: false
uri: socket://lab001.lon.example.com:9100
lab002:
ensure: printer
accepting: true
access:
policy: allow
users: ['all']
description: "Lab002"
enabled: true
held: false
location: "London site"
make_and_model: "Zebra CPCL Label Printer"
shared: false
uri: socket://lab002.lon.example.com:9100
In order to setup printers using hiera
Then I get the error message:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not autoload puppet/type/cups_queue: /etc/puppetlabs/code/environments/production/modules_3rdparty/cups/lib/puppet/type/cups_queue.rb:104: unknown type of %string
return "created a #{should_to_s(new_value)}" unless %i[class printer].include?(current_value)
^ (file: /etc/puppetlabs/code/environments/production/modules_3rdparty/cups/manifests/queues/resources.pp, line: 22, column: 5)
This is more of a feature request than a bug report.
Given any OS and Puppet/CUPS version.
When I try to set the ErrorPolicy
line in /etc/cups/printers.conf
using this module
In order to affect what happens when a job cannot be sent to a printer
Then: I do not see any way to do this with this module in its current form.
For example, from man lpadmin
:
-o printer-error-policy=name
Sets the error policy to be used when the printer backend is
unable to send the job to the printer. The name must be one of
"abort-job", "retry-job", "retry-current-job", or "stop-printer".
The default error policy is "stop-printer" for printers and
"retry-current-job" for classes.
Other options for lpadmin
(e. g. -o printer-is-shared
, -u allow
, -u deny
) do have corresponding attributes in the cups_queue
type.
Issue template: Please fill in the gaps.
Given [ubuntu 16.04]
Is there a way not do delete/touch manual added printers by users, which is common on laptops?
Recent only puppet defined printers are left after a puppet run ?
Regards Robert
Hello,
In most cases that means something is wrong with your current Bundler setup and we can't fix it automatically:
Bundler Error: Could not find gem 'puppet (= 5.5.18, ~> 6.0)' in any of the gem sources listed in your Gemfile.
Bundler Error: Could not find gem 'puppet (= 5.5.17, ~> 6.0)' in any of the gem sources listed in your Gemfile.
Bundler Error: Could not find gem 'puppet (= 5.5.16, ~> 6.0)' in any of the gem sources listed in your Gemfile.
After you've fixed the problem, please activate this project again in the Depfu Dashboard.
👉 We will not send you further PRs until this is fixed and the repo is activated again.
If you need help or this looks like an error on our side, please send us an email.
Would it be possible to add support for the AuthInfoRequired key in printers.conf?
Possible choices should be "username,password", "negotiate" and "none".
Given Centos 7.4 with Puppet 4.10.9 and CUPS 1.6.3.
When I apply the manifest
class { '::cups':
default_queue => 'WMS_Global_Printing',
}
cups_queue { "WMS_Global_Printing":
ensure => "printer",
uri => "smb://mill-print/WMS_Global_Printing",
description => "The Mill London Global Print Queue",
model => "drv:///sample.drv/generic.ppd",
accepting => true,
enabled => true,
options => {
"auth-info-required" => "username,password"
}
}
Then I get this notice message every run:
Notice: /Stage[main]/Mill3d_base::Papercut/Cups_queue[WMS_Global_Printing]/options: options changed '{"auth-info-required"=>"\"username,password\""}' to '{"auth-info-required"=>"username,password"}'
Expectation I only see a notice if the settings have changed, rather than each puppet run.
Given Debian 8 with Puppet 4.12.1 and CUPS 1.7.5-11+deb8u4
When I apply the manifest
include '::cups'
# Your manifest here
# Create all printers listed in $printers::cups_queues then restart cups
$queue_defaults = {
notify => Exec['RestartCupsAfter'],
}
create_resources('cups_queue', $printing::cups_queues, $queue_defaults)
exec {'RestartCupsAfter':
command => '/bin/systemctl restart cups.service',
refreshonly => true,
}
**In order to** Create a new printer class and 2 printers.
**Then** I get the error message:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Type-Name, Could not autoload puppet/type/cups_queue: /etc/puppetlabs/code/environments/production/modules/cups/lib/puppet/type/cups_queue.rb:104: unknown type of %string
return "created a #{should_to_s(new_value)}" unless %i[class printer].include?(current_value)
^ at /etc/puppetlabs/code/environments/production/modules/cups/manifests/queues/default.pp:24:18 on node 0060ef20812e-dmpgd.dmvlt.ls.cbn
If I upgrade from 1.2.2 to 2.0.3 then 2.2.2 using r10k and calling a cache flush on the puppet master it all works just fine.
First, thanks to making this module available.
I've edited manifests/init.pp and templates/cupsd.conf.erb to add configurable options like root_location_allow & deny for <Location /admin> [and /admin/conf, /admin/log, ...] (and also JobPrivateValues but i see there is nice pullrequest headed to the master, thx)
My case : i want to set up some cups servers in my work environment. I need to set many options in cupsd.conf and there is a lack of configurable options in this module.
I can't commit my changes because i haven't edited spec/classes/init_spec.rb to make it clean.
Given Ubuntu 16.04.3 LTS with Puppet 5.3.3-1xenial and CUPS 2.1.3-4ubuntu0.3 and bash 4.3-14ubuntu1.2.
When I apply the manifest:
include '::cups'
cups_queue { 'Office':
ensure => 'printer',
model => 'drv:///hpcups.drv/hp-color_laserjet_4730mfp-pcl3.ppd',
make_and_model => 'HP Color LaserJet 4730mfp pcl3, hpcups 3.14.3',
}
Then I get the error message:
Change from '"HP Color LaserJet 4730mfp pcl3, hpcups 3.14.3"' to 'HP Color LaserJet 4730mfp pcl3, hpcups 3.14.3' failed: Cannot set make_and_model to 'HP Color LaserJet 4730mfp pcl3, hpcups 3.14.3' for queue 'Office'. Please revise the value you provided for 'model' or 'ppd'.
Workaround:
cups_queue { 'Office':
ensure => 'printer',
model => 'drv:///hpcups.drv/hp-color_laserjet_4730mfp-pcl3.ppd',
make_and_model => '"HP Color LaserJet 4730mfp pcl3, hpcups 3.14.3"',
}
Origin of the problem:
ipptool sometimes prints out a quoted line
Solution of the problem:
remove quotes from ipptool output
Proposed fix:
https://github.com/leoarnold/puppet-cups/blob/master/lib/puppet_x/cups/queue.rb#L53
- query.results.empty? ? '' : query.results.first
+ query.results.empty? ? '' : query.results.first.gsub(/\A"|"\Z/, '')
Given Centos 7 with Puppet Agent 1.8.2 and CUPS 1.6.3.
When I apply the manifest
include '::cups'
cups_queue { 'PTI-B03-E02S03':
ensure => 'printer',
accepting => 'true',
description => 'Biblioteca',
enabled => 'true',
location => 'Espaco2 Sala3',
make_and_model => 'Kyocera FS-3600 Foomatic/hpijs-pcl5e (recommended)',
shared => 'false',
uri => 'papercut:socket://10.50.12.31',
}
the first time i run puppet it instanciate the printer using the Raw Driver, and on the second time it changes the driver.
[root@barigui model]# puppet agent -t -v
Info: Using configured environment 'servers'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for barigui.unila
Info: Applying configuration version '1495823758'
Notice: /Stage[main]/Impressao/Cups_queue[PTI-B03-E02S03]/ensure: created a printer
Notice: Applied catalog in 3.39 seconds
Second --------
[root@barigui model]# puppet agent -t -v
Info: Using configured environment 'servers'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for barigui.unila
Info: Applying configuration version '1495823772'
Notice: /Stage[main]/Impressao/Cups_queue[PTI-B03-E02S03]/make_and_model: make_and_model changed 'Local Raw Printer' to 'Kyocera FS-3600+ Foomatic/hpijs-pcl5e (recommended)'
Notice: Applied catalog in 3.37 seconds
The major problem is that this second change doesn't apply to cups and the wrong driver is used in the printer.
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?
Given Centos7 with Ruby 2.0.0, Puppet 3.8.7 and CUPS 1.6.3.
In order to
Set options in cupsd.conf such as listening interface.
Then Option not available.
It would be nice to be able to set options in cupsd.conf such as listening interface. Not sure if it also adds firewall opening. Would be nice to be able to fully stand up working cups just from manifest.
Given Ubuntu 16.04 LTS with Puppet 4.10.9 and CUPS 2.1.3-4ubuntu0.3 and leoarnold/cups v2.0.1
When I apply the manifest
include '::cups'
with this hiera data
cups::default_queue: MyPrinter
cups::web_interface: true
cups::resources:
MyPrinter:
ensure: printer
uri: 'ipp://192.168.10.20/printers/MyPrinter'
make_and_model: 'Generic PostScript Printer'
In order to configure a generic PS printer that will send everything to another cups host
Then I get the error message:
Error: Execution of '/usr/sbin/lpadmin -E -p MyPrinter -o printer-is-shared=false' returned 1: lpadmin: Cannot change printer-is-shared for remote queues.
As far as I can tell, the cups_queue
resource insists on setting the printer-is-shared
attribute, but it cannot be set with IPP queues.
I get the exact same behavior with shared: true
and shared: false
.
It seems to me that cups_queue
should not try to set that parameter at all if the uri starts with ipp://
or one of its variations (ipps
and so on...)
Puppet: 4.8.1
When using
puppet resource cups_queue Office
the output contains
options => { [...] 'job-sheets-default' => '"none,none"' [...] }
Expected:
options => { [...] 'job-sheets-default' => 'none,none' [...] }
without double quotes just as in the output of lpoptions -p Office
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.