def join(path, *args): """Join two or more pathname components, inserting os.sep as needed""" f = File(path) for a in args: g = File(a) if g.isAbsolute() or len(f.getPath()) == 0: f = g else: f = File(f, a) return f.getPath()
def join(path, *args): if sys.platform.startswith('java'): from java.io import File f = File(path) for a in args: g = File(a) if g.isAbsolute() or len(f.getPath()) == 0: f = g else: f = File(f, a) return f.getPath() else: import os return os.path.join(path, *args)
def split(path): if sys.platform.startswith('java'): from java.io import File f=File(path) d=f.getParent() if not d: if f.isAbsolute(): d = path else: d = "" return (d, f.getName()) else: import os return os.path.split(path)
def join(path, *args): """Join two or more pathname components, inserting os.sep as needed""" path = _tostr(path, "join") f = File(path) for a in args: a = _tostr(a, "join") g = File(a) if g.isAbsolute() or len(f.getPath()) == 0: f = g else: if a == "": a = os.sep f = File(f, a) return asPyString(f.getPath())
def validateFilestoresProperty(domainProperties): error = 0 filestores = domainProperties.getProperty('persistent.filestores') if not filestores is None and len(filestores)>0: filestoreList = filestores.split(',') for filestore in filestoreList: helper.printHeader('[VALIDATING] filestore ' + str(filestore) + ' properties') filestoreName = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Name') if filestoreName is None or len(filestoreName)==0: error = 1 log.error('Please verify persistent.filestore.' + str(filestore) + '.Name property if it exists in configuration.') else: log.debug('Filestore [' + str(filestore) + '] name property [' + str(filestoreName) + '] is valid.') filestoreTarget = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Target') if not filestoreTarget is None and len(filestoreTarget)>0: servers = domainProperties.getProperty('wls.servers') if not servers is None and len(servers)>0: serverList = servers.split(',') exist = 0 for server in serverList: if server==filestoreTarget: exist = 1 break if not exist: error = 1 log.error('persistent.filestore.' + str(filestore) + '.Target property refers to server that does not exist within wls.servers property.') else: log.debug('Filestore [' + str(filestore) + '] target property [' + str(filestoreTarget) + '] is valid.') filestoreMigratable = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Migratable') if not filestoreMigratable is None and len(filestoreMigratable)>0: if not filestoreMigratable.upper()=='TRUE' and not filestoreMigratable.upper()=='FALSE': error = 1 log.error('The persistent.filestore.' + str(filestore) + '.Migratable property supports only [true,false, or leave blank to use default].') else: log.debug('Filestore [' + str(filestore) + '] migratable property [' + str(filestoreMigratable) + '] is valid.') location = domainProperties.getProperty('persistent.filestore.' + str(filestore) + '.Location') if not location is None and len(location)>0: file = File(location) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(location) + '].') return error
def marker_add(path,line,column,msg,is_error): erm = project.getERM() # make path absolute f = File(path) if not f.isAbsolute(): f = file(path) sf = SourceFile(f) if not FSCache.getInstance().exists(sf, True): logger.error("python: script tried to add error to non-existant file: %s", sf.getAbsolutePath()) else: location = SourceLocation(sf, line, column) erm.addError(ZamiaException(ZamiaException.ExCat.EXTERNAL, is_error, msg, location))
def use_jar(fname, root=__file__, isglobal=False): from org.gvsig.scripting import ScriptingLocator from java.io import File import sys import os if isinstance(fname, File): f = fname fname = f.getPath() else: f = File(fname) if not f.isAbsolute(): rf = File(root) if rf.isFile(): rf = rf.getParentFile() f = File(rf, fname) fname = f.getCanonicalPath() use_libs(fname, isglobal=isglobal)
def validateServerProperty(domainProperties): error = 0 machines = domainProperties.getProperty('wls.domain.machines') clusters = domainProperties.getProperty('wls.clusters') servers = domainProperties.getProperty('wls.servers') if not servers is None and len(servers)>0: serverList = servers.split(',') for server in serverList: helper.printHeader('[VALIDATING] server ' + str(server) + ' properties') serverName = domainProperties.getProperty('wls.server.' + str(server) + '.name') if serverName is None or len(serverName)==0: error = 1 log.error('Please verify wls.server.' + str(server) + '.name property if it exists in configuration.') else: log.debug('Server [' + str(server) + '] name property [' + str(serverName) + '] is valid.') targetCluster = domainProperties.getProperty('wls.server.' + str(server) + '.cluster') if targetCluster: if not clusters is None and len(clusters)>0: clusterList = clusters.split(',') exist = 0 for cluster in clusterList: clusterName = domainProperties.getProperty('wls.cluster.' + str(cluster) + '.name') if cluster==targetCluster: exist = 1 break if not exist: error = 1 log.error('wls.server.' + str(server) + '.cluster property refers to a cluster [' + targetCluster + '] that does not exist within wls.clusters property.') else: log.debug('Server [' + str(server) + '] cluster property [' + str(clusterName) + '] is valid.') serverHost = domainProperties.getProperty('wls.server.' + str(server) + '.Hostname') if serverHost is None or len(serverHost)==0: serverHost = 'localhost' serverPort = domainProperties.getProperty('wls.server.' + str(server) + '.StartListenPortForHost') if not serverPort is None and len(serverPort)>0: try: int(serverPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.StartListenPortForHost [' + str(serverPort) + '] property.') else: if int(serverPort)<0 or int(serverPort)>65535: log.error('Please verify wls.server.' + str(server) + '.StartListenPortForHost property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] server port property [' + str(serverPort) + '] is valid.') enableSSL = domainProperties.getProperty('wls.server.' + str(server) + '.listener.enableSSL') if not enableSSL is None and len(enableSSL)>0: if not enableSSL.upper()=='TRUE' and not enableSSL.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.listener.enableSSL property supports only [true,false].') else: log.debug('Server [' + str(server) + '] ssl enable property [' + str(enableSSL) + '] is valid.') if enableSSL.upper()=='TRUE': sslPort = domainProperties.getProperty('wls.server.' + str(server) + '.listener.sslPort') if not sslPort is None and len(sslPort)>0: try: int(sslPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.listener.sslPort [' + str(sslPort) + '] property.') else: if int(sslPort)<0 or int(sslPort)>65535: log.error('Please verify wls.server.' + str(server) + '.listener.sslPort property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] ssl port property [' + str(sslPort) + '] is valid.') customvars = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvars') if not customvars is None and len(customvars)>0: customvarList = customvars.split(',') for customvar in customvarList: helper.printHeader('[VALIDATING] Custom environment variable ' + str(customvar) + ' properties') customvarText = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text') if customvarText is None or len(customvarText)==0: error = 1 log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property if it exists in configuration.') else: if customvarText.find('=')!=-1: log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.') else: error = 1 log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].') serverChannelName = domainProperties.getProperty('wls.server.' + str(server) + '.channel.name') if not serverChannelName is None and len(serverChannelName)>0: serverChannelProtocol = domainProperties.getProperty('wls.server.' + str(server) + '.channel.protocol') if not serverChannelProtocol=='t3' and not serverChannelProtocol=='t3s' and not serverChannelProtocol=='http' and not serverChannelProtocol=='https' and not serverChannelProtocol=='iiop' and not serverChannelProtocol=='iiops' and not serverChannelProtocol=='ldap' and not serverChannelProtocol=='ldaps' and not serverChannelProtocol=='admin': error = 1 log.error('The wls.server.' + str(server) + '.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].') else: log.debug('Server [' + str(server) + '] channel protocol property [' + str(serverChannelProtocol) + '] is valid.') serverChannelPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.port') if not serverChannelPort is None and len(serverChannelPort)>0: try: int(serverChannelPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.channel.listener.port [' + str(serverChannelPort) + '] property.') else: if int(serverChannelPort)<0 or int(serverChannelPort)>65535: log.error('Please verify wls.server.' + str(server) + '.channel.listener.port property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] channel port [' + str(serverChannelPort) + '] is valid.') serverChannelPublicPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.publicPort') if not serverChannelPublicPort is None and len(serverChannelPublicPort)>0: try: int(serverChannelPublicPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort [' + str(serverChannelPublicPort) + '] property.') else: if int(serverChannelPublicPort)<0 or int(serverChannelPublicPort)>65535: log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] channel public port [' + str(serverChannelPublicPort) + '] is valid.') httpEnable = domainProperties.getProperty('wls.server.' + str(server) + '.channel.httpEnable') if not httpEnable is None and len(httpEnable)>0: if not httpEnable.upper()=='TRUE' and not httpEnable.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.channel.httpEnable property supports only [true,false].') else: log.debug('Server [' + str(server) + '] http channel enable property [' + str(httpEnable) + '] is valid.') enableTunneling = domainProperties.getProperty('wls.server.' + str(server) + '.enableTunneling') if not enableTunneling is None and len(enableTunneling)>0: if not enableTunneling.upper()=='TRUE' and not enableTunneling.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.enableTunneling property supports only [true,false].') else: log.debug('Server [' + str(server) + '] tunnelling enable property [' + str(enableTunneling) + '] is valid.') targetMachine = domainProperties.getProperty('wls.server.' + str(server) + '.machine') if not targetMachine is None and len(targetMachine)>0: if not machines is None and len(machines)>0: machineList = machines.split(',') exist = 0 for machine in machineList: machineName = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.name') if machine==targetMachine: exist = 1 break if not exist: error = 1 log.error('wls.server.' + str(server) + '.machine property refers to a machine that does not exist within the wls.domain.machines property list.') else: log.debug('Server [' + str(server) + '] machine property [' + str(targetMachine) + '] is valid.') servercustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.log.custom') if not servercustomlog is None and len(servercustomlog)>0: if not servercustomlog.upper()=='TRUE' and not servercustomlog.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.log.custom property supports only [true,false].') else: log.debug('Server [' + str(server) + '] custom log enable property [' + str(servercustomlog) + '] is valid.') if servercustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.server.' + str(server) + '.log.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].') limitNumberOfFile = domainProperties.getProperty('wls.server.' + str(server) + '.log.limitNumOfFile') if not limitNumberOfFile is None and len(limitNumberOfFile)>0: if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE': error = 1 log.error('The wls.admin.log.limitNumOfFile property supports only [true,false].') else: log.debug('Server [' + str(server) + '] log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileToRetain') if not fileToRetain is None and len(fileToRetain)>0: if not fileToRetain is None and len(fileToRetain)>0: try: int(fileToRetain) except ValueError: log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain)<1 or int(fileToRetain)>99999: log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain property, number is not in valid range [1-99999].') else: log.debug('Server [' + str(server) + '] log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotateLogOnStartup') if not logRotateOnStartup is None and len(logRotateOnStartup)>0: if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.log.rotateLogOnStartup property supports only [true,false].') else: log.debug('Server [' + str(server) + '] log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.server.' + str(server) + '.log.rotationType property supports only [bySize,byTime].') else: log.debug('Server [' + str(server) + '] log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Server [' + str(server) + '] log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [<=1].') else: log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].') fileSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.logFileSeverity') if not fileSeverity is None and len(fileSeverity)>0: if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning': error = 1 log.error('The wls.server.' + str(server) + '.log.logFileSeverity property supports only [Debug,Info,Warning].') else: log.debug('Server [' + str(server) + '] log file severity property [' + str(fileSeverity) + '] is valid.') broadcastSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.broadcastSeverity') if not broadcastSeverity is None and len(broadcastSeverity)>0: if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off': error = 1 log.error('The wls.server.' + str(server) + '.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Server [' + str(server) + '] broadcast severity log property [' + str(broadcastSeverity) + '] is valid.') memoryBufferSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.memoryBufferSeverity') if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0: if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off': error = 1 log.error('The wls.server.' + str(server) + '.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Server [' + str(server) + '] memory buffer severity log property [' + str(memoryBufferSeverity) + '] is valid.') serverhttpcustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.enable') if not serverhttpcustomlog is None and len(serverhttpcustomlog)>0: if not serverhttpcustomlog.upper()=='TRUE' and not serverhttpcustomlog.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.httplog.enable property supports only [true,false].') else: log.debug('Server [' + str(server) + '] http custom log enable property [' + str(serverhttpcustomlog) + '] is valid.') if serverhttpcustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directories and directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].') rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.server.' + str(server) + '.httplog.rotationType property supports only [bySize,byTime].') else: log.debug('Server [' + str(server) + '] http log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] http log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Server [' + str(server) + '] http log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].') else: log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].') return error
def validateAdminServerProperty(domainProperties): error = 0 helper.printHeader('[VALIDATING] admin server properties') adminPort = domainProperties.getProperty('wls.admin.listener.port') if not adminPort is None and len(adminPort) > 0: try: int(adminPort) except ValueError: log.error('Please verify wls.admin.listener.port [' + str(adminPort) + '] property.') else: if int(adminPort) < 0 or int(adminPort) > 65535: log.error( 'Please verify wls.admin.listener.port property, port number is not in valid range [0-65535].' ) else: log.debug('Admin server port [' + str(adminPort) + '] is valid.') enableSSL = domainProperties.getProperty('wls.admin.listener.enableSSL') if not enableSSL is None and len(enableSSL) > 0: if not enableSSL.upper() == 'TRUE' and not enableSSL.upper( ) == 'FALSE': error = 1 log.error( 'The wls.admin.listener.enableSSL property supports only [true,false].' ) else: log.debug('Admin server ssl enable property [' + str(enableSSL) + '] is valid.') if enableSSL.upper() == 'TRUE': sslPort = domainProperties.getProperty( 'wls.admin.listener.sslPort') if not sslPort is None and len(sslPort) > 0: try: int(sslPort) except ValueError: log.error( 'Please verify wls.admin.listener.sslPort [' + str(sslPort) + '] property.') else: if int(sslPort) < 0 or int(sslPort) > 65535: log.error( 'Please verify wls.admin.listener.sslPort property, port number is not in valid range [0-65535].' ) else: log.debug('Admin server ssl port [' + str(sslPort) + '] is valid.') adminchprotocol = domainProperties.getProperty( 'wls.admin.channel.protocol') if not adminchprotocol is None and len(adminchprotocol) > 0: if not adminchprotocol == 't3' and not adminchprotocol == 't3s' and not adminchprotocol == 'http' and not adminchprotocol == 'https' and not adminchprotocol == 'iiop' and not adminchprotocol == 'iiops' and not adminchprotocol == 'ldap' and not adminchprotocol == 'ldaps' and not adminchprotocol == 'admin': error = 1 log.error( 'The wls.admin.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].' ) else: log.debug('Admin channel protocol property [' + str(adminchprotocol) + '] is valid.') adminChannelPort = domainProperties.getProperty( 'wls.admin.channel.listener.port') if not adminChannelPort is None and len(adminChannelPort) > 0: try: int(adminChannelPort) except ValueError: log.error('Please verify wls.admin.channel.listener.port [' + str(adminChannelPort) + '] property.') else: if int(adminChannelPort) < 0 or int(adminChannelPort) > 65535: log.error( 'Please verify wls.admin.channel.listener.port property, port number is not in valid range [0-65535].' ) else: log.debug('Admin channel port [' + str(adminChannelPort) + '] is valid.') adminChannelPublicPort = domainProperties.getProperty( 'wls.admin.channel.listener.publicPort') if not adminChannelPublicPort is None and len(adminChannelPublicPort) > 0: try: int(adminChannelPublicPort) except ValueError: log.error('Please verify wls.admin.channel.listener.publicPort [' + str(adminChannelPublicPort) + '] property.') else: if int(adminChannelPublicPort) < 0 or int( adminChannelPublicPort) > 65535: log.error( 'Please verify wls.admin.channel.listener.publicPort property, port number is not in valid range [0-65535].' ) else: log.debug('Admin channel public port [' + str(adminChannelPublicPort) + '] is valid.') httpEnable = domainProperties.getProperty('wls.admin.channel.httpEnable') if not httpEnable is None and len(httpEnable) > 0: if not httpEnable.upper() == 'TRUE' and not httpEnable.upper( ) == 'FALSE': error = 1 log.error( 'The wls.admin.channel.httpEnable property supports only [true,false].' ) else: log.debug('Admin http channel enable property [' + str(httpEnable) + '] is valid.') enableTunneling = domainProperties.getProperty('wls.admin.enableTunneling') if not enableTunneling is None and len(enableTunneling) > 0: if not enableTunneling.upper() == 'TRUE' and not enableTunneling.upper( ) == 'FALSE': error = 1 log.error( 'The wls.admin.enableTunneling property supports only [true,false].' ) else: log.debug('Admin tunnelling enable property [' + str(enableTunneling) + '] is valid.') admincustomlog = domainProperties.getProperty('wls.admin.log.custom') if not admincustomlog is None and len(admincustomlog) > 0: if not admincustomlog.upper() == 'TRUE' and not admincustomlog.upper( ) == 'FALSE': error = 1 log.error( 'The wls.admin.log.custom property supports only [true,false].' ) else: log.debug('Admin custom log enable property [' + str(admincustomlog) + '] is valid.') if admincustomlog.upper() == 'TRUE': filename = domainProperties.getProperty( 'wls.admin.log.filename') if not filename is None and len(filename) > 0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug( '[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '].') limitNumberOfFile = domainProperties.getProperty( 'wls.admin.log.limitNumOfFile') if not limitNumberOfFile is None and len( limitNumberOfFile) > 0: if not limitNumberOfFile.upper( ) == 'TRUE' and not limitNumberOfFile.upper() == 'FALSE': error = 1 log.error( 'The wls.admin.log.limitNumOfFile property supports only [true,false].' ) else: log.debug('Admin log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty( 'wls.admin.log.fileToRetain') if not fileToRetain is None and len(fileToRetain) > 0: if not fileToRetain is None and len(fileToRetain) > 0: try: int(fileToRetain) except ValueError: log.error( 'Please verify wls.admin.log.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain) < 1 or int( fileToRetain) > 99999: log.error( 'Please verify wls.admin.log.fileToRetain property, number is not in valid range [1-99999].' ) else: log.debug('Admin log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty( 'wls.admin.log.rotateLogOnStartup') if not logRotateOnStartup is None and len( logRotateOnStartup) > 0: if not logRotateOnStartup.upper( ) == 'TRUE' and not logRotateOnStartup.upper() == 'FALSE': error = 1 log.error( 'The wls.admin.log.rotateLogOnStartup property supports only [true,false].' ) else: log.debug('Admin log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty( 'wls.admin.log.rotationType') if not rotationType is None and len(rotationType) > 0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error( 'The wls.admin.log.rotationType property supports only [bySize,byTime].' ) else: log.debug('Admin log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty( 'wls.admin.log.fileMinSize') if not fileMinSize is None and len(fileMinSize) > 0: try: int(fileMinSize) except ValueError: log.error( 'Please verify wls.admin.log.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize) < 0 or int( fileMinSize) > 65535: log.error( 'Please verify wls.admin.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].' ) else: log.debug('Admin log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty( 'wls.admin.log.rotationTime') if not rotationTime is None and len(rotationTime) > 0: if rotationTime.find(':') == -1: error = 1 log.error( 'Please verify wls.admin.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].' ) else: if len(rotationTime) < 4 or len( rotationTime) > 5: error = 1 log.error( 'The wls.admin.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].' ) else: log.debug('Admin log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty( 'wls.admin.log.fileTimeSpan') if not fileTimespan is None and len(fileTimespan) > 0: try: int(fileTimespan) except ValueError: log.error( 'Please verify wls.admin.log.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan) < 1: log.error( 'Please verify wls.admin.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].' ) else: log.debug('Admin log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty( 'wls.admin.log.rotationDir') if not rotationDir is None and len(rotationDir) > 0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug( '[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '].') fileSeverity = domainProperties.getProperty( 'wls.admin.log.logFileSeverity') if not fileSeverity is None and len(fileSeverity) > 0: if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning': error = 1 log.error( 'The wls.admin.log.logFileSeverity property supports only [Debug,Info,Warning].' ) else: log.debug('Admin log file severity property [' + str(fileSeverity) + '] is valid.') broadcastSeverity = domainProperties.getProperty( 'wls.admin.log.broadcastSeverity') if not broadcastSeverity is None and len( broadcastSeverity) > 0: if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off': error = 1 log.error( 'The wls.admin.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].' ) else: log.debug('Admin broadcast severity property [' + str(broadcastSeverity) + '] is valid.') memoryBufferSeverity = domainProperties.getProperty( 'wls.admin.log.memoryBufferSeverity') if not memoryBufferSeverity is None and len( memoryBufferSeverity) > 0: if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off': error = 1 log.error( 'The wls.admin.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].' ) else: log.debug('Admin memory buffer severity property [' + str(memoryBufferSeverity) + '] is valid.') adminhttpcustomlog = domainProperties.getProperty( 'wls.admin.httplog.enable') if not adminhttpcustomlog is None and len(adminhttpcustomlog) > 0: if not adminhttpcustomlog.upper( ) == 'TRUE' and not adminhttpcustomlog.upper() == 'FALSE': error = 1 log.error( 'The wls.admin.httplog.enable property supports only [true,false].' ) else: log.debug('Admin http custom log enable property [' + str(adminhttpcustomlog) + '] is valid.') if adminhttpcustomlog.upper() == 'TRUE': filename = domainProperties.getProperty( 'wls.admin.httplog.filename') if not filename is None and len(filename) > 0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug( '[NOTE] Please make sure the user running this script has permission to create directory and file for [' + str(filename) + '].') limitNumberOfFile = domainProperties.getProperty( 'wls.admin.httplog.limitNumOfFile') if not limitNumberOfFile is None and len( limitNumberOfFile) > 0: if not limitNumberOfFile.upper( ) == 'TRUE' and not limitNumberOfFile.upper() == 'FALSE': error = 1 log.error( 'The wls.admin.httplog.limitNumOfFile property supports only [true,false].' ) else: log.debug( 'Admin http log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty( 'wls.admin.httplog.fileToRetain') if not fileToRetain is None and len(fileToRetain) > 0: if not fileToRetain is None and len(fileToRetain) > 0: try: int(fileToRetain) except ValueError: log.error( 'Please verify wls.admin.httplog.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain) < 1 or int( fileToRetain) > 99999: log.error( 'Please verify wls.admin.httplog.fileToRetain property, number is not in valid range [1-99999].' ) else: log.debug('Admin http log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty( 'wls.admin.httplog.rotateLogOnStartup') if not logRotateOnStartup is None and len( logRotateOnStartup) > 0: if not logRotateOnStartup.upper( ) == 'TRUE' and not logRotateOnStartup.upper() == 'FALSE': error = 1 log.error( 'The wls.admin.httplog.rotateLogOnStartup property supports only [true,false].' ) else: log.debug( 'Admin http log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty( 'wls.admin.httplog.rotationType') if not rotationType is None and len(rotationType) > 0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error( 'The wls.admin.httplog.rotationType property supports only [bySize,byTime].' ) else: log.debug('Admin http log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty( 'wls.admin.httplog.fileMinSize') if not fileMinSize is None and len(fileMinSize) > 0: try: int(fileMinSize) except ValueError: log.error( 'Please verify wls.admin.httplog.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize) < 0 or int( fileMinSize) > 65535: log.error( 'Please verify wls.admin.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].' ) else: log.debug( 'Admin http log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty( 'wls.admin.httplog.rotationTime') if not rotationTime is None and len(rotationTime) > 0: if rotationTime.find(':') == -1: error = 1 log.error( 'Please verify wls.admin.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].' ) else: if len(rotationTime) < 4 or len( rotationTime) > 5: error = 1 log.error( 'The wls.admin.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].' ) else: log.debug( 'Admin http log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty( 'wls.admin.httplog.fileTimeSpan') if not fileTimespan is None and len(fileTimespan) > 0: try: int(fileTimespan) except ValueError: log.error( 'Please verify wls.admin.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan) < 1: log.error( 'Please verify wls.admin.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].' ) else: log.debug( 'Admin http log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty( 'wls.admin.httplog.rotationDir') if not rotationDir is None and len(rotationDir) > 0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug( '[NOTE] Please make sure the user running this script has permission to create directory and file for [' + str(rotationDir) + '].') return error
def validateDomainProperty(domainProperties): error = 0 domainMode = domainProperties.getProperty('wls.domain.mode') if not domainMode is None and len(domainMode) == 0: if not domainMode == 'prod' and not domainMode == 'dev': error = 1 log.error('The wls.domain.mode property supports only [prod,dev].') else: log.debug('Domain runtime mode [' + str(domainMode) + '] is valid.') domainAdminPort = domainProperties.getProperty('wls.domain.adminPort') if not domainAdminPort is None and len(domainAdminPort) > 0: try: int(domainAdminPort) except ValueError: log.error('Please verify wls.domain.adminPort property.') else: if int(domainAdminPort) < 0 or int(domainAdminPort) > 65535: log.error( 'Please verify wls.domain.adminPort property, port number is not in valid range [0-65535].' ) else: log.debug('Domain-wide administration port [' + str(domainAdminPort) + '] is valid.') keystore = domainProperties.getProperty('wls.domain.trustKeyStore') if not keystore is None and len(keystore) > 0: if not keystore == 'DemoTrust' and not keystore == 'CustomTrust': error = 1 log.error( 'wls.domain.trustKeyStore property supports only [DemoTrust,CustomTrust].' ) else: log.debug('Keystore type [' + str(keystore) + '] is valid.') else: if keystore == 'CustomTrust': tmpkeystoreFile = domainProperties.getProperty( 'wls.domain.trustKeyStoreFile') keystoreFile = File(tmpkeystoreFile) if not keystoreFile.exists(): error = 1 log.error( 'File ' + str(tmpkeystoreFile) + ' does not exist, please verify wls.domain.trustKeyStoreFile property.' ) else: log.debug('Keystore file [' + str(tmpkeystoreFile) + '] exists.') timeout = domainProperties.getProperty('wls.domain.jta.timeout') if not timeout is None and len(timeout) > 0: try: int(timeout) except: error = 1 log.error('Please verify wls.domain.jta.timeout property.') else: if int(timeout) < 1 or int(timeout) > 2147483647: log.error( 'Please verify wls.domain.jta.timeout property, It is not in valid range [0-2147483647].' ) else: log.debug('Domain JTA timeout property [' + str(timeout) + '] is valid.') securityInteropMode = domainProperties.getProperty( 'wls.domain.jta.securityInteropMode') if not securityInteropMode is None and len(securityInteropMode) > 0: if not securityInteropMode == 'default' and not securityInteropMode == 'performance' and not securityInteropMode == 'compatibility': error = 1 log.error( 'The wls.domain.jta.securityInteropMode property supports only [default,performance,compatibility, or leave blank to use default].' ) else: log.debug('Domain JTA Security Interop Mode property [' + str(securityInteropMode) + '] is valid.') authenticators = domainProperties.getProperty( 'wls.domain.security.authenticators') if not authenticators is None and len(authenticators) > 0: authenticatorList = authenticators.split(',') for authenticator in authenticatorList: helper.printHeader('[VALIDATING] authenticator ' + str(authenticator) + ' properties') authenticatorName = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.name') if authenticatorName is None or len(authenticatorName) == 0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.name property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] name property [' + str(authenticatorName) + '] is valid.') authenticatorType = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.type') if authenticatorType is None or len(authenticatorType) == 0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.type property if it exists in configuration.') else: if not authenticatorType == 'OpenLDAP' and not authenticatorType == 'ActiveDirectory': error = 1 log.error( 'The wls.domain.security.authenticator.' + str(authenticator) + '.type property supports only [OpenLDAP,ActiveDirectory].' ) else: log.debug('Authenticator [' + str(authenticator) + '] type property [' + str(authenticatorType) + '] is valid.') authenticatorPrincipal = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.principal') if authenticatorPrincipal is None or len( authenticatorPrincipal) == 0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.principal property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] principal property [' + str(authenticatorPrincipal) + '] is valid.') authenticatorCredential = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.credential') if authenticatorCredential is None or len( authenticatorCredential) == 0: error = 1 log.error( 'Please verify wls.domain.security.authenticator.' + str(authenticator) + '.credential property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] credential property [' + str(authenticatorCredential) + '] is valid.') authenticatorHost = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.host') if authenticatorHost is None or len(authenticatorHost) == 0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.host property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] host property [' + str(authenticatorHost) + '] is valid.') authenticatorPort = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.port') if not authenticatorPort is None and len(authenticatorPort) > 0: try: int(authenticatorPort) except: error = 1 log.error( 'Please verify wls.domain.security.authenticator.' + str(authenticator) + '.port property.') else: if int(authenticatorPort) < 0 or int( authenticatorPort) > 65535: log.error( 'Please verify wls.domain.security.authenticator.' + str(authenticator) + '.port property, port number is not in valid range [0-65535].' ) else: log.debug('Authenticator [' + str(authenticator) + '] port property [' + str(authenticatorPort) + '] is valid.') authenticatorSSL = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.sslEnabled') if not authenticatorSSL is None and len(authenticatorSSL) > 0: if not authenticatorSSL.upper( ) == 'TRUE' and not authenticatorSSL.upper() == 'FALSE': error = 1 log.error( 'The wls.domain.security.authenticator.' + str(authenticator) + '.sslEnabled property supports only [true,false].') else: log.debug('Authenticator [' + str(authenticator) + '] ssl-enabled property [' + str(authenticatorSSL) + '] is valid.') authenticatorKeepAlive = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.keepAliveEnabled') if not authenticatorKeepAlive is None and len( authenticatorKeepAlive) > 0: if not authenticatorKeepAlive.upper( ) == 'TRUE' and not authenticatorKeepAlive.upper() == 'FALSE': error = 1 log.error( 'The wls.domain.security.authenticator.' + str(authenticator) + '.keepAliveEnabled property supports only [true,false].' ) else: log.debug('Authenticator [' + str(authenticator) + '] keep-alive-enabled property [' + str(authenticatorKeepAlive) + '] is valid.') authenticatorGroupLookupCaching = domainProperties.getProperty( 'wls.domain.security.authenticator.' + str(authenticator) + '.enableSIDtoGroupLookupCaching') if not authenticatorGroupLookupCaching is None and len( authenticatorGroupLookupCaching) > 0: if not authenticatorGroupLookupCaching.upper( ) == 'TRUE' and not authenticatorGroupLookupCaching.upper( ) == 'FALSE': error = 1 log.error( 'The wls.domain.security.authenticator.' + str(authenticator) + '.enableSIDtoGroupLookupCaching property supports only [true,false].' ) else: log.debug( 'Authenticator [' + str(authenticator) + '] enable-SID-to-group-lookup-caching property [' + str(authenticatorGroupLookupCaching) + '] is valid.') groups = domainProperties.getProperty('wls.domain.security.groups') if not groups is None and len(groups) > 0: groupList = groups.split(',') for group in groupList: helper.printHeader('[VALIDATING] group ' + str(group) + ' properties') groupname = domainProperties.getProperty( 'wls.domain.security.group.' + str(group) + '.groupname') if groupname is None or len(groupname) == 0: error = 1 log.error('Please verify wls.domain.security.group.' + str(group) + '.groupname property if it exists in configuration.') else: log.debug('Group [' + str(group) + '] name property [' + str(groupname) + '] is valid.') groupauthenticator = domainProperties.getProperty( 'wls.domain.security.group.' + str(group) + '.authenticator') if groupauthenticator is None or len(groupauthenticator) == 0: log.debug( 'Group [' + str(group) + '] authenticator property [' + str(authenticator) + '] is not specified, it will be defaulted to DefaultAuthenticator.' ) else: if groupauthenticator != 'DefaultAuthenticator': if not authenticators is None and len(authenticators) > 0: authenticatorList = authenticators.split(',') exist = 0 for authenticator in authenticatorList: if groupauthenticator == authenticator: exist = 1 break if not exist: error = 1 log.error( 'Please verify wls.domain.security.group.' + str(group) + '.authenticator property and wls.domain.security.authenticators if they are configured properly.' ) else: log.debug('Group ' + str(group) + ' authenticator property [' + str(groupauthenticator) + '] is valid.') else: log.debug('Group [' + str(group) + '] authenticator property [' + str(groupauthenticator) + '] is valid.') users = domainProperties.getProperty('wls.domain.security.users') if not users is None and len(users) > 0: userList = users.split(',') for user in userList: helper.printHeader('[VALIDATING] user ' + str(user) + ' properties') username = domainProperties.getProperty( 'wls.domain.security.user.' + str(user) + '.username') if username is None or len(username) == 0: error = 1 log.error('Please verify wls.domain.security.user.' + str(user) + '.username property if it exists in configuration.') else: log.debug('User [' + str(user) + '] name property [' + str(username) + '] is valid.') userauthenticator = domainProperties.getProperty( 'wls.domain.security.user.' + str(user) + '.authenticator') if userauthenticator is None or len(userauthenticator) == 0: log.debug( 'User [' + str(user) + '] authenticator property [' + str(user) + '] is not specified, it will be defaulted to DefaultAuthenticator.' ) else: if userauthenticator != 'DefaultAuthenticator': if not authenticators is None and len(authenticators) > 0: authenticatorList = authenticators.split(',') exist = 0 for authenticator in authenticatorList: if userauthenticator == authenticator: exist = 1 break if not exist: error = 1 log.error( 'Please verify wls.domain.security.user.' + str(user) + '.authenticator property and wls.domain.security.authenticators if they are configured properly.' ) else: log.debug('User ' + str(user) + ' authenticator property [' + str(userauthenticator) + '] is valid.') else: log.debug('User [' + str(user) + '] authenticator property [' + str(userauthenticator) + '] is valid.') customvars = domainProperties.getProperty('wls.domain.customenvvars') if not customvars is None and len(customvars) > 0: customvarList = customvars.split(',') for customvar in customvarList: helper.printHeader('[VALIDATING] Custome environment variable ' + str(customvar) + ' properties') customvarText = domainProperties.getProperty( 'wls.domain.customenvvar.' + str(customvar) + '.text') if customvarText is None or len(customvarText) == 0: error = 1 log.error('Please verify wls.domain.customenvvar.' + str(customvar) + '.text property if it exists in configuration.') else: if customvarText.find('=') != -1: log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.') else: error = 1 log.error( 'Please verify wls.domain.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].' ) domaincustomlog = domainProperties.getProperty('wls.domain.log.custom') if not domaincustomlog is None and len(domaincustomlog) > 0: helper.printHeader('[VALIDATING] domain custom log properties') if not domaincustomlog.upper() == 'TRUE' and not domaincustomlog.upper( ) == 'FALSE': error = 1 log.error( 'The wls.domain.log.custom property supports only [true,false].' ) else: log.debug('Domain custom log enable property [' + str(domaincustomlog) + '] is valid.') if domaincustomlog.upper() == 'TRUE': filename = domainProperties.getProperty( 'wls.domain.log.filename') if not filename is None and len(filename) > 0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug( '[NOTE] Please verify the user running this script has permission to create directory and file [' + str(filename) + '].') limitNumberOfFile = domainProperties.getProperty( 'wls.domain.log.limitNumOfFile') if not limitNumberOfFile is None and len( limitNumberOfFile) > 0: if not limitNumberOfFile.upper( ) == 'TRUE' and not limitNumberOfFile.upper() == 'FALSE': error = 1 log.error( 'The wls.domain.log.limitNumOfFile property supports only [true,false].' ) else: log.debug( 'Domain log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty( 'wls.domain.log.fileToRetain') if not fileToRetain is None and len(fileToRetain) > 0: if not fileToRetain is None and len(fileToRetain) > 0: try: int(fileToRetain) except ValueError: log.error( 'Please verify wls.domain.log.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain) < 1 or int( fileToRetain) > 99999: log.error( 'Please verify wls.domain.log.fileToRetain property, number is not in valid range [1-99999].' ) else: log.debug('Domain log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty( 'wls.domain.log.rotateLogOnStartup') if not logRotateOnStartup is None and len( logRotateOnStartup) > 0: if not logRotateOnStartup.upper( ) == 'TRUE' and not logRotateOnStartup.upper() == 'FALSE': error = 1 log.error( 'The wls.domain.log.rotateLogOnStartup property supports only [true,false].' ) else: log.debug('Domain log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty( 'wls.domain.log.rotationType') if not rotationType is None and len(rotationType) > 0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error( 'The wls.domain.log.rotationType property supports only [bySize,byTime].' ) else: log.debug('Domain log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty( 'wls.domain.log.fileMinSize') if not fileMinSize is None and len(fileMinSize) > 0: try: int(fileMinSize) except ValueError: log.error( 'Please verify wls.domain.log.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize) < 0 or int( fileMinSize) > 65535: log.error( 'Please verify wls.domain.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].' ) else: log.debug('Domain log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty( 'wls.domain.log.rotationTime') if not rotationTime is None and len(rotationTime) > 0: if rotationTime.find(':') == -1: error = 1 log.error( 'Please verify wls.domain.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].' ) else: if len(rotationTime) < 4 or len( rotationTime) > 5: error = 1 log.error( 'The wls.domain.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].' ) else: log.debug('Domain log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty( 'wls.domain.log.fileTimeSpan') if not fileTimespan is None and len(fileTimespan) > 0: try: int(fileTimespan) except ValueError: log.error( 'Please verify wls.domain.log.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan) < 1: log.error( 'Please verify wls.domain.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].' ) else: log.debug('Domain log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty( 'wls.domain.log.rotationDir') if not rotationDir is None and len(rotationDir) > 0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug( '[NOTE] Please make sure if the user running this script has permission to create directory and file [' + str(rotationDir) + '].') fileSeverity = domainProperties.getProperty( 'wls.domain.log.logFileSeverity') if not fileSeverity is None and len(fileSeverity) > 0: if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning': error = 1 log.error( 'The wls.domain.log.logFileSeverity property supports only [Debug,Info,Warning].' ) else: log.debug('Domain log file severity property [' + str(fileSeverity) + '] is valid.') broadcastSeverity = domainProperties.getProperty( 'wls.domain.log.broadcastSeverity') if not broadcastSeverity is None and len( broadcastSeverity) > 0: if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off': error = 1 log.error( 'The wls.domain.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].' ) else: log.debug('Domain broadcast severity property [' + str(broadcastSeverity) + '] is valid.') memoryBufferSeverity = domainProperties.getProperty( 'wls.domain.log.memoryBufferSeverity') if not memoryBufferSeverity is None and len( memoryBufferSeverity) > 0: if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off': error = 1 log.error( 'The wls.domain.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].' ) else: log.debug('Domain memory buffer severity property [' + str(memoryBufferSeverity) + '] is valid.') return error
def validateAdminServerProperty(domainProperties): error = 0 helper.printHeader('[VALIDATING] admin server properties') adminPort = domainProperties.getProperty('wls.admin.listener.port') if not adminPort is None and len(adminPort)>0: try: int(adminPort) except ValueError: log.error('Please verify wls.admin.listener.port [' + str(adminPort) + '] property.') else: if int(adminPort)<0 or int(adminPort)>65535: log.error('Please verify wls.admin.listener.port property, port number is not in valid range [0-65535].') else: log.debug('Admin server port [' + str(adminPort) + '] is valid.') enableSSL = domainProperties.getProperty('wls.admin.listener.enableSSL') if not enableSSL is None and len(enableSSL)>0: if not enableSSL.upper()=='TRUE' and not enableSSL.upper()=='FALSE': error = 1 log.error('The wls.admin.listener.enableSSL property supports only [true,false].') else: log.debug('Admin server ssl enable property [' + str(enableSSL) + '] is valid.') if enableSSL.upper()=='TRUE': sslPort = domainProperties.getProperty('wls.admin.listener.sslPort') if not sslPort is None and len(sslPort)>0: try: int(sslPort) except ValueError: log.error('Please verify wls.admin.listener.sslPort [' + str(sslPort) + '] property.') else: if int(sslPort)<0 or int(sslPort)>65535: log.error('Please verify wls.admin.listener.sslPort property, port number is not in valid range [0-65535].') else: log.debug('Admin server ssl port [' + str(sslPort) + '] is valid.') adminchprotocol = domainProperties.getProperty('wls.admin.channel.protocol') if not adminchprotocol is None and len(adminchprotocol)>0: if not adminchprotocol=='t3' and not adminchprotocol=='t3s' and not adminchprotocol=='http' and not adminchprotocol=='https' and not adminchprotocol=='iiop' and not adminchprotocol=='iiops' and not adminchprotocol=='ldap' and not adminchprotocol=='ldaps' and not adminchprotocol=='admin': error = 1 log.error('The wls.admin.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].') else: log.debug('Admin channel protocol property [' + str(adminchprotocol) + '] is valid.') adminChannelPort = domainProperties.getProperty('wls.admin.channel.listener.port') if not adminChannelPort is None and len(adminChannelPort)>0: try: int(adminChannelPort) except ValueError: log.error('Please verify wls.admin.channel.listener.port [' + str(adminChannelPort) + '] property.') else: if int(adminChannelPort)<0 or int(adminChannelPort)>65535: log.error('Please verify wls.admin.channel.listener.port property, port number is not in valid range [0-65535].') else: log.debug('Admin channel port [' + str(adminChannelPort) + '] is valid.') adminChannelPublicPort = domainProperties.getProperty('wls.admin.channel.listener.publicPort') if not adminChannelPublicPort is None and len(adminChannelPublicPort)>0: try: int(adminChannelPublicPort) except ValueError: log.error('Please verify wls.admin.channel.listener.publicPort [' + str(adminChannelPublicPort) + '] property.') else: if int(adminChannelPublicPort)<0 or int(adminChannelPublicPort)>65535: log.error('Please verify wls.admin.channel.listener.publicPort property, port number is not in valid range [0-65535].') else: log.debug('Admin channel public port [' + str(adminChannelPublicPort) + '] is valid.') httpEnable = domainProperties.getProperty('wls.admin.channel.httpEnable') if not httpEnable is None and len(httpEnable)>0: if not httpEnable.upper()=='TRUE' and not httpEnable.upper()=='FALSE': error = 1 log.error('The wls.admin.channel.httpEnable property supports only [true,false].') else: log.debug('Admin http channel enable property [' + str(httpEnable) + '] is valid.') enableTunneling = domainProperties.getProperty('wls.admin.enableTunneling') if not enableTunneling is None and len(enableTunneling)>0: if not enableTunneling.upper()=='TRUE' and not enableTunneling.upper()=='FALSE': error = 1 log.error('The wls.admin.enableTunneling property supports only [true,false].') else: log.debug('Admin tunnelling enable property [' + str(enableTunneling) + '] is valid.') admincustomlog = domainProperties.getProperty('wls.admin.log.custom') if not admincustomlog is None and len(admincustomlog)>0: if not admincustomlog.upper()=='TRUE' and not admincustomlog.upper()=='FALSE': error = 1 log.error('The wls.admin.log.custom property supports only [true,false].') else: log.debug('Admin custom log enable property [' + str(admincustomlog) + '] is valid.') if admincustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.admin.log.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '].') limitNumberOfFile = domainProperties.getProperty('wls.admin.log.limitNumOfFile') if not limitNumberOfFile is None and len(limitNumberOfFile)>0: if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE': error = 1 log.error('The wls.admin.log.limitNumOfFile property supports only [true,false].') else: log.debug('Admin log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty('wls.admin.log.fileToRetain') if not fileToRetain is None and len(fileToRetain)>0: if not fileToRetain is None and len(fileToRetain)>0: try: int(fileToRetain) except ValueError: log.error('Please verify wls.admin.log.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain)<1 or int(fileToRetain)>99999: log.error('Please verify wls.admin.log.fileToRetain property, number is not in valid range [1-99999].') else: log.debug('Admin log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty('wls.admin.log.rotateLogOnStartup') if not logRotateOnStartup is None and len(logRotateOnStartup)>0: if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE': error = 1 log.error('The wls.admin.log.rotateLogOnStartup property supports only [true,false].') else: log.debug('Admin log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty('wls.admin.log.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.admin.log.rotationType property supports only [bySize,byTime].') else: log.debug('Admin log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.admin.log.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.admin.log.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.admin.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Admin log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.admin.log.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.admin.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.admin.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Admin log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.admin.log.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.admin.log.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.admin.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].') else: log.debug('Admin log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.admin.log.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '].') fileSeverity = domainProperties.getProperty('wls.admin.log.logFileSeverity') if not fileSeverity is None and len(fileSeverity)>0: if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning': error = 1 log.error('The wls.admin.log.logFileSeverity property supports only [Debug,Info,Warning].') else: log.debug('Admin log file severity property [' + str(fileSeverity) + '] is valid.') broadcastSeverity = domainProperties.getProperty('wls.admin.log.broadcastSeverity') if not broadcastSeverity is None and len(broadcastSeverity)>0: if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off': error = 1 log.error('The wls.admin.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Admin broadcast severity property [' + str(broadcastSeverity) + '] is valid.') memoryBufferSeverity = domainProperties.getProperty('wls.admin.log.memoryBufferSeverity') if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0: if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off': error = 1 log.error('The wls.admin.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Admin memory buffer severity property [' + str(memoryBufferSeverity) + '] is valid.') adminhttpcustomlog = domainProperties.getProperty('wls.admin.httplog.enable') if not adminhttpcustomlog is None and len(adminhttpcustomlog)>0: if not adminhttpcustomlog.upper()=='TRUE' and not adminhttpcustomlog.upper()=='FALSE': error = 1 log.error('The wls.admin.httplog.enable property supports only [true,false].') else: log.debug('Admin http custom log enable property [' + str(adminhttpcustomlog) + '] is valid.') if adminhttpcustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.admin.httplog.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file for [' + str(filename) + '].') limitNumberOfFile = domainProperties.getProperty('wls.admin.httplog.limitNumOfFile') if not limitNumberOfFile is None and len(limitNumberOfFile)>0: if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE': error = 1 log.error('The wls.admin.httplog.limitNumOfFile property supports only [true,false].') else: log.debug('Admin http log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty('wls.admin.httplog.fileToRetain') if not fileToRetain is None and len(fileToRetain)>0: if not fileToRetain is None and len(fileToRetain)>0: try: int(fileToRetain) except ValueError: log.error('Please verify wls.admin.httplog.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain)<1 or int(fileToRetain)>99999: log.error('Please verify wls.admin.httplog.fileToRetain property, number is not in valid range [1-99999].') else: log.debug('Admin http log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty('wls.admin.httplog.rotateLogOnStartup') if not logRotateOnStartup is None and len(logRotateOnStartup)>0: if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE': error = 1 log.error('The wls.admin.httplog.rotateLogOnStartup property supports only [true,false].') else: log.debug('Admin http log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty('wls.admin.httplog.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.admin.httplog.rotationType property supports only [bySize,byTime].') else: log.debug('Admin http log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.admin.httplog.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.admin.httplog.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.admin.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Admin http log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.admin.httplog.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.admin.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.admin.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Admin http log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.admin.httplog.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.admin.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.admin.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].') else: log.debug('Admin http log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.admin.httplog.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file for [' + str(rotationDir) + '].') return error
def validateDomainProperty(domainProperties): error = 0 domainMode = domainProperties.getProperty('wls.domain.mode') if not domainMode is None and len(domainMode)==0: if not domainMode == 'prod' and not domainMode == 'dev': error = 1 log.error('The wls.domain.mode property supports only [prod,dev].') else: log.debug('Domain runtime mode [' + str(domainMode) + '] is valid.') domainAdminPort = domainProperties.getProperty('wls.domain.adminPort') if not domainAdminPort is None and len(domainAdminPort)>0: try: int(domainAdminPort) except ValueError: log.error('Please verify wls.domain.adminPort property.') else: if int(domainAdminPort)<0 or int(domainAdminPort)>65535: log.error('Please verify wls.domain.adminPort property, port number is not in valid range [0-65535].') else: log.debug('Domain-wide administration port [' + str(domainAdminPort) + '] is valid.') keystore = domainProperties.getProperty('wls.domain.trustKeyStore') if not keystore is None and len(keystore)>0: if not keystore == 'DemoTrust' and not keystore == 'CustomTrust': error = 1 log.error('wls.domain.trustKeyStore property supports only [DemoTrust,CustomTrust].') else: log.debug('Keystore type [' + str(keystore) + '] is valid.') else: if keystore == 'CustomTrust': tmpkeystoreFile = domainProperties.getProperty('wls.domain.trustKeyStoreFile') keystoreFile = File(tmpkeystoreFile) if not keystoreFile.exists(): error = 1 log.error('File ' + str(tmpkeystoreFile) + ' does not exist, please verify wls.domain.trustKeyStoreFile property.') else: log.debug('Keystore file [' + str(tmpkeystoreFile) + '] exists.') timeout = domainProperties.getProperty('wls.domain.jta.timeout') if not timeout is None and len(timeout)>0: try: int(timeout) except: error = 1 log.error('Please verify wls.domain.jta.timeout property.') else: if int(timeout)<1 or int(timeout)>2147483647: log.error('Please verify wls.domain.jta.timeout property, It is not in valid range [0-2147483647].') else: log.debug('Domain JTA timeout property [' + str(timeout) + '] is valid.') securityInteropMode = domainProperties.getProperty('wls.domain.jta.securityInteropMode') if not securityInteropMode is None and len(securityInteropMode)>0: if not securityInteropMode=='default' and not securityInteropMode=='performance' and not securityInteropMode=='compatibility': error = 1 log.error('The wls.domain.jta.securityInteropMode property supports only [default,performance,compatibility, or leave blank to use default].') else: log.debug('Domain JTA Security Interop Mode property [' + str(securityInteropMode) + '] is valid.') authenticators = domainProperties.getProperty('wls.domain.security.authenticators') if not authenticators is None and len(authenticators)>0: authenticatorList = authenticators.split(',') for authenticator in authenticatorList: helper.printHeader('[VALIDATING] authenticator ' + str(authenticator) + ' properties') authenticatorName = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.name') if authenticatorName is None or len(authenticatorName)==0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.name property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] name property [' + str(authenticatorName) + '] is valid.') authenticatorType = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.type') if authenticatorType is None or len(authenticatorType)==0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.type property if it exists in configuration.') else: if not authenticatorType=='OpenLDAP' and not authenticatorType=='ActiveDirectory': error = 1 log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.type property supports only [OpenLDAP,ActiveDirectory].') else: log.debug('Authenticator [' + str(authenticator) + '] type property [' + str(authenticatorType) + '] is valid.') authenticatorPrincipal = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.principal') if authenticatorPrincipal is None or len(authenticatorPrincipal)==0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.principal property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] principal property [' + str(authenticatorPrincipal) + '] is valid.') authenticatorCredential = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.credential') if authenticatorCredential is None or len(authenticatorCredential)==0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.credential property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] credential property [' + str(authenticatorCredential) + '] is valid.') authenticatorHost = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.host') if authenticatorHost is None or len(authenticatorHost)==0: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.host property if it exists in configuration.') else: log.debug('Authenticator [' + str(authenticator) + '] host property [' + str(authenticatorHost) + '] is valid.') authenticatorPort = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.port') if not authenticatorPort is None and len(authenticatorPort)>0: try: int(authenticatorPort) except: error = 1 log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.port property.') else: if int(authenticatorPort)<0 or int(authenticatorPort)>65535: log.error('Please verify wls.domain.security.authenticator.' + str(authenticator) + '.port property, port number is not in valid range [0-65535].') else: log.debug('Authenticator [' + str(authenticator) + '] port property [' + str(authenticatorPort) + '] is valid.') authenticatorSSL = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.sslEnabled') if not authenticatorSSL is None and len(authenticatorSSL)>0: if not authenticatorSSL.upper()=='TRUE' and not authenticatorSSL.upper()=='FALSE': error = 1 log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.sslEnabled property supports only [true,false].') else: log.debug('Authenticator [' + str(authenticator) + '] ssl-enabled property [' + str(authenticatorSSL) + '] is valid.') authenticatorKeepAlive = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.keepAliveEnabled') if not authenticatorKeepAlive is None and len(authenticatorKeepAlive)>0: if not authenticatorKeepAlive.upper()=='TRUE' and not authenticatorKeepAlive.upper()=='FALSE': error = 1 log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.keepAliveEnabled property supports only [true,false].') else: log.debug('Authenticator [' + str(authenticator) + '] keep-alive-enabled property [' + str(authenticatorKeepAlive) + '] is valid.') authenticatorGroupLookupCaching = domainProperties.getProperty('wls.domain.security.authenticator.' + str(authenticator) + '.enableSIDtoGroupLookupCaching') if not authenticatorGroupLookupCaching is None and len(authenticatorGroupLookupCaching)>0: if not authenticatorGroupLookupCaching.upper()=='TRUE' and not authenticatorGroupLookupCaching.upper()=='FALSE': error = 1 log.error('The wls.domain.security.authenticator.' + str(authenticator) + '.enableSIDtoGroupLookupCaching property supports only [true,false].') else: log.debug('Authenticator [' + str(authenticator) + '] enable-SID-to-group-lookup-caching property [' + str(authenticatorGroupLookupCaching) + '] is valid.') groups = domainProperties.getProperty('wls.domain.security.groups') if not groups is None and len(groups)>0: groupList = groups.split(',') for group in groupList: helper.printHeader('[VALIDATING] group ' + str(group) + ' properties') groupname = domainProperties.getProperty('wls.domain.security.group.' + str(group) + '.groupname') if groupname is None or len(groupname)==0: error = 1 log.error('Please verify wls.domain.security.group.' + str(group) + '.groupname property if it exists in configuration.') else: log.debug('Group [' + str(group) + '] name property [' + str(groupname) + '] is valid.') groupauthenticator = domainProperties.getProperty('wls.domain.security.group.' + str(group) + '.authenticator') if groupauthenticator is None or len(groupauthenticator)==0: log.debug('Group [' + str(group) + '] authenticator property [' + str(authenticator) + '] is not specified, it will be defaulted to DefaultAuthenticator.') else: if groupauthenticator!='DefaultAuthenticator': if not authenticators is None and len(authenticators)>0: authenticatorList = authenticators.split(',') exist = 0 for authenticator in authenticatorList: if groupauthenticator==authenticator: exist = 1 break if not exist: error = 1 log.error('Please verify wls.domain.security.group.' + str(group) + '.authenticator property and wls.domain.security.authenticators if they are configured properly.') else: log.debug('Group ' + str(group) + ' authenticator property [' + str(groupauthenticator) + '] is valid.') else: log.debug('Group [' + str(group) + '] authenticator property [' + str(groupauthenticator) + '] is valid.') users = domainProperties.getProperty('wls.domain.security.users') if not users is None and len(users)>0: userList = users.split(',') for user in userList: helper.printHeader('[VALIDATING] user ' + str(user) + ' properties') username = domainProperties.getProperty('wls.domain.security.user.' + str(user) + '.username') if username is None or len(username)==0: error = 1 log.error('Please verify wls.domain.security.user.' + str(user) + '.username property if it exists in configuration.') else: log.debug('User [' + str(user) + '] name property [' + str(username) + '] is valid.') userauthenticator = domainProperties.getProperty('wls.domain.security.user.' + str(user) + '.authenticator') if userauthenticator is None or len(userauthenticator)==0: log.debug('User [' + str(user) + '] authenticator property [' + str(user) + '] is not specified, it will be defaulted to DefaultAuthenticator.') else: if userauthenticator!='DefaultAuthenticator': if not authenticators is None and len(authenticators)>0: authenticatorList = authenticators.split(',') exist = 0 for authenticator in authenticatorList: if userauthenticator==authenticator: exist = 1 break if not exist: error = 1 log.error('Please verify wls.domain.security.user.' + str(user) + '.authenticator property and wls.domain.security.authenticators if they are configured properly.') else: log.debug('User ' + str(user) + ' authenticator property [' + str(userauthenticator) + '] is valid.') else: log.debug('User [' + str(user) + '] authenticator property [' + str(userauthenticator) + '] is valid.') customvars = domainProperties.getProperty('wls.domain.customenvvars') if not customvars is None and len(customvars)>0: customvarList = customvars.split(',') for customvar in customvarList: helper.printHeader('[VALIDATING] Custome environment variable ' + str(customvar) + ' properties') customvarText = domainProperties.getProperty('wls.domain.customenvvar.' + str(customvar) + '.text') if customvarText is None or len(customvarText)==0: error = 1 log.error('Please verify wls.domain.customenvvar.' + str(customvar) + '.text property if it exists in configuration.') else: if customvarText.find('=')!=-1: log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.') else: error = 1 log.error('Please verify wls.domain.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].') domaincustomlog = domainProperties.getProperty('wls.domain.log.custom') if not domaincustomlog is None and len(domaincustomlog)>0: helper.printHeader('[VALIDATING] domain custom log properties') if not domaincustomlog.upper()=='TRUE' and not domaincustomlog.upper()=='FALSE': error = 1 log.error('The wls.domain.log.custom property supports only [true,false].') else: log.debug('Domain custom log enable property [' + str(domaincustomlog) + '] is valid.') if domaincustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.domain.log.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please verify the user running this script has permission to create directory and file [' + str(filename) + '].') limitNumberOfFile = domainProperties.getProperty('wls.domain.log.limitNumOfFile') if not limitNumberOfFile is None and len(limitNumberOfFile)>0: if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE': error = 1 log.error('The wls.domain.log.limitNumOfFile property supports only [true,false].') else: log.debug('Domain log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty('wls.domain.log.fileToRetain') if not fileToRetain is None and len(fileToRetain)>0: if not fileToRetain is None and len(fileToRetain)>0: try: int(fileToRetain) except ValueError: log.error('Please verify wls.domain.log.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain)<1 or int(fileToRetain)>99999: log.error('Please verify wls.domain.log.fileToRetain property, number is not in valid range [1-99999].') else: log.debug('Domain log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty('wls.domain.log.rotateLogOnStartup') if not logRotateOnStartup is None and len(logRotateOnStartup)>0: if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE': error = 1 log.error('The wls.domain.log.rotateLogOnStartup property supports only [true,false].') else: log.debug('Domain log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty('wls.domain.log.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.domain.log.rotationType property supports only [bySize,byTime].') else: log.debug('Domain log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.domain.log.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.domain.log.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.domain.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Domain log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.domain.log.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.domain.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.domain.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Domain log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.domain.log.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.domain.log.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.domain.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].') else: log.debug('Domain log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.domain.log.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure if the user running this script has permission to create directory and file [' + str(rotationDir) + '].') fileSeverity = domainProperties.getProperty('wls.domain.log.logFileSeverity') if not fileSeverity is None and len(fileSeverity)>0: if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning': error = 1 log.error('The wls.domain.log.logFileSeverity property supports only [Debug,Info,Warning].') else: log.debug('Domain log file severity property [' + str(fileSeverity) + '] is valid.') broadcastSeverity = domainProperties.getProperty('wls.domain.log.broadcastSeverity') if not broadcastSeverity is None and len(broadcastSeverity)>0: if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off': error = 1 log.error('The wls.domain.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Domain broadcast severity property [' + str(broadcastSeverity) + '] is valid.') memoryBufferSeverity = domainProperties.getProperty('wls.domain.log.memoryBufferSeverity') if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0: if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off': error = 1 log.error('The wls.domain.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Domain memory buffer severity property [' + str(memoryBufferSeverity) + '] is valid.') return error
def validateServerProperty(domainProperties): error = 0 machines = domainProperties.getProperty('wls.domain.machines') clusters = domainProperties.getProperty('wls.clusters') servers = domainProperties.getProperty('wls.servers') if not servers is None and len(servers)>0: serverList = servers.split(',') for server in serverList: helper.printHeader('[VALIDATING] server ' + str(server) + ' properties') serverName = domainProperties.getProperty('wls.server.' + str(server) + '.name') if serverName is None or len(serverName)==0: error = 1 log.error('Please verify wls.server.' + str(server) + '.name property if it exists in configuration.') else: log.debug('Server [' + str(server) + '] name property [' + str(serverName) + '] is valid.') targetCluster = domainProperties.getProperty('wls.server.' + str(server) + '.cluster') if targetCluster: if not clusters is None and len(clusters)>0: clusterList = clusters.split(',') exist = 0 for cluster in clusterList: clusterName = domainProperties.getProperty('wls.cluster.' + str(cluster) + '.name') if cluster==targetCluster: exist = 1 break if not exist: error = 1 log.error('wls.server.' + str(server) + '.cluster property refers to a cluster [' + targetCluster + '] that does not exist within wls.clusters property.') else: log.debug('Server [' + str(server) + '] cluster property [' + str(clusterName) + '] is valid.') serverHost = domainProperties.getProperty('wls.server.' + str(server) + '.listener.address') if serverHost is None or len(serverHost)==0: serverHost = 'localhost' serverPort = domainProperties.getProperty('wls.server.' + str(server) + '.listener.port') if not serverPort is None and len(serverPort)>0: try: int(serverPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.listener.port [' + str(serverPort) + '] property.') else: if int(serverPort)<0 or int(serverPort)>65535: log.error('Please verify wls.server.' + str(server) + '.listener.port property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] server port property [' + str(serverPort) + '] is valid.') enableSSL = domainProperties.getProperty('wls.server.' + str(server) + '.listener.enableSSL') if not enableSSL is None and len(enableSSL)>0: if not enableSSL.upper()=='TRUE' and not enableSSL.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.listener.enableSSL property supports only [true,false].') else: log.debug('Server [' + str(server) + '] ssl enable property [' + str(enableSSL) + '] is valid.') if enableSSL.upper()=='TRUE': sslPort = domainProperties.getProperty('wls.server.' + str(server) + '.listener.sslPort') if not sslPort is None and len(sslPort)>0: try: int(sslPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.listener.sslPort [' + str(sslPort) + '] property.') else: if int(sslPort)<0 or int(sslPort)>65535: log.error('Please verify wls.server.' + str(server) + '.listener.sslPort property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] ssl port property [' + str(sslPort) + '] is valid.') customvars = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvars') if not customvars is None and len(customvars)>0: customvarList = customvars.split(',') for customvar in customvarList: helper.printHeader('[VALIDATING] Custom environment variable ' + str(customvar) + ' properties') customvarText = domainProperties.getProperty('wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text') if customvarText is None or len(customvarText)==0: error = 1 log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property if it exists in configuration.') else: if customvarText.find('=')!=-1: log.debug('Custome environment variable [' + str(customvar) + '] text property [' + str(customvarText) + '] is valid.') else: error = 1 log.error('Please verify wls.server.' + str(server) + '.customenvvar.' + str(customvar) + '.text property, this is applicable only for key-value pairs format [<name>=<value>].') serverChannelName = domainProperties.getProperty('wls.server.' + str(server) + '.channel.name') if not serverChannelName is None and len(serverChannelName)>0: serverChannelProtocol = domainProperties.getProperty('wls.server.' + str(server) + '.channel.protocol') if not serverChannelProtocol=='t3' and not serverChannelProtocol=='t3s' and not serverChannelProtocol=='http' and not serverChannelProtocol=='https' and not serverChannelProtocol=='iiop' and not serverChannelProtocol=='iiops' and not serverChannelProtocol=='ldap' and not serverChannelProtocol=='ldaps' and not serverChannelProtocol=='admin': error = 1 log.error('The wls.server.' + str(server) + '.channel.protocol property supports only [t3,t3s,http,https,iiop,iiops,ldap,ldaps,admin].') else: log.debug('Server [' + str(server) + '] channel protocol property [' + str(serverChannelProtocol) + '] is valid.') serverChannelPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.port') if not serverChannelPort is None and len(serverChannelPort)>0: try: int(serverChannelPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.channel.listener.port [' + str(serverChannelPort) + '] property.') else: if int(serverChannelPort)<0 or int(serverChannelPort)>65535: log.error('Please verify wls.server.' + str(server) + '.channel.listener.port property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] channel port [' + str(serverChannelPort) + '] is valid.') serverChannelPublicPort = domainProperties.getProperty('wls.server.' + str(server) + '.channel.listener.publicPort') if not serverChannelPublicPort is None and len(serverChannelPublicPort)>0: try: int(serverChannelPublicPort) except ValueError: log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort [' + str(serverChannelPublicPort) + '] property.') else: if int(serverChannelPublicPort)<0 or int(serverChannelPublicPort)>65535: log.error('Please verify wls.server.' + str(server) + '.channel.listener.publicPort property, port number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] channel public port [' + str(serverChannelPublicPort) + '] is valid.') httpEnable = domainProperties.getProperty('wls.server.' + str(server) + '.channel.httpEnable') if not httpEnable is None and len(httpEnable)>0: if not httpEnable.upper()=='TRUE' and not httpEnable.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.channel.httpEnable property supports only [true,false].') else: log.debug('Server [' + str(server) + '] http channel enable property [' + str(httpEnable) + '] is valid.') enableTunneling = domainProperties.getProperty('wls.server.' + str(server) + '.enableTunneling') if not enableTunneling is None and len(enableTunneling)>0: if not enableTunneling.upper()=='TRUE' and not enableTunneling.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.enableTunneling property supports only [true,false].') else: log.debug('Server [' + str(server) + '] tunnelling enable property [' + str(enableTunneling) + '] is valid.') targetMachine = domainProperties.getProperty('wls.server.' + str(server) + '.machine') if not targetMachine is None and len(targetMachine)>0: if not machines is None and len(machines)>0: machineList = machines.split(',') exist = 0 for machine in machineList: machineName = domainProperties.getProperty('wls.domain.machine.' + str(machine) + '.name') if machine==targetMachine: exist = 1 break if not exist: error = 1 log.error('wls.server.' + str(server) + '.machine property refers to a machine that does not exist within the wls.domain.machines property list.') else: log.debug('Server [' + str(server) + '] machine property [' + str(targetMachine) + '] is valid.') servercustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.log.custom') if not servercustomlog is None and len(servercustomlog)>0: if not servercustomlog.upper()=='TRUE' and not servercustomlog.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.log.custom property supports only [true,false].') else: log.debug('Server [' + str(server) + '] custom log enable property [' + str(servercustomlog) + '] is valid.') if servercustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.server.' + str(server) + '.log.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].') limitNumberOfFile = domainProperties.getProperty('wls.server.' + str(server) + '.log.limitNumOfFile') if not limitNumberOfFile is None and len(limitNumberOfFile)>0: if not limitNumberOfFile.upper()=='TRUE' and not limitNumberOfFile.upper()=='FALSE': error = 1 log.error('The wls.admin.log.limitNumOfFile property supports only [true,false].') else: log.debug('Server [' + str(server) + '] log limit number of file property [' + str(limitNumberOfFile) + '] is valid.') fileToRetain = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileToRetain') if not fileToRetain is None and len(fileToRetain)>0: if not fileToRetain is None and len(fileToRetain)>0: try: int(fileToRetain) except ValueError: log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain [' + str(fileToRetain) + '] property.') else: if int(fileToRetain)<1 or int(fileToRetain)>99999: log.error('Please verify wls.server.' + str(server) + '.log.fileToRetain property, number is not in valid range [1-99999].') else: log.debug('Server [' + str(server) + '] log file to retain [' + str(fileToRetain) + '] is valid.') logRotateOnStartup = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotateLogOnStartup') if not logRotateOnStartup is None and len(logRotateOnStartup)>0: if not logRotateOnStartup.upper()=='TRUE' and not logRotateOnStartup.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.log.rotateLogOnStartup property supports only [true,false].') else: log.debug('Server [' + str(server) + '] log rotate on startup property [' + str(logRotateOnStartup) + '] is valid.') rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.server.' + str(server) + '.log.rotationType property supports only [bySize,byTime].') else: log.debug('Server [' + str(server) + '] log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.server.' + str(server) + '.log.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.server.' + str(server) + '.log.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Server [' + str(server) + '] log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.log.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.server.' + str(server) + '.log.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [<=1].') else: log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.log.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].') fileSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.logFileSeverity') if not fileSeverity is None and len(fileSeverity)>0: if not fileSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Warning': error = 1 log.error('The wls.server.' + str(server) + '.log.logFileSeverity property supports only [Debug,Info,Warning].') else: log.debug('Server [' + str(server) + '] log file severity property [' + str(fileSeverity) + '] is valid.') broadcastSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.broadcastSeverity') if not broadcastSeverity is None and len(broadcastSeverity)>0: if not broadcastSeverity == 'Trace' and not broadcastSeverity == 'Debug' and not broadcastSeverity == 'Info' and not broadcastSeverity == 'Notice' and not broadcastSeverity == 'Warning' and not broadcastSeverity == 'Error' and not broadcastSeverity == 'Critical' and not broadcastSeverity == 'Alert' and not broadcastSeverity == 'Emergency' and not broadcastSeverity == 'Off': error = 1 log.error('The wls.server.' + str(server) + '.log.broadcastSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Server [' + str(server) + '] broadcast severity log property [' + str(broadcastSeverity) + '] is valid.') memoryBufferSeverity = domainProperties.getProperty('wls.server.' + str(server) + '.log.memoryBufferSeverity') if not memoryBufferSeverity is None and len(memoryBufferSeverity)>0: if not memoryBufferSeverity == 'Trace' and not memoryBufferSeverity == 'Debug' and not fileSeverity == 'Info' and not fileSeverity == 'Notice' and not fileSeverity == 'Warning' and not fileSeverity == 'Error' and not fileSeverity == 'Critical' and not fileSeverity == 'Alert' and not fileSeverity == 'Emergency' and not fileSeverity == 'Off': error = 1 log.error('The wls.server.' + str(server) + '.log.memoryBufferSeverity property supports only [Trace,Debug,Info,Notice,Warning,Error,Critical,Alert,Emergency,Off].') else: log.debug('Server [' + str(server) + '] memory buffer severity log property [' + str(memoryBufferSeverity) + '] is valid.') serverhttpcustomlog = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.enable') if not serverhttpcustomlog is None and len(serverhttpcustomlog)>0: if not serverhttpcustomlog.upper()=='TRUE' and not serverhttpcustomlog.upper()=='FALSE': error = 1 log.error('The wls.server.' + str(server) + '.httplog.enable property supports only [true,false].') else: log.debug('Server [' + str(server) + '] http custom log enable property [' + str(serverhttpcustomlog) + '] is valid.') if serverhttpcustomlog.upper()=='TRUE': filename = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.filename') if not filename is None and len(filename)>0: file = File(filename) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directories and directory and file [' + str(filename) + '] on host [' + str(serverHost) + '].') rotationType = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationType') if not rotationType is None and len(rotationType)>0: if not rotationType == 'bySize' and not rotationType == 'byTime': error = 1 log.error('The wls.server.' + str(server) + '.httplog.rotationType property supports only [bySize,byTime].') else: log.debug('Server [' + str(server) + '] http log rotation type property [' + str(rotationType) + '] is valid.') if rotationType == 'bySize': fileMinSize = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileMinSize') if not fileMinSize is None and len(fileMinSize)>0: try: int(fileMinSize) except ValueError: log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property.') else: if int(fileMinSize)<0 or int(fileMinSize)>65535: log.error('Please verify wls.server.' + str(server) + '.httplog.fileMinSize [' + str(fileMinSize) + '] property, number is not in valid range [0-65535].') else: log.debug('Server [' + str(server) + '] http log file min size [' + str(fileMinSize) + '] is valid.') if rotationType == 'byTime': rotationTime = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationTime') if not rotationTime is None and len(rotationTime)>0: if rotationTime.find(':')==-1: error = 1 log.error('Please verify wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: if len(rotationTime)<4 or len(rotationTime)>5: error = 1 log.error('The wls.server.' + str(server) + '.httplog.rotationTime [' + str(rotationTime) + '] property, the property supports time format [HH:MM].') else: log.debug('Server [' + str(server) + '] http log rotation time [' + str(rotationTime) + '] is valid.') fileTimespan = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.fileTimeSpan') if not fileTimespan is None and len(fileTimespan)>0: try: int(fileTimespan) except ValueError: log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property.') else: if int(fileTimespan)<1: log.error('Please verify wls.server.' + str(server) + '.httplog.fileTimeSpan [' + str(fileTimespan) + '] property, number is not in valid range [>=1].') else: log.debug('Server [' + str(server) + '] log file timespan [' + str(fileTimespan) + '] is valid.') rotationDir = domainProperties.getProperty('wls.server.' + str(server) + '.httplog.rotationDir') if not rotationDir is None and len(rotationDir)>0: file = File(rotationDir) if file.isAbsolute(): if not file.exists(): log.debug('[NOTE] Please make sure the user running this script has permission to create directory and file [' + str(rotationDir) + '] on host [' + str(serverHost) + '].') return error