# frozen_string_literal: true require 'facter' Facter.add(:ceph_osd_devices) do confine kernel: 'Linux' confine { Facter.value(:is_virtual) == false } confine { Facter::Core::Execution.which('pvs') } setcode do devices = [] output = Facter::Core::Execution.execute( 'pvs --noheadings -o pv_name,vg_name 2>/dev/null', on_fail: nil ) output&.each_line do |line| pv_name, vg_name = line.split next unless pv_name && vg_name devices << pv_name if vg_name.start_with?('ceph-') end devices.sort end end