Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FACT-3160) Fix size calculations for AIX blockdevice and partitions #2528

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/facter/resolvers/aix/disks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
joshcooper marked this conversation as resolved.
Show resolved Hide resolved
size_physical_partition = size_hash['PP SIZE']
exp = if size_physical_partition[/mega/]
Facter::Util::Aix::InfoExtractor::MEGABYTES_EXPONENT
Expand Down
4 changes: 2 additions & 2 deletions lib/facter/resolvers/aix/partitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
joshcooper marked this conversation as resolved.
Show resolved Hide resolved
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/util/aix/info_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down