3 from StringIO import StringIO
7 ###############################################################################################################
10 ###############################################################################################################
15 def join_strings(lst):
18 if string is not None:
19 if type(string) == int:
21 concat += (string + " ")
25 def debug(desc, *args):
27 print desc, join_strings(args)
34 def log(desc, arg=None):
38 def error_and_exit(error_code, error_desc):
40 print "status={0}. {1}".format(error_code, '' if error_desc is None else error_desc)
42 print "status={0}".format(error_code)
46 def print_name_and_return_code(name, code):
47 print "{0:30} | {1:6}".format(name, code)
50 def print_frame_line():
51 print "----------------------------------------"
54 def parse_cmd_line_params(argv):
55 print 'Number of arguments:', len(sys.argv), 'arguments.'
63 opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="])
64 except getopt.GetoptError:
66 error_and_exit(2, 'Invalid input')
73 elif opt in ("-i", "--ip"):
75 elif opt in ("-p", "--port"):
77 elif opt in ("-u", "--user"):
79 elif opt in ("-s", "--scheme"):
82 print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user
87 return scheme, be_host, be_port, admin_user
92 0], '[optional -s <scheme> | --scheme=<scheme>, default http ] [-i <be host> | --ip=<be host>] [-p <be port> ' \
93 '| --port=<be port> ] [-u <user userId> | --user=<user userId> ] '