Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing with 80 additions and 2 deletions.
- +80 −2 lib/Funtoo/Report.pm