Bug 246027

Summary: Printer operation policy not set on service start / restart / reload
Product: [Fedora] Fedora Reporter: Opher Shachar <ophers>
Component: cupsAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 1.2.12-2.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-03 16:14:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Opher Shachar 2007-06-27 22:34:43 UTC
Description of problem:
When the CUPS service is started or restarted or reloaded printer operation 
policies are not set (they are left 'default').

Version-Release number of selected component (if applicable):
1.2.7

How reproducible:
Always.

Steps to Reproduce:
1. service cups restart / start / reload
2. lpadmin -p myprinter -o printer-op-policy=foo
3. Policy takes affect.
4. service cups restart / start / reload
5. Policy for myprinter was reset to 'default'
  
Actual results:
Unlike the report in CUPS STR #2319 a reload does *not* preserve or loads 
printer operation policies.

Expected results:


Additional info:
This script, placed in /etc/init.d/cups, can workaround this.

while read tag printer; do
    [[ "$tag" != "<Printer" ]] && continue
    printer=${printer%>}
    while read tag value; do
        [[ "$tag" == "</Printer>" ]] && break
        [[ "$tag" != "OpPolicy" ]] && continue
        echo "lpadmin -p $printer -o printer-op-policy=$value"
        lpadmin -p $printer -o printer-op-policy=$value
    done
done < /etc/cups/printers.conf

Comment 1 Opher Shachar 2007-06-27 22:40:54 UTC
*** Bug 246029 has been marked as a duplicate of this bug. ***

Comment 2 Tim Waugh 2007-06-28 09:36:47 UTC
Please try the current update:

  yum update 'cups*'

Do you still see that behaviour?

Comment 3 Opher Shachar 2007-06-28 12:44:14 UTC
Hi Tim,
Did that:

    # yum list "cups*"
    Loading "installonlyn" plugin
    Setting up repositories
    Reading repository metadata in from local files
    Installed Packages
    cups.i386                                1:1.2.10-7.fc6         installed
    cups-libs.i386                           1:1.2.10-7.fc6         installed
    cups-lpd.i386                            1:1.2.10-7.fc6         installed
    cups-pdf.i386                            2.4.6-1.fc6            installed
    Available Packages
    cups-devel.i386                          1:1.2.10-7.fc6         updates

I still see the same behaviour.

Regards,
Opher Shachar.

Comment 4 Tim Waugh 2007-06-28 12:49:33 UTC
Sounds like your /etc/cups/printers.conf file has the wrong SELinux context. 
What does this command say?:

/sbin/restorecon -v /etc/cups/printers.conf

and does the policy "stick" afterwards?

Comment 5 Opher Shachar 2007-06-28 14:04:19 UTC
Hi Tim,
To begin with my system has SELinux set to Permissive mode.
Non the less, I ran the command /sbin/restorecon -v /etc/cups/printers.conf - 
got no output.
Also, ls -Z /etc/cups/printers.conf says this: (didn't check before the 
restorecon command)
-rw-------  root lp root:object_r:cupsd_rw_etc_t     /etc/cups/printers.conf

Still, the problem persists.

Regards,
Opher Shachar.

Comment 6 Tim Waugh 2007-06-28 14:49:40 UTC
After running:

lpadmin -p myprinter -o printer-op-policy=foo

what does your /etc/cups/printers.conf file say the policy is for that printer?
 I'm trying to work out if the change makes it to disk, or if it only remains in
memory.

Comment 7 Opher Shachar 2007-06-28 20:38:39 UTC
Hi Tim,
The change is written immediately to the file.
Also, in my original comment in step 5 I meant that CUPS *acts as if* the 
policy is 'default' - the file /etc/cups/printers.conf always says the policy 
is 'foo'.

Regards,
Opher Shachar.

Comment 8 Opher Shachar 2007-08-03 16:07:05 UTC
Hi Tim,
I've updated to cups 1.2.12 and as far as I can see it solved this issue.

Regards,
Opher.

Comment 9 Tim Waugh 2007-08-03 16:14:59 UTC
Great.