Esempio n. 1
0
 def checkSubmittedNodes(self, nodes):
     # create nodeset
     ns = Nodes(nodes)
     # ping nodes
     ns.checkNodes() 
     # return active nodes
     return ns.getActiveNodes()
Esempio n. 2
0
    def staticMode(self, nodes, service, action):
        # check and retrieve active nodes
        ns = Nodes(nodes)
        ns.checkNodes()
        ns_ok = ns.getActiveNodes()

        # execute the specified service
        self.exe.executeService(ns_ok, service, action)
    def executeFromLine(self,line):
        # the error message to be printed
	error_len_3 = 'Error : configuration file usage is <set of services>::<set of nodes>::<action>[-> <set of services>::<set of nodes>::<action>]\n'
        # the node set
        self.ns = None
	commande = ''
	# ignore comment or empty lines
        if line == '' or line[0] == '#':
           pass
        else:
            # retrieve each block   
            for bloc_dependance in line.split('->'):
                # retrieve each item
                split = bloc_dependance.split('::')

                # parse error
                if len(split) != 3:
                   print '%s' % error_len_3
                   exit(1)
                # retrieve services, nodes and action
                services = split[0]
                nodes = split[1]
                self.action = split[2].replace('\n','')

                print '***************************************'
                print '* Handling \'%s\' *' % bloc_dependance
                print '***************************************'
                # check nodes
                nodeList = Nodes(nodes)
                nodeList.checkNodes()
                # update node list
                self.ns = nodeList.getActiveNodes()
            
                # execute each service for the specified nodes
                for service in services.split(','):
                    self.service = service
                    self.executor.executeService(self.ns, self.service, self.action)