Changeset 10469

Show
Ignore:
Timestamp:
10/25/10 14:52:15 (3 years ago)
Author:
Snyder.Jason
Message:

alf now checks to see if the naming service is running and starts it if necessary, using the naming.service.start.command found in ~/.ossie.cfg

Location:
ossiedev/trunk/tools/alf
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/tools/alf/ALF.py

    r10467 r10469  
    141141         
    142142        self.Bind(wx.EVT_CLOSE, self.OnClose) 
     143 
    143144        self.nodeBooterProcess = None 
    144145        nbUtils = ALFNodeBooterUtils() 
     146        if not nbUtils.namingServiceIsRunning(): 
     147            nbUtils.startNamingService() 
    145148        if not nbUtils.nodeBooterIsRunning(): 
    146149            self.nodeBooterProcess = nbUtils.startNodeBooter() 
  • ossiedev/trunk/tools/alf/ALFNodeBooterUtils.py

    r10462 r10469  
    2222import time 
    2323import ConfigParser 
     24import wx 
    2425 
    2526 
     
    5253        return nodeBooterProcess 
    5354             
     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