diff --git a/lib/facter/resolvers/aix/disks.rb b/lib/facter/resolvers/aix/disks.rb index b19ffbcb23..bd55436fbe 100644 --- a/lib/facter/resolvers/aix/disks.rb +++ b/lib/facter/resolvers/aix/disks.rb @@ -47,7 +47,7 @@ def find_size(name) end def compute_size(size_hash) - physical_partitions = size_hash['TOTAL PPs'].to_i + size_hash['FREE PPs'].to_i + physical_partitions = size_hash['TOTAL PPs'].to_i size_physical_partition = size_hash['PP SIZE'] exp = if size_physical_partition[/mega/] Facter::Util::Aix::InfoExtractor::MEGABYTES_EXPONENT diff --git a/lib/facter/resolvers/aix/partitions.rb b/lib/facter/resolvers/aix/partitions.rb index 2344f97a3e..bd1d854ca4 100644 --- a/lib/facter/resolvers/aix/partitions.rb +++ b/lib/facter/resolvers/aix/partitions.rb @@ -56,14 +56,14 @@ def populate_from_lslv(name) end def compute_size(info_hash) - physical_partitions = info_hash['PPs'].to_i + logical_partitions = info_hash['LPs'].to_i size_physical_partition = info_hash['PP SIZE'] exp = if size_physical_partition[/mega/] Facter::Util::Aix::InfoExtractor::MEGABYTES_EXPONENT else Facter::Util::Aix::InfoExtractor::GIGABYTES_EXPONENT end - size_physical_partition.to_i * physical_partitions * exp + size_physical_partition.to_i * logical_partitions * exp end end end diff --git a/lib/facter/util/aix/info_extractor.rb b/lib/facter/util/aix/info_extractor.rb index 9944571b7b..939919b4c3 100644 --- a/lib/facter/util/aix/info_extractor.rb +++ b/lib/facter/util/aix/info_extractor.rb @@ -61,7 +61,7 @@ def self.extract(content, cmd) properties = PROPERTIES[cmd] properties.each do |property| str = (properties - [property]).join('|') - matcher = content.match(/#{Regexp.escape(property)}([^\n]*?)(#{str}|\n|$)/s) + matcher = content.match(/(?:^|^[^:]+:[^:]+)#{Regexp.escape(property)}([^\n]*?)(#{str}|\n|$)/s) if matcher value = matcher[1].strip property_hash[property.split(':').first] = value diff --git a/spec/facter/resolvers/aix/disks_spec.rb b/spec/facter/resolvers/aix/disks_spec.rb index 165fb2b89b..2b7b465dd7 100644 --- a/spec/facter/resolvers/aix/disks_spec.rb +++ b/spec/facter/resolvers/aix/disks_spec.rb @@ -28,7 +28,7 @@ let(:result) { load_fixture('lspv_output').read } let(:disks) do - { 'hdisk0' => { size: '30.00 GiB', size_bytes: 32_212_254_720 } } + { 'hdisk0' => { size: '29.97 GiB', size_bytes: 32_178_700_288 } } end before do