-
Notifications
You must be signed in to change notification settings - Fork 273
Open
Labels
Description
Describe the Bug
The parse function in lib/puppet_x/lvm/output.rb removes any prefix before the first _ in column names. This causes columns like pv_size and dev_size to both become size, resulting in key collisions and data loss in the parsed output.
Expected Behavior
Each column should retain a unique key in the parsed output, so values from pv_size and dev_size are both available and not overwritten.
Steps to Reproduce
- Run the facter for
physical_volumeson a Linux system with LVM and physical volumes present. - Observe the output for the
physical_volumesfact. - Notice that only one value for
sizeis present, instead of bothpv_sizeanddev_size.
Environment
- Version: [e.g. 1.27.0]
- Platform: [e.g. Ubuntu 18.04]
Additional Context
This issue affects any columns with similar suffixes after the prefix, leading to loss of important data in the fact output.
Suggested Solution
Update the remove_prefix method in lib/puppet_x/lvm/output.rb to handle dev_size as a special case, converting it to devsize. This will retain the old behavior for pv_size (which becomes size), since pv_size is defined after dev_size in the columns array.
def self.remove_prefix(item)
return item if item == 'dev_size'
item.gsub(%r{^[A-Za-z]+_}, '')
end