(self)
return devices_labels
Get device labels using the `lsblk` command. Returns a map of device name to label:value
Get device labels using the `lsblk` command. Returns a map of device name to label:value
Get device labels using the lsblk command . Returns a map of device name to label : value
def _get_devices_label_from_lsblk(self):
        """
        Get device labels using the `lsblk` command. Returns a map of device name to label:value
        """
        devices_labels = dict()
        try:
            # Use raw output mode (space-separated fields encoded in UTF-8).
            # We want to be compatible with lsblk version 2.19 since
            # it is the last version supported by CentOS 6 and SUSE 11.
            lsblk_out, _, _ = get_subprocess_output(["lsblk", "--noheadings", "--raw", "--output=NAME,LABEL"], self.log)

            for line in lsblk_out.splitlines():
                device, _, label = line.partition(' ')
                if label:
                    # Line sample (device "/dev/sda1" with label " MY LABEL")
                    # sda1  MY LABEL
                    devices_labels["/dev/" + device] = ['label:{}'.format(label), 'device_label:{}'.format(label)]

        except SubprocessOutputEmptyError:
            self.log.debug("Couldn't use lsblk to have device labels")

        return devices_labels
def _get_devices_label_from_lsblk ( self ) : devices_labels = dict ( ) try : # Use raw output mode (space-separated fields encoded in UTF-8). # We want to be compatible with lsblk version 2.19 since # it is the last version supported by CentOS 6 and SUSE 11. lsblk_out , _ , _ = get_subprocess_output ( [ "lsblk" , "--noheadings" , "--raw" , "--output=NAME,LABEL" ] , self . log ) for line in lsblk_out . splitlines ( ) : device , _ , label = line . partition ( ' ' ) if label : # Line sample (device "/dev/sda1" with label " MY LABEL") # sda1  MY LABEL devices_labels [ "/dev/" + device ] = [ 'label:{}' . format ( label ) , 'device_label:{}' . format ( label ) ] except SubprocessOutputEmptyError : self . log . debug ( "Couldn't use lsblk to have device labels" ) return devices_labels