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)
30 def log(desc, arg=None):
34 def error_and_exit(error_code, error_desc):
36 print "status={0}. {1}".format(error_code, '' if error_desc is None else error_desc)
38 print "status={0}".format(error_code)
42 def print_name_and_return_code(name, code):
43 print "{0:30} | {1:6}".format(name, code)
46 def print_frame_line():
47 print "----------------------------------------"
50 def parse_cmd_line_params(argv):
51 print 'Number of arguments:', len(sys.argv), 'arguments.'
59 opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="])
60 except getopt.GetoptError:
62 error_and_exit(2, 'Invalid input')
69 elif opt in ("-i", "--ip"):
71 elif opt in ("-p", "--port"):
73 elif opt in ("-u", "--user"):
75 elif opt in ("-s", "--scheme"):
78 print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user
83 return scheme, be_host, be_port, admin_user
88 0], '[optional -s <scheme> | --scheme=<scheme>, default http ] [-i <be host> | --ip=<be host>] [-p <be port> ' \
89 '| --port=<be port> ] [-u <user userId> | --user=<user userId> ] '