Skip to content

Commit

Permalink
Shared option was only available at queue creation time so moved back…
Browse files Browse the repository at this point in the history
… into params. Tested ok with example printer.
  • Loading branch information
mosen committed Feb 18, 2014
1 parent 7df7448 commit bb9c152
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ An example using almost every possible parameter:
# list of installed drivers.
# OR
interface => "/path/to/system/v/interface/file", # Interface script run for this destination

shared => false, # Printer will be shared and published by CUPS
enabled => true, # Enabled by default
options => { media => 'A4' }, # Hash of options ( name => value ), these are non vendor specific options.
ppd_options => { 'HPOption_Duplexer' => 'False' }, # Hash of vendor PPD options
}

- The easiest way to find out a list of valid options for any single printer is to install that printer locally, and
run `lpoptions -l` at the command line.
- The `shared` option has been deprecated. Please use option `printer-is-shared=true/false`

### Facts

Expand Down
17 changes: 8 additions & 9 deletions lib/puppet/provider/printer/cups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,20 @@ def flush
params.unshift Cups_Options[k] % @resource[k] if @resource[k]
end

#if @resource[:shared] == :true
# options.push '-o printer-is-shared=true'
#end
#
#if @resource[:shared] == :false
# options.push '-o printer-is-shared=false'
#end
if @resource[:shared] == :true
params.push '-o printer-is-shared=true'
end

if @resource[:shared] == :false
params.push '-o printer-is-shared=false'
end

if @property_hash[:options].is_a? Hash
@property_hash[:options].each_pair do |k, v|
# EB: Workaround for some command line options having 2 forms, short switch via lpadmin or
# long "option-name" via -o. We don't want to allow setting of these options via -o
next if k == 'device-uri'
# you must now use printer-is-shared for sharing
#next if k == 'printer-is-shared'
next if k == 'printer-is-shared' # Cannot set unless you are creating the queue
next if k == 'printer-is-accepting-jobs'
next if k == 'printer-state' # causes reject/enable to be ignored
options.push "-o %s='%s'" % [k, v]
Expand Down

0 comments on commit bb9c152

Please sign in to comment.