Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Translate block device arrayrefs to hashrefs
Restructure the output of `lsblk --json` to convert arrayrefs of block device hashrefs to hashrefs of block device hashrefs, indexed by the block device name, to avoid an error with array processing raised by ELK: > <haxmeister> the error I see is "elastic search has limited support for arrays" Because devices usually have at least one level of sub-devices (logical partitions), and can have even more (e.g. encrypted devices), this needs to be done recursively, here implemented with an iterative breadth-first search over the whole tree. This restructuring does require that each device hashref has a "name" member with a unique value to form the index of the transformed hashref. It should print a warning if this is not the case or the data is in any other way formed in an unexpected way. None of this may be needed if we end up writing our own parser over `/sys/devices/.../block` per GitHub issue #47, but it was fun to write anyway. This should hopefully resolve GitHub issue #46.
- Loading branch information
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters