def main(self): if not self.args.devices: return self.parser.print_help() # Default to bluestore here since defaulting it in add_argument may # cause both to be True if not self.args.bluestore and not self.args.filestore: self.args.bluestore = True if (self.args.auto and not self.args.db_devices and not self.args.wal_devices and not self.args.journal_devices): self._sort_rotational_disks() self._check_slot_args() ensure_disjoint_device_lists(self.args.devices, self.args.db_devices, self.args.wal_devices, self.args.journal_devices) plan = self.get_plan(self.args) if self.args.report: self.report(plan) return 0 if not self.args.yes: self.report(plan) terminal.info( 'The above OSDs would be created if the operation continues') if not prompt_bool('do you want to proceed? (yes/no)'): terminal.error('aborting OSD provisioning') raise SystemExit(0) self._execute(plan)
def execute(self, args): strategy = get_strategy(self.get_filtered_devices(args.devices), args) if not args.yes: strategy.report_pretty() terminal.info('The above OSDs would be created if the operation continues') if not prompt_bool('do you want to proceed? (yes/no)'): terminal.error('aborting OSD provisioning for %s' % ','.join(args.devices)) raise SystemExit(0) strategy.execute()
def execute(self): if not self.args.yes: self.strategy.report_pretty(self.filtered_devices) terminal.info('The above OSDs would be created if the operation continues') if not prompt_bool('do you want to proceed? (yes/no)'): devices = ','.join([device.abspath for device in self.args.devices]) terminal.error('aborting OSD provisioning for %s' % devices) raise SystemExit(0) self.strategy.execute()
def execute(self, args): strategy = self._get_strategy(args) if not args.yes: strategy.report_pretty() terminal.info('The above OSDs would be created if the operation continues') if not prompt_bool('do you want to proceed? (yes/no)'): devices = ','.join([device.abspath for device in args.devices]) terminal.error('aborting OSD provisioning for %s' % devices) raise SystemExit(0) strategy.execute()
def execute(self, args): strategy = get_strategy(self.get_filtered_devices(args.devices), args) if not args.yes: strategy.report_pretty() terminal.info( 'The above OSDs would be created if the operation continues') if not prompt_bool('do you want to proceed? (yes/no)'): terminal.error('aborting OSD provisioning for %s' % ','.join(args.devices)) raise SystemExit(0) strategy.execute()
def test_try_again_false(self): responses = ['g', 'h', 'n'] fake_input = lambda x: responses.pop(0) qx = 'what the what?' assert util.prompt_bool(qx, _raw_input=fake_input) is False
def test_falseish(self, response): fake_input = lambda x: response qx = 'what the what?' assert util.prompt_bool(qx, _raw_input=fake_input) is False
def test_trueish(self, response): fake_input = lambda x: response qx = 'what the what?' assert util.prompt_bool(qx, input_=fake_input) is True
def test_try_again_true(self): responses = ['g', 'h', 'y'] fake_input = lambda x: responses.pop(0) qx = 'what the what?' assert util.prompt_bool(qx, input_=fake_input) is True
def test_falseish(self, response): fake_input = lambda x: response qx = 'what the what?' assert util.prompt_bool(qx, input_=fake_input) is False
def test_try_again_false(self): responses = ['g', 'h', 'n'] fake_input = lambda x: responses.pop(0) qx = 'what the what?' assert util.prompt_bool(qx, input_=fake_input) is False
def test_trueish(self, response): fake_input = lambda x: response qx = 'what the what?' assert util.prompt_bool(qx, _raw_input=fake_input) is True
def test_try_again_true(self): responses = ['g', 'h', 'y'] fake_input = lambda x: responses.pop(0) qx = 'what the what?' assert util.prompt_bool(qx, _raw_input=fake_input) is True