| | 53 | |
| | 54 | def namingServiceIsRunning(self): |
| | 55 | namecltResult = os.popen('nameclt list').read() |
| | 56 | if namecltResult.startswith('DomainName'): |
| | 57 | return True |
| | 58 | return False; |
| | 59 | |
| | 60 | def startNamingService(self): |
| | 61 | nsCommand = self.controller.getOSSIEProperty('ossie', 'naming.service.start.command') |
| | 62 | if not nsCommand == None: |
| | 63 | if nsCommand.startswith('sudo'): |
| | 64 | dialog = wx.TextEntryDialog(None, 'Please enter your root password to restart the naming service:', 'Restart Naming Service', '', style = wx.TE_PASSWORD | wx.OK | wx.CANCEL) |
| | 65 | if dialog.ShowModal() == wx.ID_OK: |
| | 66 | password = dialog.GetValue() |
| | 67 | command = 'echo ' + '\"' + password + '\"' + ' | sudo -kS ' + nsCommand[5:] |
| | 68 | subprocess.Popen(command, shell=True) |
| | 69 | time.sleep(2) |
| | 70 | else: |
| | 71 | subprocess.Popen(nsCommand, shell=True) |
| | 72 | else: |
| | 73 | #default case |
| | 74 | nsCommand = 'sudo service omniorb4-nameserver restart' |
| | 75 | dialog = wx.TextEntryDialog(None, 'Please enter your root password to restart the naming service:', 'Restart Naming Service', '', style = wx.TE_PASSWORD | wx.OK | wx.CANCEL) |
| | 76 | if dialog.ShowModal() == wx.ID_OK: |
| | 77 | password = dialog.GetValue() |
| | 78 | command = 'echo ' + '\"' + password + '\"' + ' | sudo -kS ' + nsCommand[5:] |
| | 79 | subprocess.Popen(command, shell=True) |
| | 80 | time.sleep(2) |