Пример #1
0
def esi_folders():
    '''
	gets the list of folders that holds ESI files
	'''
    pr1 = pr()
    esi = EsiUtil()
    folders = esi.get_ESI_folders()
    YoUtil.print_list(folders, 1)
Пример #2
0
def cmd_slave_list():
    if len(sys.argv) >= 3:
        cfg = Config(sys.argv[2])
        cfg.load_config()
        lst = cfg.get_slaves()
        YoUtil.print_list(lst, 1)
    else:
        print_usage()
Пример #3
0
def cmd_load_config_full():
    if len(sys.argv) >= 3:
        cfg = Config(sys.argv[2])
        cfg.load_config()
        master = cfg.get_master()
        lst += cfg.get_slaves()
        YoUtil.print_list(lst, 1)
    else:
        print_usage()
Пример #4
0
def find_esi(vendor, product):
    '''
		finds ESI files can fileter by [vendor] and [product]
	'''
    pr1 = pr()
    esi = EsiUtil()
    vendor_id = None
    productCode = None
    if vendor != None:
        vendor_id = YoUtil.get_int(vendor)
    if product != None:
        productCode = YoUtil.get_int(product)
    files = esi.get_ESI_files(vendor_id, productCode)
    if files != None and len(files) > 0:
        YoUtil.print_list(files, 1)
    else:
        pr1.print('ESI not found !')
Пример #5
0
def Main():
    print("ECatConfigUtil -> ")
    YoUtil.print_list(sys.argv, 1)
    numofParams = len(sys.argv)
    if numofParams > 1:
        cmd = sys.argv[1].lower()
        command_options = {
            'slaves': cmd_slave_list,
            'full': cmd_load_config_full,
        }

        if cmd in command_options.keys():
            command_options[cmd]()
        else:
            print_usage(cmd)
    else:
        print_usage()
Пример #6
0
def cmd_find(esi):			
	cmd = sys.argv[2].lower()
	if cmd == 'esi':
		files = esi.get_ESI_files()
		YoUtil.print_list(files,1)
	elif cmd == 'vendor':
		vendor_id = YoUtil.get_int(sys.argv[3])
		files = esi.get_ESI_files_by_vendor(vendor_id)
		YoUtil.print_list(files,1)
	elif cmd == 'createdb':
		if esi.create_esi_db('esi.db') == True:
			print('ESI DB created successfully')
		else:
			print('failed to create ESI DB ')
	elif cmd == 'device_esi':
		vendor_id = YoUtil.get_int(sys.argv[3])
		productCode = YoUtil.get_int(sys.argv[4])
		revisionNumber = None
		if len(sys.argv) > 5:
			revisionNumber = YoUtil.get_int(sys.argv[5])
		files = esi.get_devices(vendor_id,productCode,revisionNumber)
		YoUtil.print_list(files,1)
	else:
		print_usage('find')
Пример #7
0
def cmd_esi_folder(esi):
	YoUtil.print_list(esi.get_ESI_folders(),1)