Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 """flumotion-admin-text entry point, command line parsing and invokation""" 23 24 import curses 25 26 from twisted.internet import reactor 27 28 from flumotion.admin.text import connection 29 from flumotion.admin.text.greeter import AdminTextGreeter 30 from flumotion.common import messages # make Message proxyable 31 from flumotion.common.options import OptionParser 32 33 __version__ = "$Rev: 7162 $" 34 35 41 4244 # initialise curses 45 46 stdscr = curses.initscr() 47 curses.noecho() 48 curses.cbreak() 49 stdscr.nodelay(1) 50 stdscr.keypad(1) 51 52 reactor.addSystemEventTrigger('after', 53 'shutdown', cleanup_curses, stdscr) 54 55 56 # first lets sort out logging in 57 username = 'user' 58 password = 'test' 59 hostname = 'localhost' 60 insecure = False 61 port = 7531 62 if options.username and options.password and options.hostname: 63 username = options.username 64 password = options.password 65 hostname = options.hostname 66 if options.port: 67 try: 68 port = int(options.port) 69 except ValueError: 70 pass 71 if options.insecure: 72 insecure = True 73 connection.connect_to_manager(stdscr, hostname, port, 74 insecure, username, password) 75 76 else: 77 # do greeter 78 # get recent connections 79 greeter = AdminTextGreeter(stdscr) 80 reactor.addReader(greeter) 81 greeter.show()82 8385 parser = OptionParser(domain="flumotion-admin-text") 86 parser.add_option('-u', '--username', 87 action="store", type="string", dest="username", 88 help="set username to connect to manager") 89 parser.add_option('-P', '--password', 90 action="store", type="string", dest="password", 91 help="set password to connect to manager") 92 parser.add_option('-H', '--hostname', 93 action="store", type="string", dest="hostname", 94 help="set hostname of manager to connect to") 95 parser.add_option('-p', '--port', 96 action="store", type="string", dest="port", 97 help="set port of manager to connect to") 98 parser.add_option('', '--insecure', 99 action="store_true", dest="insecure", 100 help="make insecure connection") 101 102 options, args = parser.parse_args(args) 103 104 _runInterface(options) 105 106 reactor.run()107
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sun Nov 15 09:18:12 2009 | http://epydoc.sourceforge.net |