diff --git a/mkapachepw.py b/mkapachepw.py index 13d4c9c..3b0959f 100755 --- a/mkapachepw.py +++ b/mkapachepw.py @@ -9,7 +9,7 @@ # Program Information PROGNAME = "mkapachepw" -RCSID = "$Id: mkapachepw.py,v 1.114 2005/04/06 05:59:54 root Exp $" +RCSID = "$Id: mkapachepw.py,v 1.115 2005/04/06 06:18:21 toor Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -74,7 +74,9 @@ CMDLINE = "# Command Line: %s\n" % " ".join(sys.argv) TIMESTAMP = "# Created By %s %s On %s At %s\n" % (PROGNAME, VERSION, getfqdn(), time.asctime()) +GID = 'GID' GROUP = 'Group' +UID = 'UID' USER = 'User' @@ -87,7 +89,13 @@ # Error Messages ##### -eERROR = "ERROR" +eERROR = "ERROR" + +eFILEOPEN = "Cannot Open File '%s'." +eINVALIDID = "'%s' Is An Invalid %s ID." +eINVALIDNAME = "'%s' Is An Invalid %s Name." +eINVALIDSTART = "Invalid Starting %s, '%s' - Must Be An Integer Value." +eNOPREFIX = "'%s' Must Be Prefixed With '+' or '-' To Indicate Desired Action." ##### @@ -184,7 +192,7 @@ additem = True else: - ErrorMsg("'%s' Must Be Prefixed With '+' or '-' To Indicate Desired Action." % item) + ErrorMsg(eNOPREFIX % item) sys.exit(2) item = item[1:] # We just need the item Name/ID portion @@ -198,7 +206,7 @@ item = lookup(item)[0] except: - ErrorMsg("'%s' Is An Invalid %s ID." % (orig[1:], name)) + ErrorMsg(eINVALIDID % (orig[1:], name)) sys.exit(2) # If not, assume it is a name and look it up @@ -207,7 +215,7 @@ # Make sure it even exists if item not in master: - ErrorMsg("'%s' Is An Invalid %s Name." % (item, name)) + ErrorMsg(eINVALIDNAME % (item, name)) sys.exit(2) # Do the actual in/exclusion @@ -245,7 +253,7 @@ f.close() except: - ErrorMsg("Cannot Open File '%s'." % filename) + ErrorMsg(eFILEOPEN % filename) sys.exit(1) return temp @@ -316,13 +324,13 @@ try: STARTGID=int(val) except: - ErrorMsg("Invalid Starting GID, '%s' - Must Be An Integer Value." % val) + ErrorMsg(eINVALIDSTART % (GID, val)) sys.exit(1) if opt == "-u": try: STARTUID=int(val) except: - ErrorMsg("Invalid Starting UID '%s' - Must Be An Integer Value." % val) + ErrorMsg(eINVALIDSTART % (UID, val)) sys.exit(1) if opt == "-I": temp = ReadFile(val) @@ -366,7 +374,7 @@ try: grfile = open(GRFILE, "w") except: - ErrorMsg("Cannot Open/Create File '%s'." % GRFILE) + ErrorMsg(eFILEOPEN % GRFILE) sys.exit(3) grfile.write(TIMESTAMP) @@ -388,7 +396,7 @@ try: pwfile = open(PWFILE, "w") except: - ErrorMsg("Cannot Open/Create File '%s'." % PWFILE) + ErrorMsg(eFILEOPEN % PWFILE) sys.exit(3) pwfile.write(TIMESTAMP)