def pageFile(self, file, pager): try: dot = file.rindex(".") ext = file[dot + 1:] except ValueError: ext = "" localFile = tempfile.mktemp(ext) try: self.dsc.Download(file, localFile) if Platform.IsWindows() and pager == "more": os.system("more < %s" % (localFile)) else: os.system("%s %s" % (pager, localFile)) os.unlink(localFile) except Exception, e: print "Except! ", e
def IsExecFileAvailable(file, path=None): """ Used to check if a command is available to be executed. Checks directories in the PATH variable are included. On windows, the current directory is included automatically. Note that the exact filename is required -- i.e. "python.exe" will be found on windows, but "python" won't. """ if path == None: path = os.environ['PATH'] # Windows always includes the current directory. if Platform.IsWindows(): separatedPath = path.split(";") separatedPath.append(".") else: separatedPath = path.split(":") for singlePath in separatedPath: fullpath = os.path.join(singlePath, file) #print "Checking full path:", fullpath if os.access(fullpath, os.X_OK): return 1 return 0
def __init__(self): AGService.__init__(self) self.thepath = os.getcwd() self.windowGeometry = None self.capabilities = [ Capability(Capability.CONSUMER, Capability.AUDIO, "L16", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L16", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L8", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L8", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "PCMU", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "PCMU", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "GSM", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "GSM", 8000, self.id), Capability(Capability.PRODUCER, Capability.AUDIO, "L16", 16000, self.id) ] if Platform.IsWindows(): rat = "rat.exe" ratmedia = "ratmedia.exe" ratui = "rat-ui.exe" ratkill = "rat-kill.exe" else: rat = "rat" ratmedia = "ratmedia" ratui = "rat-ui" ratkill = "rat-kill" self.executable = os.path.join(os.getcwd(), rat) self.rat_media = os.path.join(os.getcwd(), ratmedia) self.rat_ui = os.path.join(os.getcwd(), ratui) self.rat_kill = os.path.join(os.getcwd(), ratkill) if not os.path.isfile(self.executable): self.executable = rat self.rat_media = ratmedia self.rat_ui = ratui self.rat_kill = ratkill # For some reason, a full path is need for ratkill for dir in os.getenv("PATH").split(":"): ratkill_fullpath = os.path.join(dir, ratkill) if os.access(ratkill_fullpath, os.X_OK): self.rat_kill = ratkill_fullpath break self.sysConf = SystemConfig.instance() # Set configuration parameters self.talk = OptionSetParameter("Talk", "Off", ["On", "Off"]) self.inputGain = RangeParameter("Input Gain", 50, 0, 100) if Platform.isOSX(): self.outputGain = RangeParameter("Output Gain", 4, 0, 100) else: self.outputGain = RangeParameter("Output Gain", 50, 0, 100) self.silenceSuppression = OptionSetParameter( "Silence Suppression", "Off", ["Off", "Automatic", "Manual"]) self.positionWindow = OptionSetParameter( 'Position Window', 'Off', ['Off', 'Justify Left', 'Justify Right']) self.configuration.append(self.talk) self.configuration.append(self.inputGain) self.configuration.append(self.outputGain) self.configuration.append(self.silenceSuppression) self.configuration.append(self.positionWindow) if Platform.isLinux() or Platform.isFreeBSD(): # note: the forceOSSAC97 attribute will only exist for the above platforms self.forceOSSAC97 = OptionSetParameter("Force AC97", "False", ["True", "False"]) self.configuration.append(self.forceOSSAC97) self.useSiteId = OptionSetParameter("Use site id", "On", ["On", "Off"]) self.configuration.append(self.useSiteId) self.profile = None
def SubmitBug(comment, profile, email, logFile=VENUE_CLIENT_LOG): """ Submits a bug to bugzilla. **Parameters** *comment* = Bug description from reporter *profile* = Client Profile describing reporter *email* = Entered email address for support information. If the email is blank, the reporter does not want to be contacted. """ url = "http://bugzilla.mcs.anl.gov/accessgrid/post_bug.cgi" args = {} bugzilla_login = '******' bugzilla_password = '******' args['Bugzilla_login'] = bugzilla_login args['Bugzilla_password'] = bugzilla_password version = '%s %s' % (str(GetVersion()), str(GetStatus())) version = version.strip() args['version'] = version args['rep_platform'] = "Other" # # This detection can get beefed up a lot; I say # NT because I can't tell if it's 2000 or XP and better # to not assume there. # # cf http://www.lemburg.com/files/python/platform.py # if Platform.IsLinux(): args['op_sys'] = "Linux" args['rep_platform'] = "All" # Need a better check for this. elif Platform.IsWindows(): args['op_sys'] = "Windows NT" args['rep_platform'] = "PC" elif Platform.IsOSX(): args['op_sys'] = "MacOS X" args['rep_platform'] = "Macintosh" else: args['op_sys'] = "other" args['priority'] = "P2" args['bug_severity'] = "normal" args['bug_status'] = "NEW" args['assigned_to'] = "" args['cc'] = "*****@*****.**" # email to be cc'd args['bug_file_loc'] = "http://" args['submit'] = " Commit " args['form_name'] = "enter_bug" # Combine comment, profile, and log file information userConfig = Config.UserConfig.instance() # Get config information configData = "\n%s" % userConfig configData += "\n%s\n" % Config.SystemConfig.instance() # Defaults. args['product'] = "Virtual Venues Client Software" args['component'] = "Client UI" logToSearch = None if profile: # Always set profile email to empty string so we don't write # to wrong email address. profile.email = "" profileString = str(profile) else: profileString = "This reporter does not have a client profile" if email == "": # This reporter does not want to be contacted. Do not submit # email address. email = "This reporter does not want to be contacted. No email address specified." def AppendNodeLogs(text): text = text +"\n\n--- ServiceManager.log INFORMATION ---\n\n"+ \ GetLogText(2000, "ServiceManager.log")\ logDir = userConfig.GetLogDir() otherServiceLogs = os.listdir(logDir) for serviceLog in otherServiceLogs: if serviceLog.endswith('Service.log'): text = text \ +"\n\n--- %s INFORMATION ---\n\n" % (serviceLog,) \ +GetLogText(2000, serviceLog) return text commentAndLog = "\n\n--- EMAIL TO CONTACT REPORTER ---\n\n" + str(email) \ +"\n\n--- REPORTER CLIENT PROFILE --- \n\n" + profileString \ +"\n\n--- COMMENT FROM REPORTER --- \n\n" + comment logText = None if logFile == NO_LOG: args['short_desc'] = "Feature or bug report from menu option" elif logFile == VENUE_MANAGEMENT_LOG: args['short_desc'] = "Automatic Bug Report - Venue Management" args['product'] = "Virtual Venue Server Software" args['component'] = "Management UI" logText = GetLogText(10000, "VenueManagement.log") commentAndLog = commentAndLog \ +"\n\n--- VenueManagement.log INFORMATION ---\n\n"+ logText elif logFile == NODE_SETUP_WIZARD_LOG: args['short_desc'] = "Automatic Bug Report - Node Setup Wizard" args['product'] = "Node Management Software" args['component'] = "NodeSetupWizard" logText = GetLogText(10000, "NodeSetupWizard.log") commentAndLog = commentAndLog \ +"\n\n--- NodeSetupWizard.log INFORMATION ---\n\n"+ logText commentAndLog = AppendNodeLogs(commentAndLog) else: args['short_desc'] = "Automatic Bug Report - Venue Client" logToSearch = GetLogText(10000, "VenueClient.log") commentAndLog = commentAndLog \ +"\n\n--- VenueClient.log INFORMATION ---\n\n"+ logToSearch \ commentAndLog = AppendNodeLogs(commentAndLog) # If we've got a logToSearch, look at it to find a exception # at the end. If it has one, mark the component as Certificate # Management. if logToSearch: loc = logToSearch.rfind("Traceback") if loc >= 0: m = re.search(".*Exception.*", logToSearch[loc:]) if m: args['component'] = "Certificate Management" logToSearch = None # Look at the end of the log and guess whether we need to mark this args['comment'] = configData + "\n\n" + commentAndLog # Now submit to the form. params = urllib.urlencode(args) f = urllib.urlopen(url, params) # And read the output. out = f.read() f.close() o = open("out.html", "w") o.write(out) o.close()