def __init__(self, stdin=sys.stdin, foreground=True): self.bridge = None # default bridge self.ipt = IPtables() if foreground: output('EasyOVS %s, type help for information\n' % VERSION) self.prompt = color_str(PROMPT_KW, 'g') self.stdin = stdin self.in_poller = poll() self.in_poller.register(stdin) Cmd.__init__(self) output("***\n Welcome to EasyOVS," "type help to see available commands.\n***\n") info('*** Starting CLI:\n') debug("==Loading credentials==\n") debug("auth_url = %s\n" % os.getenv('OS_AUTH_URL') or cfg.CONF.OS.auth_url) debug("username = %s\n" % os.getenv('OS_USERNAME') or cfg.CONF.OS.username) passwd = os.getenv('OS_PASSWORD') or cfg.CONF.OS.password passwd = passwd[:len(passwd) / 4] + "****" + passwd[-len(passwd) / 4:] debug("password = %s\n" % passwd) debug("tenant_name = %s\n" % os.getenv('OS_TENANT_NAME') or cfg.CONF.OS.tenant_name) while True: try: #if self.isatty(): #quietRun( 'stty sane' ) self.cmdloop() break except KeyboardInterrupt: info('\nInterrupt\n')
def __init__(self, stdin=sys.stdin, foreground=True): self.bridge = None # default bridge self.ipt = None self.nss = None self.dvr = None if foreground: self.prompt = color_str(PROMPT_KW, 'g') self.stdin = stdin self.in_poller = poll() self.in_poller.register(stdin) Cmd.__init__(self) output("***\n Welcome to EasyOVS %s, " "type help to see available cmds.\n***\n" % VERSION) info('*** Starting CLI:\n') debug("==Loading credentials==\n") debug("auth_url = %s\n" % os.getenv('OS_AUTH_URL') or cfg.CONF.OS.auth_url) debug("username = %s\n" % os.getenv('OS_USERNAME') or cfg.CONF.OS.username) passwd = os.getenv('OS_PASSWORD') or cfg.CONF.OS.password passwd = passwd[:len(passwd)/4] + "****" + passwd[-len(passwd)/4:] debug("password = %s\n" % passwd) debug("tenant_name = %s\n" % os.getenv('OS_TENANT_NAME') or cfg.CONF.OS.tenant_name) while True: try: #if self.isatty(): #quietRun( 'stty sane' ) self.cmdloop() break except KeyboardInterrupt: info('\nInterrupt\n')
def cleanup(): """Clean up junk which might be left over from old runs; """ sh('pkill -9 -f "neutron port-list"') info("*** Removing junk from /tmp\n") sh('rm -f /tmp/tmp_switch_* /tmp/vlogs* /tmp/*.out /tmp/*.log') info("*** Cleanup complete.\n")
def __init__(self, bridge=None, stdin=sys.stdin): self.prompt = color_str('g', PROMPT_KW) self.bridge = bridge self.stdin = stdin self.in_poller = poll() self.in_poller.register(stdin) Cmd.__init__(self) output("***\n Welcome to EasyOVS, type help to see available commands.\n***\n") info('*** Starting CLI:\n') while True: try: #if self.isatty(): #quietRun( 'stty sane' ) self.cmdloop() break except KeyboardInterrupt: info('\nInterrupt\n')
def __init__(self, bridge=None, stdin=sys.stdin): self.prompt = color_str('g', PROMPT_KW) self.bridge = bridge self.stdin = stdin self.in_poller = poll() self.in_poller.register(stdin) Cmd.__init__(self) output( "***\n Welcome to EasyOVS, type help to see available commands.\n***\n" ) info('*** Starting CLI:\n') while True: try: #if self.isatty(): #quietRun( 'stty sane' ) self.cmdloop() break except KeyboardInterrupt: info('\nInterrupt\n')
def __init__(self, bridge=None, stdin=sys.stdin): self.prompt = color_str("g", PROMPT_KW) self.bridge = bridge self.stdin = stdin self.in_poller = poll() self.in_poller.register(stdin) Cmd.__init__(self) output("***\n Welcome to EasyOVS, type help to see available commands.\n***\n") info("*** Starting CLI:\n") debug("==cfg.ADMIN==\n") debug("auth_url = %s\n" % cfg.CONF.OS.auth_url) debug("username = %s\n" % cfg.CONF.OS.username) debug("password = %s\n" % cfg.CONF.OS.password) debug("tenant_name = %s\n" % cfg.CONF.OS.tenant_name) while True: try: # if self.isatty(): # quietRun( 'stty sane' ) self.cmdloop() break except KeyboardInterrupt: info("\nInterrupt\n")
def __init__(self, bridge=None, stdin=sys.stdin): self.prompt = color_str('g', PROMPT_KW) self.bridge = bridge self.stdin = stdin self.in_poller = poll() self.in_poller.register(stdin) Cmd.__init__(self) output("***\n Welcome to EasyOVS, type help to see available commands.\n***\n") info('*** Starting CLI:\n') debug("==cfg.ADMIN==\n") debug("auth_url = %s\n" % cfg.CONF.OS.auth_url) debug("username = %s\n" % cfg.CONF.OS.username) debug("password = %s\n" % cfg.CONF.OS.password) debug("tenant_name = %s\n" % cfg.CONF.OS.tenant_name) while True: try: #if self.isatty(): #quietRun( 'stty sane' ) self.cmdloop() break except KeyboardInterrupt: info('\nInterrupt\n')
def sh(cmd): """ Print a command and send it to the shell """ info(cmd + '\n') return Popen(['/bin/sh', '-c', cmd], stdout=PIPE).communicate()[0]
def sh(cmd): """ Print a command and send it to the shell """ info(cmd + "\n") return Popen(["/bin/sh", "-c", cmd], stdout=PIPE).communicate()[0]