Show
Ignore:
Timestamp:
05/06/04 22:30:26 (20 years ago)
Author:
jalet
Message:

Added --skipexisting command line option to pkprinters

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkprinters

    r1452 r1453  
    2424# 
    2525# $Log$ 
     26# Revision 1.8  2004/05/06 20:30:24  jalet 
     27# Added --skipexisting command line option to pkprinters 
     28# 
    2629# Revision 1.7  2004/05/06 12:51:58  jalet 
    2730# Documentation 
     
    6972   
    7073  -a | --add           Adds printers if they don't exist on the Quota  
    71                        Storage Server. Doesn't modify any already 
    72                        existing printer. 
     74                       Storage Server. If they exist, they are modified 
     75                       unless -s|--skipexisting is also used. 
    7376                        
    7477  -d | --delete        Deletes printers from the quota storage. 
     
    99102  -r | --remove        In combination with the --groups option above,                        
    100103                       remove printers from the specified printers groups. 
     104                        
     105  -s | --skipexisting  In combination with the --add option above, tells 
     106                       pkprinters to not modify existing printers. 
    101107   
    102108  printer1 through printerN can contain wildcards if the --add option  
     
    173179                printer = self.storage.getPrinter(pname) 
    174180                if printer.Exists : 
    175                     self.logger.log_message(_("Printer %s already exists, skipping.") % printer.Name, "warn") 
     181                    if options["skipexisting"] : 
     182                        self.logger.log_message(_("Printer %s already exists, skipping.") % printer.Name, "warn") 
     183                    else :     
     184                        self.logger.log_message(_("Printer %s already exists, will be modified.") % printer.Name, "warn") 
     185                        printers.append(printer) 
    176186                else : 
    177187                    if self.isValidName(pname) : 
     
    211221    retcode = 0 
    212222    try : 
    213         short_options = "hvac:dg:lr" 
    214         long_options = ["help", "version", "add", "charge=", "delete", "groups=", "list", "remove"] 
     223        short_options = "hvac:dg:lrs" 
     224        long_options = ["help", "version", "add", "charge=", "delete", "groups=", "list", "remove", "skipexisting"] 
    215225         
    216226        # Initializes the command line tool 
     
    229239        options["list"] = options["l"] or options["list"] 
    230240        options["remove"] = options["r"] or options["remove"] 
     241        options["skipexisting"] = options["s"] or options["skipexisting"] 
    231242         
    232243        if options["help"] : 
     
    235246            manager.display_version_and_quit() 
    236247        elif (options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"])) \ 
     248           or (options["skipexisting"] and not options["add"]) \ 
    237249           or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"])) : 
    238250            raise PyKotaToolError, _("incompatible options, see help.")