(self, current_device, device_params)
return current_device
Normalise current device specification.
Normalise current device specification.
Normalise current device specification .
def _normalise_current_device(self, current_device, device_params):
        """Normalise current device specification."""
        current_device = self._normalise_device_name(current_device)
        if current_device and current_device != b'CAS1' and current_device not in DRIVE_LETTERS:
            logging.error('Invalid current device `%s`', current_device)
            current_device = b''
        if (
                not current_device or current_device not in device_params.keys()
                or b'Z' in device_params and not device_params[b'Z']
            ):
            if device_params:
                if b'Z' in device_params and not device_params[b'Z']:
                    # if not set or not sensible, set current device to last disk available
                    available = sorted(
                        _k for _k in device_params.keys() if len(_k) == 1 and device_params[_k]
                    )
                    if available:
                        current_device = available[-1]
                    else:
                        current_device = b'@'
                else:
                    current_device = b'Z'
            else:
                # if nothing mounted at all and not set to CAS1, current device will be @:
                current_device = b'@'
        return current_device
def _normalise_current_device ( self , current_device , device_params ) : current_device = self . _normalise_device_name ( current_device ) if current_device and current_device != b'CAS1' and current_device not in DRIVE_LETTERS : logging . error ( 'Invalid current device `%s`' , current_device ) current_device = b'' if ( not current_device or current_device not in device_params . keys ( ) or b'Z' in device_params and not device_params [ b'Z' ] ) : if device_params : if b'Z' in device_params and not device_params [ b'Z' ] : # if not set or not sensible, set current device to last disk available available = sorted ( _k for _k in device_params . keys ( ) if len ( _k ) == 1 and device_params [ _k ] ) if available : current_device = available [ - 1 ] else : current_device = b'@' else : current_device = b'Z' else : # if nothing mounted at all and not set to CAS1, current device will be @: current_device = b'@' return current_device