コード例 #1
0
    def _set_volume(self, option):
        if self._volume is not None:
            return

        if option is not None and 'volume' in option:
            self._volume = option['volume']
            return

        volume_options = _get_volume_options()
        logging.error('volume_options %s', volume_options)
        if not volume_options['options']:
            raise PreConditionsError(_('Please connect a device to continue'))

        volume = _value_if_one_option(volume_options)
        if volume is not None:
            self._volume = volume
            return

        raise PreConditionsChoose(_('Select your volume'), volume_options)
コード例 #2
0
    def _set_checkpoint(self, option):
        if self._checkpoint is not None:
            return

        if option is not None and 'checkpoint' in option:
            self._checkpoint = option['checkpoint']
            return

        checkpoint_options = _get_checkpoint_options(self._volume)

        if not checkpoint_options['options']:
            raise PreConditionsError(_('No checkpoints found in the device'))

        checkpoint = _value_if_one_option(checkpoint_options)

        if checkpoint is not None:
            self._checkpoint = checkpoint
            return

        raise PreConditionsChoose(_('Select your checkpoint'),
                                  checkpoint_options)