def run(self): if not hasattr(self, 'panel'): self.panel = ItdchelperProjectPanel(self.window, 'ItdchelperCreateCmsProject', 'Create ITDC CMS Project:'+"\n") key = self.getKey() self.panel.append('Creating project "'+self.domain+'"') self.panel.append('Loading') thread2 = ItdchelperLoading(self.panel) thread2.start() service_url = self.localservice_url + '?mode=create&name='+self.domain+'&key='+key #self.panel.append('DEBUG: request to '+service_url) request = ITDCRequest(service_url) if (request.isError()): thread2.stop() stderr = "Error: "+request.getError() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) txt = stderr + elapsed self.panel.replace(txt) self.panel.finish() return False json_data = request.getJSON() #self.panel.append(' Success', False) # insert in service.itdc.ge service_url = self.remoteservice_url + '/name/'+self.domain+'/key/'+key #self.panel.append('DEBUG: request to '+service_url) request = ITDCRequest(service_url) if (request.isError()): thread2.stop() stderr = "Error: "+request.getError() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) txt = stderr + elapsed self.panel.replace(txt) self.panel.finish() return False json_data2 = request.getJSON() #self.panel.append(' Success', False) thread2.stop() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) status = json_data['status'] msg = json_data['msg'] + elapsed if (status == "ERROR"): msg = "Error: "+msg self.panel.replace(msg) self.panel.finish()
def run(self): if not hasattr(self, 'panel'): self.panel = ItdchelperProjectPanel(self.window, 'ItdchelperToolsCmd', 'Command: "'+self.cmd+'"'+"\n") self.panel.append('Executing command') self.panel.append('Loading') thread2 = ItdchelperLoading(self.panel) thread2.start() cmd = quote(self.cmd) service_url = self.localservice_url + '?cmd='+cmd #print(service_url) #self.panel.append('DEBUG: request to '+service_url) request = ITDCRequest(service_url) if (request.isError()): thread2.stop() stderr = "Error: "+request.getError() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) txt = stderr + elapsed self.panel.replace(txt) self.panel.finish() return False json_data = request.getJSON() #self.panel.append(' Success', False) thread2.stop() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) status = json_data['status'] msg = json_data['msg'] + elapsed if (status == "ERROR"): msg = "Error: "+msg self.panel.replace(msg) self.panel.finish()
def run(self): if not hasattr(self, 'panel'): self.panel = ItdchelperProjectPanel(self.window, 'ItdchelperBackupEmptyProject', 'Backup ITDC Empty Project:'+"\n") self.panel.append('Backuping project "'+self.domain+'"') self.panel.append('Loading') thread2 = ItdchelperLoading(self.panel) thread2.start() service_url = self.localservice_url + '?mode=backuphost&name='+self.domain #self.panel.append('DEBUG: request to '+service_url) request = ITDCRequest(service_url) if (request.isError()): thread2.stop() stderr = "Error: "+request.getError() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) txt = stderr + elapsed self.panel.replace(txt) self.panel.finish() return False json_data = request.getJSON() #self.panel.append(' Success', False) thread2.stop() elapsed = "\n= = = = = = = = = = = = = = =\nExecution time: %.3f sec" % round((time.time() - self.start_time), 3) status = json_data['status'] msg = json_data['msg'] + elapsed if (status == "ERROR"): msg = "Error: "+msg self.panel.replace(msg) self.panel.finish()