| | 55 | |
| | 56 | def namingServiceIsRunning(self): |
| | 57 | namecltResult = os.popen('nameclt list').read() |
| | 58 | if namecltResult.startswith('DomainName'): |
| | 59 | return True |
| | 60 | return False; |
| | 61 | |
| | 62 | def startNamingService(self): |
| | 63 | configFile = os.getenv('HOME') + '/.ossie.cfg' |
| | 64 | if os.path.exists(configFile): |
| | 65 | configParser = ConfigParser.SafeConfigParser() |
| | 66 | configParser.read(configFile) |
| | 67 | nsCommand = configParser.get('ossie', 'naming.service.start.command') |
| | 68 | if not nsCommand == None: |
| | 69 | if nsCommand.startswith('sudo'): |
| | 70 | 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) |
| | 71 | if dialog.ShowModal() == wx.ID_OK: |
| | 72 | password = dialog.GetValue() |
| | 73 | command = 'echo ' + '\"' + password + '\"' + ' | sudo -kS ' + nsCommand[5:] |
| | 74 | subprocess.Popen(command, shell=True) |
| | 75 | time.sleep(2) |
| | 76 | else: |
| | 77 | subprocess.Popen(nsCommand, shell=True) |
| | 78 | else: |
| | 79 | #default case |
| | 80 | nsCommand = 'sudo service omniorb4-nameserver restart' |
| | 81 | 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) |
| | 82 | if dialog.ShowModal() == wx.ID_OK: |
| | 83 | password = dialog.GetValue() |
| | 84 | command = 'echo ' + '\"' + password + '\"' + ' | sudo -kS ' + nsCommand[5:] |
| | 85 | subprocess.Popen(command, shell=True) |
| | 86 | time.sleep(2) |
| | 87 | |