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
def do_config_siege(self, line): """Create siege config, deploy it to cannons""" if self._cannons_deployed: if self._siege_config: print ' Siege config detected in settings and will be automatically deployed with "setup"' answer = raw_input(' Continue? (y/n) ') if answer.lower() == 'n': return siegerc = raw_input(' Enter siege config data: ') if self._write_siege_config(eval(siegerc)): print ' Siege config written, deploying to cannons' setup_siege(self._cannon_hosts) self._siege_config = eval(siegerc) else: print 'ERROR: Cannot write new siege config' else: print 'ERROR: Cannons not deployed yet'