Changeset 1960

Show
Ignore:
Timestamp:
11/27/04 23:52:07 (19 years ago)
Author:
jalet
Message:

Now PyKota searches its configuration files first in system user pykota's
home directory

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r1944 r1960  
    2222# 
    2323# $Log$ 
     24# Revision 1.145  2004/11/27 22:52:07  jalet 
     25# Now PyKota searches its configuration files first in system user pykota's 
     26# home directory 
     27# 
    2428# Revision 1.144  2004/11/18 06:01:53  jalet 
    2529# Fix for the fix 
     
    522526import sys 
    523527import os 
     528import pwd 
    524529import fnmatch 
    525530import getopt 
     
    600605        # pykota specific stuff 
    601606        self.documentation = doc 
     607         
     608        # try to find the configuration files in user's 'pykota' home directory. 
    602609        try : 
    603             self.config = config.PyKotaConfig("/etc/pykota") 
     610            pykotauser = pwd.getpwnam("pykota") 
     611        except KeyError :     
     612            confdir = "/etc/pykota" 
     613            missingUser = 1 
     614        else :     
     615            confdir = pykotauser[5] 
     616            missingUser = 0 
     617             
     618        try : 
     619            self.config = config.PyKotaConfig(confdir) 
    604620        except ConfigParser.ParsingError, msg :     
    605621            sys.stderr.write("ERROR: Problem encountered while parsing configuration file : %s\n" % msg) 
     
    615631            self.crashed(msg) 
    616632            raise 
     633             
     634        # We NEED this here, even when not in an accounting filter/backend     
    617635        self.softwareJobSize = 0 
    618636        self.softwareJobPrice = 0.0 
     637         
    619638        if defaultToCLocale : 
    620639            self.printInfo("Incorrect locale settings. PyKota falls back to the 'C' locale.", "warn") 
     640        if missingUser :      
     641            self.printInfo("The 'pykota' system account is missing. Configuration files were searched in /etc/pykota instead.", "warn") 
     642         
    621643        self.logdebug("Charset in use : %s" % self.charset) 
    622644        arguments = " ".join(['"%s"' % arg for arg in sys.argv]) 
  • pykota/trunk/README

    r1951 r1960  
    341341You may need to be logged in with sufficient privileges (e.g. root) 
    342342 
     343Create a system user for PyKota : 
     344 
     345    adduser --system --group --gecos PyKota pykota 
     346     
     347Put the user your printing system is run as in the pykota system group : 
     348 
     349    adduser lp pykota 
     350     
     351    NB : on our system, the CUPS printing system runs as system user 'lp'. 
     352    Please adapt this to your own system. 
     353 
    343354Go to the initscripts subdirectory of PyKota's sources, and choose 
    344355the appropriate storage backend for your configuration. Read carefully