コード例 #1
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
    def do_setup(self, line):
        """Setup system, deploy configs and urls"""
        if not self._cannon_infos:
            print 'ERROR: No cannons defined, try "config" or "deploy"'
            return

        start_time = time.time()
        print 'Setting up cannons'
        self._cannon_hosts = [h[1] for h in self._cannon_infos]
        status = setup_cannons(self._cannon_hosts)

        if self._siege_config:
            if self._write_siege_config(self._siege_config):
                print 'Siege config written, deploying to cannons'
                setup_siege(self._cannon_hosts)
            else:
                print 'ERROR: Cannot write new siege config'

        if self._siege_urls:
            if self._write_siege_urls(self._siege_urls):
                print 'Siege urls written, deploying to cannons'
                setup_siege_urls(self._cannon_hosts)
            else:
                print 'ERROR: Cannot write urls'

        print 'Finished setup - time: %s' % (time.time()-start_time)

        print 'Sending reboot message to cannons'
        reboot_cannons([h[0] for h in self._cannon_infos])
        self._cannons_deployed = True
コード例 #2
0
    def do_setup(self, line):
        """Setup system, deploy configs and urls"""
        if not self._cannon_infos:
            print 'ERROR: No cannons defined, try "config" or "deploy"'
            return

        start_time = time.time()
        print 'Setting up cannons'
        self._cannon_hosts = [h[1] for h in self._cannon_infos]
        status = setup_cannons(self._cannon_hosts)

        if self._siege_config:
            if self._write_siege_config(self._siege_config):
                print 'Siege config written, deploying to cannons'
                setup_siege(self._cannon_hosts)
            else:
                print 'ERROR: Cannot write new siege config'

        if self._siege_urls:
            if self._write_siege_urls(self._siege_urls):
                print 'Siege urls written, deploying to cannons'
                setup_siege_urls(self._cannon_hosts)
            else:
                print 'ERROR: Cannot write urls'

        print 'Finished setup - time: %s' % (time.time()-start_time)

        print 'Sending reboot message to cannons'
        reboot_cannons([h[0] for h in self._cannon_infos])
        self._cannons_deployed = True
コード例 #3
0
ファイル: commands.py プロジェクト: ox/microarmy
    def do_setup(self, line):
        """Setup system, deploy configs and urls"""
        if not self._cannon_infos:
            print 'ERROR: No cannons defined, try "config" or "deploy"'
            return

        start_time = time.time()
        print 'Setting up cannons'
        self._cannon_hosts = [h[1] for h in self._cannon_infos]
        status = setup_cannons(self._cannon_hosts)


        print status

        print 'Finished setup - time: %s' % (time.time() - start_time)

        print 'Sending reboot message to cannons'
        reboot_cannons([h[0] for h in self._cannon_infos])
        self._cannons_deployed = True
コード例 #4
0
ファイル: command_center.py プロジェクト: d1on/microarmy
        print '  quit:     RIP'
        print '  deploy:   Starts cannon initializations routines'
        print '  config:   Allows a user to specify existing cannons'
        print '  fire:     Asks for a url and then fires the cannons'      

    ## QUIT
    elif command == "quit":
        import sys
        sys.exit(0)

    ## INIT_CANNONS
    elif command == "deploy":
        _cannon_hosts = init_cannons()
        print 'Giving cannons 30 seconds to boot'
        time.sleep(30)
        status = setup_cannons(_cannon_hosts)
        _cannons_deployed = True

    # CONFIG
    elif command == "config":
        host_string = raw_input('  type host list: ')
        hosts = eval(host_string)
        _cannon_hosts = hosts
        _cannons_deployed = True

    # FIRE
    elif command == "fire":
        if _cannons_deployed:
            target = raw_input('  target: ')
            report = slam_host(_cannon_hosts, target)