Changeset 872 for pykota/trunk

Show
Ignore:
Timestamp:
03/29/03 14:08:28 (22 years ago)
Author:
jalet
Message:

Configuration is now expected to be found in /etc/pykota.conf instead of
in /etc/cups/pykota.conf
Installation script can move old config files to the new location if needed.
Better error handling if configuration file is absent.

Location:
pykota/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/NEWS

    r871 r872  
    2222          wants to continue with the installation or abort it. 
    2323           
     24        - The configuration file pykota.conf is now expected to be  
     25          found in /etc instead of in /etc/cups 
     26          The installation script prompts the user to see if he 
     27          wants to move an old configuration file to the new location 
     28          if needed. 
     29           
    2430        - Improved documentation. 
    2531         
     
    2733          Server is listening, see sample configuration file for details. 
    2834         
    29         - Better error handling if PygreSQL is not installed or not  
    30           available. 
     35        - Better general error handling. 
    3136         
    3237    - 1.01 : 
  • pykota/trunk/po/en/pykota.po

    r852 r872  
    1515# 
    1616# $Log$ 
     17# Revision 1.11  2003/03/29 13:08:28  jalet 
     18# Configuration is now expected to be found in /etc/pykota.conf instead of 
     19# in /etc/cups/pykota.conf 
     20# Installation script can move old config files to the new location if needed. 
     21# Better error handling if configuration file is absent. 
     22# 
    1723# Revision 1.10  2003/03/15 23:01:28  jalet 
    1824# New mailto option in configuration file added. 
     
    226232msgid "Option mailto in section %s only supports values in %s" 
    227233msgstr "" 
     234 
     235msgid "Configuration file %s not found." 
     236msgstr "" 
  • pykota/trunk/po/fr/pykota.po

    r852 r872  
    1515# 
    1616# $Log$ 
     17# Revision 1.9  2003/03/29 13:08:28  jalet 
     18# Configuration is now expected to be found in /etc/pykota.conf instead of 
     19# in /etc/cups/pykota.conf 
     20# Installation script can move old config files to the new location if needed. 
     21# Better error handling if configuration file is absent. 
     22# 
    1723# Revision 1.8  2003/03/15 23:01:28  jalet 
    1824# New mailto option in configuration file added. 
     
    234240msgid "Option mailto in section %s only supports values in %s" 
    235241msgstr "L'option mailto dans la section %s supporte seulement les valeurs %s" 
     242 
     243msgid "Configuration file %s not found." 
     244msgstr "Fichier de configuration %s non trouv� 
  • pykota/trunk/po/pykota.pot

    r852 r872  
    1515# 
    1616# $Log$ 
     17# Revision 1.11  2003/03/29 13:08:28  jalet 
     18# Configuration is now expected to be found in /etc/pykota.conf instead of 
     19# in /etc/cups/pykota.conf 
     20# Installation script can move old config files to the new location if needed. 
     21# Better error handling if configuration file is absent. 
     22# 
    1723# Revision 1.10  2003/03/15 23:01:28  jalet 
    1824# New mailto option in configuration file added. 
     
    226232msgid "Option mailto in section %s only supports values in %s" 
    227233msgstr "" 
     234 
     235msgid "Configuration file %s not found." 
     236msgstr "" 
  • pykota/trunk/pykota/config.py

    r854 r872  
    1515# 
    1616# $Log$ 
     17# Revision 1.20  2003/03/29 13:08:28  jalet 
     18# Configuration is now expected to be found in /etc/pykota.conf instead of 
     19# in /etc/cups/pykota.conf 
     20# Installation script can move old config files to the new location if needed. 
     21# Better error handling if configuration file is absent. 
     22# 
    1723# Revision 1.19  2003/03/16 09:56:52  jalet 
    1824# Mailto option now accepts some additional values which all mean that 
     
    108114        """Reads and checks the configuration file.""" 
    109115        self.filename = os.path.join(directory, "pykota.conf") 
     116        if not os.path.isfile(self.filename) : 
     117            raise PyKotaConfigError, _("Configuration file %s not found.") % self.filename 
    110118        self.config = ConfigParser.ConfigParser() 
    111119        self.config.read([self.filename]) 
  • pykota/trunk/pykota/tool.py

    r852 r872  
    1515# 
    1616# $Log$ 
     17# Revision 1.28  2003/03/29 13:08:28  jalet 
     18# Configuration is now expected to be found in /etc/pykota.conf instead of 
     19# in /etc/cups/pykota.conf 
     20# Installation script can move old config files to the new location if needed. 
     21# Better error handling if configuration file is absent. 
     22# 
    1723# Revision 1.27  2003/03/15 23:01:28  jalet 
    1824# New mailto option in configuration file added. 
     
    144150        # pykota specific stuff 
    145151        self.documentation = doc 
    146         self.config = config.PyKotaConfig(os.environ.get("CUPS_SERVERROOT", "/etc/cups")) 
     152        self.config = config.PyKotaConfig("/etc") 
    147153        self.logger = logger.openLogger(self.config) 
    148154        self.storage = storage.openConnection(self.config, asadmin=(not isfilter)) 
  • pykota/trunk/setup.py

    r870 r872  
    1717# 
    1818# $Log$ 
     19# Revision 1.5  2003/03/29 13:08:28  jalet 
     20# Configuration is now expected to be found in /etc/pykota.conf instead of 
     21# in /etc/cups/pykota.conf 
     22# Installation script can move old config files to the new location if needed. 
     23# Better error handling if configuration file is absent. 
     24# 
    1925# Revision 1.4  2003/03/29 09:47:00  jalet 
    2026# More powerful installation script. 
     
    8187     
    8288if "install" in sys.argv : 
     89    # checks if Python version is correct, we need >= 2.1 
    8390    if not (sys.version > "2.1") : 
    8491        sys.stderr.write("PyKota needs at least Python v2.1 !\nYour version seems to be older than that, please update.\nAborted !\n") 
    8592        sys.exit(-1) 
    8693         
     94    # checks if a configuration file is present in the old location 
     95    if os.path.isfile("/etc/cups/pykota.conf") : 
     96        if not os.path.isfile("/etc/pykota.conf") : 
     97            sys.stdout.write("From version 1.02 on, PyKota expects to find its configuration file in /etc instead of /etc/cups.\n") 
     98            sys.stdout.write("It seems that you've got a configuration file in the old location, so it will not be used anymore, and no configuration file in the new location.\n") 
     99            answer = raw_input("Do you want me to move your configuration file to the new location in /etc (y/N) ? ") 
     100            if answer[0:1].upper() == 'Y' : 
     101                try : 
     102                    os.rename("/etc/cups/pykota.conf", "/etc/pykota.conf") 
     103                except OSError :     
     104                    sys.stderr.write("ERROR : An error occured while moving /etc/cups/pykota.conf to /etc/pykota.conf\nAborted !\n") 
     105                    sys.exit(-1) 
     106            else : 
     107                sys.stderr.write("WARNING : Configuration file /etc/cups/pykota.conf won't be used ! Move it to /etc instead.\n") 
     108                sys.stderr.write("PyKota installation will continue anyway, but the software won't run until you put a proper configuration file in /etc\n") 
     109        else :         
     110            sys.stderr.write("WARNING : Configuration file /etc/cups/pykota.conf will not be used !\nThe file /etc/pykota.conf will be used instead.\n") 
     111     
     112    # checks if some needed Python modules are there or not. 
    87113    modulestocheck = [("PygreSQL", "pg"), ("mxDateTime", "mx.DateTime")] 
    88114    commandstocheck = [("SNMP Tools", "snmpget")] 
     
    93119            sys.exit(-1) 
    94120             
     121    # checks if some software are there or not. 
    95122    for (name, command) in commandstocheck : 
    96123        action = checkWithPrompt(name, command=command)