def handle_options(args): """Helper function for handling 'option' command""" session_args = get_session_args(args) # Get Option if args.cmd == 'options-get': try: value = tiflash.get_option(args.optionID, pre_operation=args.operation, **session_args) print(value) except Exception as e: __exit_with_error(e) # Set Option elif args.cmd == 'options-set': try: tiflash.set_option(args.optionID, args.optionVal, post_operation=args.operation, **session_args) except Exception as e: __exit_with_error(e) # Display Option Information elif args.cmd == 'options-list': options = tiflash.list_options(option_id=args.optionID, **session_args) header = "Options (%s):" % args.optionID if args.optionID else "Options:" print(header) print("-" * len(header)) __print_options(options)
def test_list_options(self, device): """Tests all options returned in list are valid""" options = tiflash.list_options(serno=device['serno'], connection=device['connection'], devicetype=device['devicetype']) assert len(options) > 1
def test_list_single_nonexistant_option(self, device): """Tests listing of specified option that does not exist""" options = tiflash.list_options(option_id="InvalidOption", serno=device['serno'], connection=device['connection'], devicetype=device['devicetype']) assert len(options) == 0
def test_list_single_option(self, tdev): """Tests listing of one specified option""" options = tiflash.list_options( option_id=tdev['option'], serno=tdev['serno'], connection=tdev['connection'], devicetype=tdev['devicetype']) assert len(options) == 1 assert tdev['option'] in options.keys()
def test_list_single_option(self, device): """Tests listing of one specified option""" option_to_test = "DeviceInfoRevision" options = tiflash.list_options(option_id=option_to_test, serno=device['serno'], connection=device['connection'], devicetype=device['devicetype']) assert len(options) == 1 assert option_to_test in options.keys()
def handle_list(args): """Helper function for handling 'list' command""" results = [] session_args = get_session_args(args) if args.devicetypes: results = tiflash.get_devicetypes(args.ccs, search=args.search) elif args.connections: results = tiflash.get_connections(args.ccs, search=args.search) elif args.cpus: results = tiflash.get_cpus(args.ccs, search=args.search) elif args.options: # tiflash.print_options(**session_args) results = tiflash.list_options(**session_args) for e in results: print(e)