Changeset 206 for etherws/trunk
- Timestamp:
- 08/03/12 01:18:11 (12 years ago)
- Location:
- etherws/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
etherws/trunk/etherws.py
r205 r206 642 642 643 643 644 def print_error(error):644 def _print_error(error): 645 645 print(' %s (%s)' % (error['message'], error['code'])) 646 646 print(' %s' % error['data']) 647 647 648 648 649 def start_sw(args):649 def _start_sw(args): 650 650 def daemonize(nochdir=False, noclose=False): 651 651 if os.fork() > 0: … … 781 781 782 782 783 def start_ctl(args):783 def _start_ctl(args): 784 784 def request(args, method, params=None, id_=0): 785 785 req = urllib2.Request(args.ctlurl) … … 837 837 }) 838 838 if 'error' in result: 839 print_error(result['error'])839 _print_error(result['error']) 840 840 else: 841 841 print_portlist(result['result']['entries']) … … 849 849 }) 850 850 if 'error' in result: 851 print_error(result['error'])851 _print_error(result['error']) 852 852 else: 853 853 print_portlist(result['result']['entries']) … … 858 858 result = request(args, 'delPort', {'port': args.port}) 859 859 if 'error' in result: 860 print_error(result['error'])860 _print_error(result['error']) 861 861 else: 862 862 print_portlist(result['result']['entries']) … … 865 865 result = request(args, 'listPort') 866 866 if 'error' in result: 867 print_error(result['error'])867 _print_error(result['error']) 868 868 else: 869 869 print_portlist(result['result']['entries']) … … 872 872 result = request(args, 'listFdb') 873 873 if 'error' in result: 874 return print_error(result['error'])874 return _print_error(result['error']) 875 875 result = result['result']['entries'] 876 876 pmax = maxlen(result, 'port', 4) … … 886 886 887 887 888 def main():888 def _main(): 889 889 parser = argparse.ArgumentParser() 890 890 subcommand = parser.add_subparsers(dest='subcommand') … … 956 956 957 957 try: 958 globals()[' start_' + args.subcommand](args)958 globals()['_start_' + args.subcommand](args) 959 959 except Exception as e: 960 print_error({960 _print_error({ 961 961 'code': 0 - 32603, 962 962 'message': 'Internal error', … … 966 966 967 967 if __name__ == '__main__': 968 main()968 _main() -
etherws/trunk/setup.py
r199 r206 43 43 author_email='atzm@atzm.org', 44 44 license='BSD-2', 45 entry_points={'console_scripts': ['etherws = etherws: main']},45 entry_points={'console_scripts': ['etherws = etherws:_main']}, 46 46 py_modules=['etherws'], 47 47 keywords=['http', 'websocket', 'ethernet', 'network'],
Note: See TracChangeset
for help on using the changeset viewer.