コード例 #1
0
 def _launch_drone(self, ret, clone_entry):
     '''
      Launches the drone on the connection in the parameter
     '''
     
     print 'Launching drone (connection established)'
     
     try:
         # Read configuration template
         config = open(drones.DRONE_DIR + '/setup_vm/main_template.sh', 'r')
         data = config.readlines()
         data = ''.join(data)
         config.close()
         
         # Templating engine
         templ = Template(data)
         d = dict(hostname=clone_entry.target)
         templ = templ.substitute(d)
             
         # Write result configuration
         config = open(drones.DRONE_DIR + '/setup_vm/main.sh', 'w')
         config.writelines(templ)
         config.close()
     except Exception, e:
         traceback.print_exc(file=sys.stdout)
         return
コード例 #2
0
ファイル: clone.py プロジェクト: strategist922/sonar
def connection_established(ret, vm):
    print 'Connection established'
    
    try:
        # Read configuration template
        config = open('drones/setup_vm/main_template.sh', 'r')
        data = config.readlines()
        data = ''.join(data)
        config.close()
        
        # Templating engine
        templ = Template(data)
        d = dict(hostname=vm)
        templ = templ.substitute(d)
            
        # Write result configuration
        config = open('drones/setup_vm/main.sh', 'w')
        config.writelines(templ)
        config.close()
    except Exception, e:
        traceback.print_exc(file=sys.stdout)
        reactor.stop()
        return